/* VARIABLES & RESET */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--gray-800); background: var(--gray-100); line-height: 1.5; }
a { text-decoration: none; color: inherit; }

/* AUTH PAGE */
.auth-page { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-container { width: 100%; max-width: 420px; }
.auth-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 2rem; }
.logo-area { text-align: center; margin-bottom: 1.5rem; }
.logo-icon { font-size: 3rem; display: block; margin-bottom: .5rem; }
.logo-icon.small { font-size: 1.4rem; }
.logo-area h1 { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); }
.logo-area p { color: var(--gray-400); font-size: .9rem; }
.auth-tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 1.5rem; }
.tab-btn { flex: 1; padding: .6rem; border: none; background: none; cursor: pointer; font-size: .95rem; color: var(--gray-600); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--gray-700); margin-bottom: .35rem; }
.form-group input, .form-group select, .select-input { width: 100%; padding: .55rem .75rem; border: 1.5px solid var(--gray-300); border-radius: var(--radius); font-size: .95rem; color: var(--gray-800); background: #fff; transition: border-color .2s; outline: none; }
.form-group input:focus, .form-group select:focus, .select-input:focus { border-color: var(--primary); }
.form-group small { display: block; font-size: .78rem; color: var(--gray-400); margin-top: .25rem; }
.search-input { padding: .5rem .75rem; border: 1.5px solid var(--gray-300); border-radius: var(--radius); font-size: .9rem; outline: none; min-width: 220px; }
.search-input:focus { border-color: var(--primary); }

/* BUTTONS */
.btn-primary, .btn-secondary, .btn-danger, .btn-success, .btn-logout { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem; border: none; border-radius: var(--radius); font-size: .9rem; font-weight: 600; cursor: pointer; transition: all .18s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-light); color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-logout { background: none; color: var(--gray-400); font-size: .85rem; width: 100%; }
.btn-logout:hover { color: var(--danger); }
.btn-block { width: 100%; display: flex; }
.btn-sm { padding: .35rem .8rem; font-size: .82rem; }
.btn-disabled { opacity: .6; cursor: not-allowed; }

/* MESSAGES */
.error-msg { background: var(--danger-light); color: var(--danger); border-radius: var(--radius); padding: .6rem .9rem; font-size: .88rem; margin-bottom: .75rem; }
.success-msg { background: var(--success-light); color: var(--success); border-radius: var(--radius); padding: .6rem .9rem; font-size: .88rem; margin-bottom: .75rem; }

/* APP LAYOUT */
.app-page { background: var(--gray-100); }
.sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh; background: var(--gray-900); color: #fff; display: flex; flex-direction: column; z-index: 1000; transform: translateX(-100%); transition: transform .28s ease; overflow-y: auto; }
.sidebar.open, .sidebar.admin-sidebar.open { transform: translateX(0); }
@media (min-width: 900px) {
  .sidebar { transform: translateX(0); }
  .main-wrapper { margin-left: var(--sidebar-w); }
}
.sidebar-header { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.1); min-height: var(--topbar-h); }
.sidebar-title { font-weight: 700; font-size: 1rem; flex: 1; }
.sidebar-close { background: none; border: none; color: var(--gray-400); font-size: 1rem; cursor: pointer; display: none; padding: .2rem; }
@media (max-width: 899px) { .sidebar-close { display: block; } }
.sidebar-nav { flex: 1; padding: .75rem 0; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .65rem 1.2rem; font-size: .9rem; color: var(--gray-400); transition: all .15s; border-left: 3px solid transparent; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: rgba(37,99,235,.25); border-left-color: var(--primary); }
.nav-icon { font-size: 1rem; }
.nav-section-title { padding: .75rem 1.2rem .3rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400); }
.nav-divider { border-top: 1px solid rgba(255,255,255,.08); margin: .5rem 0; }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.1); }
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; }
.overlay.visible { display: block; }
@media (min-width: 900px) { .overlay { display: none !important; } }
.main-wrapper { min-height: 100vh; }
.topbar { position: sticky; top: 0; height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem; z-index: 100; box-shadow: var(--shadow); }
.menu-btn { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--gray-600); padding: .2rem .4rem; }
@media (min-width: 900px) { .menu-btn { display: none; } }
.topbar-title { font-weight: 700; font-size: 1.05rem; flex: 1; color: var(--gray-800); }
.user-info { display: flex; align-items: center; gap: .6rem; font-size: .88rem; color: var(--gray-600); }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; }
.admin-topbar { background: var(--gray-900); border-bottom-color: var(--gray-800); }
.admin-topbar .topbar-title { color: #fff; }
.admin-topbar .menu-btn { color: var(--gray-400); }
.admin-badge { background: var(--warning); color: #fff; padding: .2rem .6rem; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.admin-sidebar .nav-item { font-size: .88rem; }
.main-content { padding: 1.5rem; max-width: 1100px; }

/* DASHBOARD */
.welcome-banner { background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%); border-radius: 12px; padding: 1.5rem; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; box-shadow: var(--shadow-md); }
.welcome-text h3 { font-size: 1.25rem; font-weight: 700; }
.welcome-text p { opacity: .85; font-size: .9rem; margin-top: .2rem; }
.welcome-stats { display: flex; gap: .75rem; }
.stat-card { background: rgba(255,255,255,.15); border-radius: var(--radius); padding: .75rem 1.1rem; text-align: center; min-width: 70px; backdrop-filter: blur(4px); }
.stat-number { font-size: 1.6rem; font-weight: 800; }
.stat-label { font-size: .72rem; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.section-card { background: #fff; border-radius: 12px; padding: 1.25rem 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.section-title { font-size: 1rem; font-weight: 700; color: var(--gray-800); margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--gray-100); }
.progress-bar-container { background: var(--gray-200); border-radius: 99px; height: 10px; overflow: hidden; margin-bottom: .5rem; }
.progress-bar-container.small { height: 7px; }
.progress-bar-container.mini { height: 5px; margin-bottom: .25rem; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), #60a5fa); border-radius: 99px; transition: width .6s ease; }
.progress-text { font-size: .85rem; color: var(--gray-600); }
.semesters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.semester-card { display: block; border: 2px solid var(--gray-200); border-radius: 12px; padding: 1rem; transition: all .2s; background: #fff; }
.semester-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.semester-card.sem-complete { border-color: var(--success); background: var(--success-light); }
.semester-card.sem-partial { border-color: var(--warning); }
.sem-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.sem-number { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; }
.sem-complete .sem-number { background: var(--success-light); color: var(--success); }
.sem-status-badge { font-size: .72rem; color: var(--gray-400); }
.sem-complete .sem-status-badge { color: var(--success); font-weight: 600; }
.sem-card-title { font-weight: 700; font-size: .95rem; color: var(--gray-800); margin-bottom: .2rem; }
.sem-card-desc { font-size: .8rem; color: var(--gray-600); margin-bottom: .6rem; }
.sem-subjects-count { font-size: .8rem; color: var(--gray-400); margin-bottom: .4rem; }

/* BREADCRUMB */
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--gray-400); margin-bottom: 1rem; }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }

/* SEMESTER PAGE */
.semester-header { background: #fff; border-radius: 12px; padding: 1.25rem 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.semester-header h3 { font-size: 1.3rem; font-weight: 700; color: var(--gray-900); }
.semester-header p { color: var(--gray-600); font-size: .9rem; margin-top: .25rem; }
.semester-progress-info { margin-top: .75rem; }
.subjects-list { display: flex; flex-direction: column; gap: .75rem; }
.subject-card { background: #fff; border-radius: 12px; padding: 1rem 1.25rem; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-left: 4px solid var(--gray-200); transition: all .2s; }
.subject-card:hover { box-shadow: var(--shadow-md); }
.subject-card.subject-complete { border-left-color: var(--success); }
.subject-card-left { display: flex; align-items: center; gap: 1rem; flex: 1; }
.subject-number { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.subject-card.subject-complete .subject-number { background: var(--success-light); color: var(--success); }
.subject-card-title { font-weight: 700; font-size: .95rem; color: var(--gray-800); margin-bottom: .15rem; }
.subject-card-desc { font-size: .8rem; color: var(--gray-500); }
.subject-resources { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.resource-tag { background: var(--primary-light); color: var(--primary); border-radius: 20px; padding: .15rem .55rem; font-size: .72rem; font-weight: 600; }
.resource-tag.empty { background: var(--gray-100); color: var(--gray-400); }
.resource-tag.form-done { background: var(--success-light); color: var(--success); }
.subject-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; flex-shrink: 0; }
.badge-complete { background: var(--success-light); color: var(--success); border-radius: 20px; padding: .2rem .65rem; font-size: .78rem; font-weight: 700; }
.badge-pending { background: var(--warning-light); color: var(--warning); border-radius: 20px; padding: .2rem .65rem; font-size: .78rem; font-weight: 700; }

/* SUBJECT PAGE */
.subject-header { background: #fff; border-radius: 12px; padding: 1.25rem 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.subject-header h3 { font-size: 1.25rem; font-weight: 700; }
.subject-header p { color: var(--gray-600); margin-top: .3rem; }
.badge-completed { display: inline-flex; align-items: center; gap: .4rem; margin-top: .75rem; background: var(--success-light); color: var(--success); border-radius: 20px; padding: .3rem 1rem; font-size: .88rem; font-weight: 700; }
.content-section { margin-bottom: 1.25rem; }
.section-heading { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.section-heading h4 { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.section-icon { font-size: 1.2rem; }
.video-card { border: 1.5px solid var(--gray-200); border-radius: 12px; overflow: hidden; background: var(--gray-900); }
.video-thumb-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.video-thumb { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .85; }
.video-play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.video-play-btn { width: 68px; height: 68px; background: rgba(255,255,255,.18); border: 3px solid rgba(255,255,255,.7); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; backdrop-filter: blur(2px); }
.video-card-body { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; background: #fff; }
.video-card-label { font-weight: 700; color: var(--gray-700); font-size: .95rem; }
.btn-video-open { font-size: 1rem; padding: .65rem 1.5rem; }
.video-card-note { font-size: .78rem; color: var(--gray-400); }
.pdf-item { display: flex; align-items: center; gap: 1rem; border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: .9rem 1rem; }
.pdf-icon { font-size: 2rem; }
.pdf-info { flex: 1; }
.pdf-name { font-weight: 600; display: block; }
.pdf-sub { font-size: .8rem; color: var(--gray-400); }
.form-status-info { border-radius: var(--radius); padding: .6rem .9rem; font-size: .9rem; margin-bottom: .75rem; }
.form-submitted { background: var(--success-light); color: var(--success); font-weight: 600; }
.complete-card { text-align: center; border: 2px dashed var(--primary-light); background: var(--gray-50); }
.complete-card p { color: var(--gray-600); margin-bottom: .75rem; }

/* ADMIN PAGE */
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; }
.admin-toolbar h3 { font-size: 1.1rem; font-weight: 700; }
.toolbar-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.admin-semester-block { background: #fff; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 1.25rem; overflow: hidden; }
.admin-sem-header { display: flex; align-items: center; justify-content: space-between; background: var(--gray-800); color: #fff; padding: .85rem 1.25rem; }
.admin-sem-header h4 { font-size: 1rem; font-weight: 700; }
.admin-subjects { padding: .5rem; }
.admin-subject-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-radius: var(--radius); transition: background .15s; }
.admin-subject-row:hover { background: var(--gray-50); }
.admin-subject-info { flex: 1; }
.admin-subject-info strong { font-size: .95rem; display: block; margin-bottom: .3rem; }
.admin-subject-tags { display: flex; gap: .35rem; }
.admin-subject-actions { display: flex; gap: .5rem; }
.structure-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.structure-panels .section-card h4 { font-weight: 700; margin-bottom: 1rem; color: var(--gray-800); }
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { background: var(--gray-800); color: #fff; padding: .75rem 1rem; text-align: left; font-weight: 600; }
.data-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.data-table tr:hover td { background: var(--gray-50); }

/* MODAL */
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modal-content { position: relative; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; z-index: 1; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--gray-200); }
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--gray-400); padding: .2rem .4rem; }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 1rem 0; }

/* DISCIPULADO */
.disc-banner { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); border-radius: 12px; padding: 1.5rem; color: #fff; margin-bottom: 1.5rem; box-shadow: var(--shadow-md); }
.disc-banner h3 { font-size: 1.25rem; font-weight: 700; }
.disc-banner p { opacity: .85; font-size: .9rem; margin-top: .3rem; }
.disc-modules-grid { display: flex; flex-direction: column; gap: .75rem; }
.disc-module-card { background: #fff; border-radius: 12px; padding: 1rem 1.25rem; box-shadow: var(--shadow); border-left: 4px solid #7c3aed; }
.disc-module-title { font-weight: 700; font-size: 1rem; color: var(--gray-800); margin-bottom: .75rem; }
.disc-topics-list { display: flex; flex-direction: column; gap: .5rem; }
.disc-topic-item { display: flex; align-items: center; justify-content: space-between; padding: .6rem .9rem; background: var(--gray-50); border-radius: var(--radius); }
.disc-topic-item:hover { background: #ede9fe; }
.disc-topic-name { font-size: .9rem; font-weight: 600; color: var(--gray-800); }
.disc-pin-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 2rem; max-width: 400px; width: 100%; margin: auto; }
.disc-pin-card h2 { font-size: 1.3rem; font-weight: 700; color: var(--gray-900); margin-bottom: .3rem; }
.disc-pin-card p { color: var(--gray-600); font-size: .9rem; margin-bottom: 1.5rem; }

/* UTILITIES */
.no-content { text-align: center; color: var(--gray-400); padding: 2rem; font-size: .9rem; }

/* RESPONSIVE */
@media (max-width: 600px) {
  .welcome-banner { flex-direction: column; }
  .welcome-stats { width: 100%; justify-content: space-between; }
  .subject-card { flex-direction: column; align-items: flex-start; }
  .subject-card-right { flex-direction: row; width: 100%; justify-content: space-between; }
  .semesters-grid { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 1rem; }
  .admin-subject-row { flex-direction: column; align-items: flex-start; }
  .topbar-title { font-size: .9rem; }
}
@media (max-width: 380px) { .semesters-grid { grid-template-columns: 1fr; } }
