* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

.main-content {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

/* Botões principais no topo */
.main-actions {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 30px;
  border: 2px solid #e2e8f0;
}

.action-group {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.export-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.export-group .btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  min-width: 120px;
}

.btn-large {
  padding: 15px 30px;
  font-size: 1.1rem;
  min-width: 160px;
}

/* Layout de duas colunas (mantido para compatibilidade) */
.two-column-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.left-column,
.right-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.editor-section {
  margin-bottom: 20px;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 15px;
}

.editor-header h2 {
  color: #4a5568;
  font-size: 1.5rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

.editor-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

#simpleEditor,
#latexEditor {
  width: 100%;
  min-height: 400px;
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.3s ease;
}

#simpleEditor:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#latexEditor {
  background-color: #f8f9fa;
  color: #495057;
}

#latexEditor:focus {
  outline: none;
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  height: 44px;
  box-sizing: border-box;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
  background: #f7fafc;
  color: #4a5568;
  border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #667eea;
  font-weight: 600;
}

.loading i {
  font-size: 1.2rem;
}

.error-message {
  background: #fed7d7;
  color: #c53030;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #e53e3e;
}

.info-section {
  background: #f7fafc;
  padding: 25px;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.info-section h3 {
  color: #4a5568;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.info-section ul {
  list-style: none;
  padding-left: 0;
}

.info-section li {
  padding: 8px 0;
  position: relative;
  padding-left: 25px;
}

.info-section li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #48bb78;
  font-weight: bold;
}

.footer {
  text-align: center;
  color: white;
  opacity: 0.8;
}

.hidden {
  display: none !important;
}

/* Estilos removidos - Modal não é mais necessário */

/* Responsividade */
@media (max-width: 1200px) {
  .three-column-layout {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .right-column {
    grid-column: 1 / -1;
    margin-top: 20px;
  }
}

@media (max-width: 1024px) {
  .three-column-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .left-column,
  .middle-column,
  .right-column {
    gap: 15px;
  }

  .action-group {
    flex-direction: column;
    align-items: center;
  }

  .btn-large {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .main-content {
    padding: 20px;
  }

  .main-actions {
    padding: 20px;
    margin-bottom: 20px;
  }

  .editor-header {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-controls {
    justify-content: center;
  }

  #simpleEditor,
  #latexEditor {
    min-height: 300px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .btn-large {
    padding: 12px 24px;
    font-size: 1rem;
    min-width: auto;
  }

  .pdf-viewer {
    height: 300px;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.8rem;
  }

  .main-content {
    padding: 15px;
  }

  .main-actions {
    padding: 15px;
  }

  .editor-controls {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .btn-large {
    width: 100%;
    max-width: none;
  }
}

/* Layout de três colunas */
.three-column-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.left-column,
.middle-column,
.right-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.editor-section,
.preview-section {
  margin-bottom: 20px;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 15px;
}

.editor-header h2 {
  color: #4a5568;
  font-size: 1.5rem;
}

.editor-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#simpleEditor,
#latexEditor {
  width: 100%;
  min-height: 400px;
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.3s ease;
}

#simpleEditor:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#latexEditor {
  background-color: #f8f9fa;
  color: #495057;
}

#latexEditor:focus {
  outline: none;
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Estilos para o painel de pré-visualização */
.pdf-container {
  width: 100%;
  min-height: 400px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #f8f9fa;
  overflow: hidden;
  position: relative;
}

.pdf-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: #a0aec0;
  text-align: center;
}

.pdf-placeholder i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.pdf-placeholder p {
  font-size: 1.1rem;
  max-width: 200px;
  line-height: 1.5;
}

.pdf-viewer {
  width: 100%;
  height: 400px;
  border: none;
  background: white;
  display: block;
}

/* ===== SISTEMA DE ABAS ===== */
.tab-container {
  margin-bottom: 30px;
}

.tab-buttons {
  display: flex;
  gap: 5px;
  margin-bottom: 30px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
}

.tab-btn {
  background: #f8f9fa;
  border: 2px solid #e2e8f0;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 15px 25px;
  font-size: 1rem;
  font-weight: 600;
  color: #6c757d;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: -2px;
}

.tab-btn:hover {
  background: #e9ecef;
  color: #495057;
}

.tab-btn.active {
  background: white;
  color: #667eea;
  border-color: #667eea;
  border-bottom: 2px solid white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== SEÇÃO JSON ===== */
.json-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.json-section {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 25px;
  border: 2px solid #e2e8f0;
}

#jsonEditor {
  width: 100%;
  min-height: 300px;
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.3s ease;
  background: white;
}

#jsonEditor:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.json-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  border: 2px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 20px;
}

.format-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.format-selector label {
  font-weight: 600;
  color: #4a5568;
}

.format-selector select {
  padding: 8px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

.json-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.result-section {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  border: 2px solid #e2e8f0;
}

.result-section h3 {
  color: #4a5568;
  font-size: 1.2rem;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#jsonMarkdownResult,
#jsonLatexResult {
  width: 100%;
  min-height: 200px;
  padding: 15px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  background: white;
  color: #495057;
}

.file-result {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: #6c757d;
}

.file-result a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

.file-result a:hover {
  text-decoration: underline;
}

/* Responsividade para JSON */
@media (max-width: 768px) {
  .json-results {
    grid-template-columns: 1fr;
  }
  
  .json-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .format-selector {
    justify-content: center;
  }
}

/* Modal de Preview PDF */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 1000px;
  height: 90%;
  max-height: 800px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.2rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 5px;
  border-radius: 4px;
  transition: color 0.3s;
}

.modal-close:hover {
  color: #333;
  background: #e9ecef;
}

.modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: center;
}

.modal-pdf-container {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.modal-pdf-viewer {
  width: 100%;
  height: 100%;
  border: none;
}

/* Responsividade do Modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    height: 95%;
  }
  
  .modal-actions {
    flex-direction: column;
  }
}
