@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* Variables de Diseño */
:root {
  --bg-base: #090d16;
  --bg-surface: #131b2e;
  --bg-surface-hover: #1c2742;
  --primary: #3b82f6; /* Azul brillante */
  --primary-gradient: linear-gradient(135deg, #2563eb, #8b5cf6);
  --secondary-gradient: linear-gradient(135deg, #d946ef, #3b82f6);
  --accent: #a855f7; /* Púrpura */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-light: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(59, 130, 246, 0.5);
  
  --glass-bg: rgba(19, 27, 46, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --backdrop-blur: blur(12px);
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Scrollbar Personalizado */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-hover);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Clases de Utilidad */
.hidden {
  display: none !important;
}

.text-gradient {
  background: linear-gradient(135deg, #a7f3d0, #3b82f6, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient-purple {
  background: var(--secondary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
  padding: 24px;
  transition: transform var(--transition-normal), border-color var(--transition-fast), box-shadow var(--transition-normal);
}

.glass-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px 0 rgba(139, 92, 246, 0.15);
}

/* Layout Principal */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Barra Lateral (Sidebar) */
.sidebar {
  width: 280px;
  background: rgba(10, 15, 28, 0.95);
  backdrop-filter: var(--backdrop-blur);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-col: column;
  flex-direction: column;
  padding: 30px 20px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform var(--transition-normal);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 0 10px;
}

.brand-logo {
  width: 45px;
  height: 45px;
  object-fit: contain;
  border-radius: 10px;
}

.brand-title {
  font-size: 24px;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: -2px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item button {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
  text-align: left;
}

.nav-item button:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.nav-item.active button {
  background: var(--primary-gradient);
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-profile:hover {
  background: rgba(255, 255, 255, 0.06);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  color: white;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Contenido Principal */
.main-content {
  flex-grow: 1;
  margin-left: 280px;
  padding: 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-normal);
}

/* Header de la Aplicación */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.page-title-section {
  display: flex;
  flex-direction: column;
}

.page-title {
  font-size: 32px;
  font-weight: 800;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

/* Botones Premium */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
}

/* Contenedor de Pestañas (SPA Views) */
.tab-view {
  display: none;
  animation: fadeInUp var(--transition-normal);
}

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

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

/* Vista Inicio (Dashboard) */
.hero-section {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 40px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 600px;
}

.hero-title {
  font-size: 42px;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-description {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Formularios de Entrada Estilo Premium */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-control {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px 16px;
  color: white;
  font-family: inherit;
  font-size: 15px;
  transition: all var(--transition-fast);
  width: 100%;
}

.input-control:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

textarea.input-control {
  resize: vertical;
}

/* Modales */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 100%;
  max-width: 500px;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--glass-shadow);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 24px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: white;
}

/* Estilo del Foro */
.forum-grid {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 32px;
}

.post-card {
  border-bottom: 1px solid var(--border-light);
  padding: 24px 0;
}

.post-card:last-child {
  border-bottom: none;
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.post-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.rating-stars {
  display: flex;
  gap: 4px;
}

.rating-stars svg {
  width: 18px;
  height: 18px;
  fill: #475569;
  cursor: pointer;
  transition: fill var(--transition-fast), transform var(--transition-fast);
}

.rating-stars svg.filled {
  fill: var(--warning);
}

.rating-stars svg:hover {
  transform: scale(1.15);
}

.replies-container {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 2px solid var(--border-light);
  padding-left: 20px;
}

.reply-card {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
}

/* Estilo de Conciliaciones */
.grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 32px;
}

.calculator-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.result-box {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-top: 24px;
}

.result-box.indigo {
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.result-box.error {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.result-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}

.result-item:last-child {
  border-bottom: none;
  font-size: 16px;
  font-weight: 700;
  padding-top: 8px;
}

/* Estilos de Cuentas por Cobrar/Pagar (Tracker) */
.tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.invoice-table-wrapper {
  overflow-x: auto;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.invoice-table th, .invoice-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.invoice-table th {
  font-weight: 600;
  color: var(--text-secondary);
}

.status-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.paid {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.status-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* NIIF Glossario */
.niif-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.niif-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.niif-trigger {
  width: 100%;
  padding: 18px 24px;
  background: transparent;
  border: none;
  color: white;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
}

.niif-content {
  padding: 0 24px 24px 24px;
  color: var(--text-secondary);
  font-size: 14.5px;
  display: none;
}

.niif-item.active {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.niif-item.active .niif-content {
  display: block;
}

/* Footer de la página */
.stylefooter {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding: 30px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Botón de Menú de hamburguesa en Móviles */
.mobile-header {
  display: none;
  background: #0a0f1c;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 45;
  justify-content: space-between;
  align-items: center;
}

.hamburger-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

/* Diseño Responsivo */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 24px;
  }
  .mobile-header {
    display: flex;
  }
  .forum-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .grid-2col {
    grid-template-columns: 1fr;
  }
}
