/* ===== Variables CSS ===== */
:root {
  --primary: #6f8f7f;       /* Verde principal */
  --primary-dark: #5a7366;
  --primary-light: #8aa99a;
  --bg: #f8faf9;           /* Fondo claro */
  --txt: #1f2937;          /* Texto principal */
  --txt-muted: #6b7280;    /* Texto secundario */
  --panel: #ffffff;        /* Paneles blancos */
  --border: #e5e7eb;       /* Bordes sutiles */
  --border-focus: #6f8f7f; /* Bordes activos */
  --btn-primary: #2563eb;  /* Azul botones */
  --btn-secondary: #6b7280;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--btn-primary) 0%, #1d4ed8 100%);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--btn-secondary) 0%, #4b5563 100%);
}

.btn-icon {
  font-size: 16px;
}

/* ===== Resultados ===== */
.results-panel {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.results-header {
  background: var(--primary);
  color: white;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.results-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.results-content {
  padding: 1.5rem;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--txt);
  max-height: 400px;
  overflow-y: auto;
}

.results-content.empty {
  color: var(--txt-muted);
  font-style: italic;
  text-align: center;
  font-family: inherit;
}

/* ===== Elementos Especiales ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

.loading-text {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: 90px;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: white;
  color: var(--txt);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--success);
  max-width: 350px;
  transform: translateX(100%);
  animation: slideIn 0.3s ease-out forwards;
}

.toast.error {
  border-left-color: var(--error);
}

.toast.warning {
  border-left-color: var(--warning);
}

@keyframes slideIn {
  to { transform: translateX(0); }
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.9rem;
  color: var(--txt-muted);
}

/* ===== Utilidades ===== */
.text-center { text-align: center; }
.text-muted { color: var(--txt-muted); }
.font-mono { font-family: 'SF Mono', 'Monaco', monospace; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
    margin: 1rem auto;
  }
  
  .panel {
    padding: 1.5rem;
  }
  
  .topbar {
    padding: 0 1rem;
    height: 60px;
  }
  
  .nav {
    gap: 0.5rem;
  }
  
  .nav-link {
    padding: 0.5rem;
    font-size: 0.9rem;
  }
  
  .nav-icon {
    font-size: 14px;
  }
  
  .welcome-header h1 {
    font-size: 2rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
  
  .data-grid {
    grid-template-columns: 1fr;
  }
  
  .input-grid,
  .limits-grid,
  .params-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .action-panel {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 250px;
  }
  
  .results-content {
    font-size: 0.8rem;
    padding: 1rem;
  }
  
  .toast-container {
    left: 1rem;
    right: 1rem;
  }
  
  .toast {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .nav {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .nav-link {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
  
  .topbar {
    height: auto;
    padding: 0.5rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .welcome-header h1 {
    font-size: 1.8rem;
  }
  
  .section-header h2 {
    font-size: 1.6rem;
  }
}

/* ===== Estados de Error ===== */
.input-field.error,
.input-select.error,
.input-textarea.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

/* ===== Animaciones Adicionales ===== */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== Scrollbar Personalizada ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--txt-muted);
}

/* ===== Focus Visible ===== */
.btn:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== Modo Oscuro (opcional) ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --txt: #f8fafc;
    --txt-muted: #94a3b8;
    --panel: #1e293b;
    --border: #334155;
  }
  
  .feature-card {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  }
  
  .results-panel {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  }
  
  .input-field,
  .input-select,
  .input-textarea {
    background: var(--panel);
    color: var(--txt);
  }
}

/* ===== Reset y Base ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--txt);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
}

/* ===== Topbar ===== */
.topbar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateY(-1px);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-icon {
  font-size: 16px;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-chip {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.panel:hover {
  box-shadow: var(--shadow-lg);
}

/* ===== Vistas ===== */
.view {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Vista de Inicio ===== */
.welcome-header {
  text-align: center;
  margin-bottom: 3rem;
}

.welcome-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.welcome-subtitle {
  font-size: 1.1rem;
  color: var(--txt-muted);
  max-width: 600px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.feature-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(111, 143, 127, 0.1), transparent);
  transition: left 0.5s;
}

.feature-card:hover::before {
  left: 100%;
}

.feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--txt-muted);
  margin-bottom: 1rem;
}

.feature-tags {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
}

.info-panel {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 2rem;
  border-radius: var(--radius);
  text-align: center;
}

.info-panel h3 {
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.features-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.5rem;
  text-align: left;
}

.features-list li {
  padding: 0.25rem 0;
  font-weight: 500;
}

/* ===== Secciones ===== */
.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--txt-muted);
  font-size: 1rem;
}

/* ===== Formularios ===== */
.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.limits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-weight: 600;
  color: var(--txt);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.input-field,
.input-select,
.input-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
  background: white;
}

.input-field:focus,
.input-select:focus,
.input-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(111, 143, 127, 0.1);
}

.input-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.input-help {
  font-size: 0.8rem;
  color: var(--txt-muted);
  margin-top: 0.25rem;
}

/* ===== Botones ===== */
.action-panel {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.btn {
  background: var(--btn-primary);
  color: white;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  min-width: 160px;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--btn-primary) 0%, #1d4ed8 100%);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--btn-secondary) 0%, #4b5563 100%);
}

.btn-icon {
  font-size: 16px;
}

/* ===== Resultados ===== */
.results-panel {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.results-header {
  background: var(--primary);
  color: white;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.results-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.results-content {
  padding: 1.5rem;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--txt);
  max-height: 400px;
  overflow-y: auto;
}

.results-content.empty {
  color: var(--txt-muted);
  font-style: italic;
  text-align: center;
  font-family: inherit;
}

/* ===== Elementos Especiales ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

.loading-text {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: 90px;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: white;
  color: var(--txt);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--success);
  max-width: 350px;
  transform: translateX(100%);
  animation: slideIn 0.3s ease-out forwards;
}

.toast.error {
  border-left-color: var(--error);
}

.toast.warning {
  border-left-color: var(--warning);
}

@keyframes slideIn {
  to { transform: translateX(0); }
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.9rem;
  color: var(--txt-muted);
}

/* ===== Utilidades ===== */
.text-center { text-align: center; }
.text-muted { color: var(--txt-muted); }
.font-mono { font-family: 'SF Mono', 'Monaco', monospace; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
    margin: 1rem auto;
  }
  
  .panel {
    padding: 1.5rem;
  }
  
  .topbar {
    padding: 0 1rem;
    height: 60px;
  }
  
  .nav {
    gap: 0.5rem;
  }
  
  .nav-link {
    padding: 0.5rem;
    font-size: 0.9rem;
  }
  
  .nav-icon {
    font-size: 14px;
  }
  
  .welcome-header h1 {
    font-size: 2rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
  
  .data-grid {
    grid-template-columns: 1fr;
  }
  
  .input-grid,
  .limits-grid,
  .params-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .action-panel {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 250px;
  }
  
  .results-content {
    font-size: 0.8rem;
    padding: 1rem;
  }
  
  .toast-container {
    left: 1rem;
    right: 1rem;
  }
  
  .toast {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .nav {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .nav-link {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
  
  .topbar {
    height: auto;
    padding: 0.5rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .welcome-header h1 {
    font-size: 1.8rem;
  }
  
  .section-header h2 {
    font-size: 1.6rem;
  }
}

/* ===== Estados de Error ===== */
.input-field.error,
.input-select.error,
.input-textarea.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

/* ===== Animaciones Adicionales ===== */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== Scrollbar Personalizada ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--txt-muted);
}

/* ===== Focus Visible ===== */
.btn:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== Modo Oscuro (opcional) ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --txt: #f8fafc;
    --txt-muted: #94a3b8;
    --panel: #1e293b;
    --border: #334155;
  }
  
  .feature-card {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  }
  
  .results-panel {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  }
  
  .input-field,
  .input-select,
  .input-textarea {
    background: var(--panel);
    color: var(--txt);
  }
}

.footer {
  background-color: #0d1b2a; /* Azul oscuro de tu fondo */
  color: #bcd0c7; /* Verde grisáceo del texto */
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 4rem;
  border-top: 2px solid #2d4159; /* Separador sutil */
  font-family: 'Inter', sans-serif;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.footer-logo img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.footer-logo span {
  font-weight: 600;
  font-size: 1.1rem;
  color: #9fbfa7; /* tono verde claro */
}

.footer-links {
  margin-bottom: 1rem;
}

.footer-links a {
  color: #bcd0c7;
  margin: 0 0.8rem;
  text-decoration: none;
  transition: color 0.3s ease;
  font-size: 0.95rem;
}

.footer-links a:hover {
  color: #91c7b1; /* verde más claro al pasar el ratón */
}

.footer-copy {
  font-size: 0.85rem;
  color: #809a88;
}

.logo-img {
  border-radius: 20px;  /* 🔹 redondea las esquinas (ajusta el valor si quieres más o menos) */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);  /* 🔹 sombra sutil opcional */
  transition: transform 0.3s ease;
}

.logo-img:hover {
  transform: scale(1.03); /* 🔹 leve animación al pasar el cursor */
}
