/* ============================================================
   APA 2026 — Stylesheet
   Modern Design with Glassmorphism & Animations
   ============================================================ */

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

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

:root {
  /* Paleta: Azul Petroleo Elegante + Blanco */
  --primary: #1A5F7A;
  --primary-light: #2E8B9A;
  --primary-dark: #0D3D4D;
  --primary-bg: #E8F4F8;

  /* Estados - tonos derivados del azul petroleo */
  --success: #2D8B75;
  --success-bg: #E6F5F1;
  --warning: #C4841D;
  --warning-bg: #FDF6E9;
  --danger: #C44536;
  --danger-bg: #FBEAE8;
  --info: #1A5F7A;
  --info-bg: #E8F4F8;

  /* Neutros */
  --bg: #F8FAFB;
  --surface: #FFFFFF;
  --border: #E2E8ED;
  --text: #0D3D4D;
  --text-muted: #5A7A8A;

  /* Layout */
  --sidebar-w: 260px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(13,61,77,.06), 0 1px 2px rgba(13,61,77,.04);
  --shadow-md: 0 4px 6px -1px rgba(13,61,77,.08), 0 2px 4px -1px rgba(13,61,77,.04);
  --shadow-lg: 0 10px 15px -3px rgba(13,61,77,.08), 0 4px 6px -2px rgba(13,61,77,.03);
  --shadow-xl: 0 25px 50px -12px rgba(13,61,77,.15);
}

body {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

/* ---- Utilities ---- */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ============================================================
   AUTH - Modern Glassmorphism Design
   ============================================================ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0D3D4D 0%, #1A5F7A 50%, #2E8B9A 100%);
  position: relative;
  overflow: hidden;
}

/* Animated Background Shapes */
.auth-screen::before,
.auth-screen::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  animation: float 8s ease-in-out infinite;
}

.auth-screen::before {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #2E8B9A, #1A5F7A);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.auth-screen::after {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #0D3D4D, #1A5F7A);
  bottom: -50px;
  left: -50px;
  animation-delay: -4s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(20px, -20px) rotate(5deg); }
  50% { transform: translate(-10px, 20px) rotate(-5deg); }
  75% { transform: translate(15px, 10px) rotate(3deg); }
}

/* Floating particles */
.auth-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  animation: particle-float 15s linear infinite;
}

.auth-particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.auth-particle:nth-child(2) { left: 25%; animation-delay: -3s; }
.auth-particle:nth-child(3) { left: 40%; animation-delay: -6s; }
.auth-particle:nth-child(4) { left: 55%; animation-delay: -9s; }
.auth-particle:nth-child(5) { left: 70%; animation-delay: -12s; }
.auth-particle:nth-child(6) { left: 85%; animation-delay: -2s; }

@keyframes particle-float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-100vh) scale(1); opacity: 0; }
}

.auth-brand {
  text-align: center;
  color: white;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
  animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-logo {
  margin-bottom: 12px;
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.auth-brand h1 {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.5px;
  font-family: 'Montserrat', sans-serif;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.auth-brand p {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  margin-top: 4px;
  font-weight: 300;
}

/* Glassmorphism Card */
.auth-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 480px;
  box-shadow:
    0 25px 50px -12px rgba(0,0,0,0.25),
    0 0 0 1px rgba(255,255,255,0.1),
    inset 0 1px 0 rgba(255,255,255,0.5);
  display: none;
  position: relative;
  z-index: 1;
  animation: cardAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
}

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

.auth-card.active {
  display: block;
}

.auth-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--primary-dark);
  text-align: center;
}

/* Modern Input Styling */
.auth-card .form-group {
  margin-bottom: 20px;
  position: relative;
}

.auth-card .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
}

.auth-card .form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  outline: none;
  transition: all 0.3s ease;
  background: white;
}

.auth-card .form-group input:hover {
  border-color: var(--primary-light);
}

.auth-card .form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26,95,122,0.15);
}

.auth-card .form-group input:focus + .input-highlight {
  width: 100%;
}

.input-highlight {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.3s ease, left 0.3s ease;
  transform: translateX(-50%);
  border-radius: 1px;
}

/* Form Validation States */
.form-group.error input {
  border-color: var(--danger);
  animation: shake 0.4s ease;
}

.form-group.error label {
  color: var(--danger);
}

.form-group.success input {
  border-color: var(--success);
}

.form-group.success label {
  color: var(--success);
}

.validation-message {
  font-size: 11px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(-5px);
  transition: all 0.3s ease;
}

.form-group.error .validation-message,
.form-group.success .validation-message {
  opacity: 1;
  transform: translateY(0);
}

.form-group.error .validation-message {
  color: var(--danger);
}

.form-group.success .validation-message {
  color: var(--success);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

/* Modern Button with Shimmer Effect */
.auth-card .btn-primary {
  position: relative;
  overflow: hidden;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(26,95,122,0.3);
}

.auth-card .btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.auth-card .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(26,95,122,0.4);
}

.auth-card .btn-primary:hover::before {
  left: 100%;
}

.auth-card .btn-primary:active {
  transform: translateY(0);
}

/* Loading State */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading .btn-text {
  opacity: 0;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.auth-switch {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  position: relative;
  transition: color 0.3s ease;
}

.auth-switch a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.auth-switch a:hover::after {
  width: 100%;
}

.auth-hint {
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 300;
  padding: 10px;
  background: var(--primary-bg);
  border-radius: 8px;
}

/* Password toggle modern */
.input-password { position: relative; }
.input-password input { padding-right: 48px; }
.toggle-pw {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  transition: color 0.3s ease;
  padding: 4px;
}
.toggle-pw:hover { color: var(--primary); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: #0D3D4D;
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 18px;
  font-family: 'Montserrat', sans-serif;
}
.sidebar-close { display: none; background: none; border: none; color: white; cursor: pointer; font-size: 18px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.user-avatar {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 600; }
.user-role  { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: capitalize; font-weight: 300; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 12px 20px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  text-decoration: none;
  color: rgba(255,255,255,0.65);
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  font-size: 13.5px;
  font-weight: 400;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active { background: rgba(26,95,122,0.5); color: white; border-right: 3px solid var(--primary-light); }
.nav-icon { width: 20px; text-align: center; font-size: 14px; }

.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }

/* ---- Overlay ---- */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ---- Main ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.menu-btn { display: none; background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text); }
.topbar-title { font-size: 16px; font-weight: 700; flex: 1; color: var(--primary-dark); }
.topbar-actions { display: flex; gap: 8px; }

.page-content { flex: 1; padding: 24px; }

/* ---- Pages ---- */
.page { display: none; }
.page.active { display: block; }

.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 900; color: var(--primary-dark); }
.page-header p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 300; }

/* ============================================================
   CARDS & STATS
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--primary-dark); }
.card-body { padding: 20px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-bg);
}
.stat-num  { font-size: 28px; font-weight: 900; }
.stat-label{ font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 300; }

.stat-card.primary .stat-num,
.stat-card.purple .stat-num { color: var(--primary); }
.stat-card.primary .stat-icon { background: var(--primary-bg); color: var(--primary); }

.stat-card.blue .stat-num { color: var(--primary); }
.stat-card.blue .stat-icon { background: var(--primary-bg); color: var(--primary); }

.stat-card.green .stat-num { color: var(--success); }
.stat-card.green .stat-icon { background: var(--success-bg); color: var(--success); }

.stat-card.orange .stat-num { color: var(--warning); }
.stat-card.orange .stat-icon { background: var(--warning-bg); color: var(--warning); }

.stat-card.red .stat-num { color: var(--danger); }
.stat-card.red .stat-icon { background: var(--danger-bg); color: var(--danger); }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Activity list */
.activity-list { display: flex; flex-direction: column; gap: 12px; }
.activity-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; padding-bottom: 0; }
.activity-badge {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.activity-info { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 300; }

/* Lineas barras */
.linea-item { margin-bottom: 12px; }
.linea-name  { font-size: 12px; font-weight: 500; margin-bottom: 4px; }
.linea-bar   { background: var(--bg); border-radius: 4px; height: 8px; overflow: hidden; }
.linea-fill  { background: var(--primary); height: 100%; border-radius: 4px; transition: width 0.4s; }
.linea-count { font-size: 11px; color: var(--text-muted); font-weight: 300; }

/* ============================================================
   CHARTS CONTAINER
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
}

.chart-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-card h4 i {
  color: var(--primary);
}

.chart-container {
  position: relative;
  height: 250px;
}

/* ============================================================
   TABLE
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-input, .filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.15s;
  background: white;
  font-family: 'Montserrat', sans-serif;
}
.filter-input { flex: 1; min-width: 200px; }
.filter-input:focus, .filter-select:focus { border-color: var(--primary); }

.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-weight: 300;
}
.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: none; }
.loading-row { text-align: center; color: var(--text-muted); padding: 32px !important; }

.cell-title { font-weight: 500; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-link  { color: var(--primary); text-decoration: none; font-size: 12px; font-weight: 400; }
.cell-link:hover { text-decoration: underline; }

/* ============================================================
   BADGES / ESTADOS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-gray    { background: #F3F4F6; color: #5A7A8A; }
.badge-yellow  { background: var(--warning-bg); color: #92400E; }
.badge-blue    { background: var(--info-bg); color: var(--primary-dark); }
.badge-green   { background: var(--success-bg); color: #1B6B5A; }
.badge-purple  { background: var(--primary-bg); color: var(--primary-dark); }
.badge-red     { background: var(--danger-bg); color: #991B1B; }
.badge-orange  { background: var(--warning-bg); color: #9A3412; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost   { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger  { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #248567; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 6px; }
.btn-full { width: 100%; }

.action-btns { display: flex; gap: 6px; }

/* Export Button */
.btn-export {
  background: var(--success);
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-export:hover {
  background: #248567;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,95,122,0.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* Validation states for all forms */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
  border-color: var(--danger);
}

.form-group.has-error label {
  color: var(--danger);
}

.form-group.has-success input,
.form-group.has-success select {
  border-color: var(--success);
}

.form-error-text {
  color: var(--danger);
  font-size: 11px;
  margin-top: 4px;
  display: none;
}

.form-group.has-error .form-error-text {
  display: block;
}

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 16px;
}
.alert-error   { background: var(--danger-bg);  color: #991B1B; }
.alert-success { background: var(--success-bg); color: #1B6B5A; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(13,61,77,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.visible .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--primary-dark); }
.modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-muted); }
.modal-body   { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary-dark);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transform: translateY(0);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ============================================================
   REPORTS PANEL
   ============================================================ */
.reports-panel {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.report-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.report-btn:hover {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

.report-btn i {
  font-size: 16px;
}

/* ============================================================
   KANBAN BOARD
   ============================================================ */

/* Filters bar */
.kanban-filters {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: white;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.kanban-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.kanban-filter-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-filter-group select,
.kanban-filter-group input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  outline: none;
  background: white;
  transition: border-color 0.15s;
}

.kanban-filter-group select:focus,
.kanban-filter-group input:focus {
  border-color: var(--primary);
}

/* Board container */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 20px;
  align-items: flex-start;
  min-height: 500px;
}

.kanban-board::-webkit-scrollbar {
  height: 6px;
}
.kanban-board::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: 3px;
}
.kanban-board::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 3px;
}

/* Loading state */
.kanban-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 60px;
}

/* Column */
.kanban-col {
  flex: 0 0 275px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}

.kanban-col.drag-over {
  border-color: var(--primary);
  background: rgba(26,95,122,0.04);
  box-shadow: 0 0 0 2px rgba(26,95,122,0.2);
}

/* Column header */
.kanban-col-header {
  padding: 14px 16px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid transparent;
}

.kanban-col-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.kanban-col-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.kanban-col-count {
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Color themes per column */
.kanban-col[data-col="sin-comenzar"] .kanban-col-dot { background: #9CA3AF; }
.kanban-col[data-col="sin-comenzar"] { border-top: 3px solid #9CA3AF; }

.kanban-col[data-col="planificado"] .kanban-col-dot { background: #60A5FA; }
.kanban-col[data-col="planificado"] { border-top: 3px solid #60A5FA; }

.kanban-col[data-col="en-curso"] .kanban-col-dot { background: var(--warning); }
.kanban-col[data-col="en-curso"] { border-top: 3px solid var(--warning); }

.kanban-col[data-col="en-revision"] .kanban-col-dot { background: #F97316; }
.kanban-col[data-col="en-revision"] { border-top: 3px solid #F97316; }

.kanban-col[data-col="completado"] .kanban-col-dot { background: var(--success); }
.kanban-col[data-col="completado"] { border-top: 3px solid var(--success); }

.kanban-col[data-col="finalizado"] .kanban-col-dot { background: var(--primary); }
.kanban-col[data-col="finalizado"] { border-top: 3px solid var(--primary); }

/* Cards container (drop zone) */
.kanban-cards {
  padding: 10px;
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Empty state */
.kanban-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--border);
  padding: 20px 0;
  font-size: 12px;
  text-align: center;
}

.kanban-empty i {
  font-size: 24px;
  opacity: 0.4;
}

/* Card */
.kanban-card {
  background: white;
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.35;
  transform: rotate(2deg) scale(0.97);
}

/* Colored left border by type */
.kanban-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 10px 0 0 10px;
}

.kanban-card[data-type="articulo"]::before { background: var(--primary); }
.kanban-card[data-type="libro"]::before    { background: var(--success); }
.kanban-card[data-type="webinar"]::before  { background: var(--warning); }
.kanban-card[data-type="taller"]::before   { background: var(--danger); }

/* Card header */
.kanban-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.kanban-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.type-articulo { background: var(--primary-bg);  color: var(--primary-dark); }
.type-libro    { background: var(--success-bg);  color: #1B6B5A; }
.type-webinar  { background: var(--warning-bg);  color: #92400E; }
.type-taller   { background: var(--danger-bg);   color: #991B1B; }

.kanban-card-edit {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  opacity: 0;
  transition: opacity 0.2s;
}

.kanban-card:hover .kanban-card-edit {
  opacity: 1;
}

.kanban-card-edit:hover {
  color: var(--primary);
  background: var(--primary-bg);
}

/* Card title */
.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card meta */
.kanban-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kanban-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 300;
}

.kanban-meta-row i {
  width: 12px;
  text-align: center;
  color: var(--primary-light);
  flex-shrink: 0;
}

.kanban-meta-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Drag ghost placeholder */
.kanban-drag-placeholder {
  background: rgba(26,95,122,0.08);
  border: 2px dashed rgba(26,95,122,0.3);
  border-radius: 10px;
  height: 80px;
  pointer-events: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close { display: block; }
  .sidebar-overlay.open { display: block; }

  .main-content { margin-left: 0; }
  .menu-btn { display: block; }

  .dash-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }

  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }

  .table { font-size: 12px; }
  .table th, .table td { padding: 8px 10px; }

  .auth-card {
    padding: 28px 24px;
    border-radius: 20px;
  }

  .auth-brand h1 {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-input { min-width: unset; }
  .reports-panel { flex-direction: column; }
}
