
/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #0f2d52;
  --primary-light: #1a4a7c;
  --accent: #38bdf8;
  --accent-dark: #0284c7;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f0f5fb;
  --card-bg: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 2px 12px rgba(15,45,82,0.09);
  --shadow-lg: 0 8px 32px rgba(15,45,82,0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}
html { font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ===== NAVBAR ===== */
.navbar { background: var(--primary); box-shadow: 0 2px 12px rgba(0,0,0,0.2); position: sticky; top: 0; z-index: 100; }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav-brand { color: #fff; font-size: 1.3rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.nav-brand:hover { text-decoration: none; color: var(--accent); }
.nav-brand i { color: var(--accent); font-size: 1.5rem; }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-link { color: rgba(255,255,255,0.85); padding: 0.5rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; gap: 0.4rem; transition: background 0.2s, color 0.2s; }
.nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.nav-admin { color: var(--accent) !important; }
.nav-admin:hover { background: rgba(56,189,248,0.12) !important; }
.nav-logout:hover { background: rgba(239,68,68,0.2) !important; color: #fca5a5 !important; }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; padding: 0.4rem; }

/* ===== MAIN WRAP ===== */
.main-wrap { flex: 1; max-width: 1200px; margin: 0 auto; width: 100%; padding: 2rem 1.5rem; }

/* ===== FLASH MESSAGES ===== */
.flash { padding: 0.9rem 1.2rem; border-radius: var(--radius-sm); margin-bottom: 1.5rem; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.flash-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.flash-error { background: #fee2e2; color: #7f1d1d; border-left: 4px solid var(--danger); }
.flash-info { background: #dbeafe; color: #1e3a8a; border-left: 4px solid #3b82f6; }
.flash-close { cursor: pointer; font-size: 1rem; opacity: 0.6; }
.flash-close:hover { opacity: 1; }

/* ===== LOGIN PAGE ===== */
.login-page { min-height: 100vh; display: flex; background: var(--primary); }
.login-left { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 3rem; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, #1e5fa3 100%); color: #fff; }
.login-left .brand { display: flex; align-items: center; gap: 1rem; margin-bottom: 2.5rem; }
.login-left .brand i { font-size: 3rem; color: var(--accent); }
.login-left .brand-name { font-size: 2.2rem; font-weight: 800; }
.login-tagline { font-size: 1.15rem; color: rgba(255,255,255,0.75); text-align: center; max-width: 340px; line-height: 1.7; }
.login-features { margin-top: 2.5rem; display: flex; flex-direction: column; gap: 1rem; }
.login-feature { display: flex; align-items: center; gap: 0.8rem; color: rgba(255,255,255,0.85); font-size: 0.95rem; }
.login-feature i { color: var(--accent); font-size: 1.1rem; width: 20px; }
.login-right { width: 440px; display: flex; flex-direction: column; justify-content: center; padding: 3rem; background: #fff; }
.login-right h2 { font-size: 1.8rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }
.login-right p.sub { color: var(--muted); margin-bottom: 2rem; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.9rem; color: var(--text); margin-bottom: 0.4rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.7rem 1rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.95rem; font-family: var(--font); color: var(--text); transition: border 0.2s;
  background: #f8fafc;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent-dark); background: #fff; box-shadow: 0 0 0 3px rgba(56,189,248,0.12);
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-group .hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.65rem 1.4rem; border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 600; font-family: var(--font); cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; }
.btn:hover { text-decoration: none; filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent-dark); color: var(--accent-dark); filter: none; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.9rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 0.6rem; }
.page-header p { color: var(--muted); margin-top: 0.4rem; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }

/* ===== SUBJECT CARDS ===== */
.subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.subject-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow 0.2s, transform 0.2s; display: flex; flex-direction: column; }
.subject-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.subject-card-top { height: 8px; }
.subject-card-body { padding: 1.5rem; flex: 1; }
.subject-card-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 1rem; }
.subject-card h3 { font-size: 1.15rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }
.subject-card p { color: var(--muted); font-size: 0.9rem; line-height: 1.6; }
.subject-card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: #f8fafc; }
.resource-count { font-size: 0.82rem; color: var(--muted); font-weight: 500; }

/* Subject colors */
.color-blue { background: #dbeafe; } .color-blue i { color: #2563eb; }
.color-teal { background: #ccfbf1; } .color-teal i { color: #0d9488; }
.color-purple { background: #ede9fe; } .color-purple i { color: #7c3aed; }
.color-orange { background: #ffedd5; } .color-orange i { color: #ea580c; }
.color-pink { background: #fce7f3; } .color-pink i { color: #db2777; }
.color-green { background: #dcfce7; } .color-green i { color: #16a34a; }
.top-blue { background: #2563eb; } .top-teal { background: #0d9488; }
.top-purple { background: #7c3aed; } .top-orange { background: #ea580c; }
.top-pink { background: #db2777; } .top-green { background: #16a34a; }

/* ===== SUBJECT DETAIL ===== */
.subject-detail-header { background: var(--primary); color: #fff; padding: 2.5rem; border-radius: var(--radius); margin-bottom: 2rem; }
.subject-detail-header h1 { font-size: 2rem; font-weight: 800; }
.subject-detail-header p { color: rgba(255,255,255,0.8); margin-top: 0.6rem; font-size: 1rem; }

.resources-list { display: flex; flex-direction: column; gap: 1rem; }
.resource-item { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.5rem; display: flex; align-items: center; gap: 1rem; }
.resource-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.resource-icon.doc { background: #dbeafe; color: #2563eb; }
.resource-icon.link { background: #ccfbf1; color: #0d9488; }
.resource-icon.video { background: #fce7f3; color: #db2777; }
.resource-info { flex: 1; }
.resource-info h4 { font-size: 1rem; font-weight: 600; color: var(--text); }
.resource-info p { font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; }
.resource-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ===== ADMIN PANEL ===== */
.admin-grid { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; align-items: start; }
.admin-sidebar { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 0; }
.admin-sidebar h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); padding: 0 1.5rem; margin-bottom: 0.5rem; }
.admin-nav-link { display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 1.5rem; color: var(--text); font-size: 0.9rem; font-weight: 500; transition: background 0.15s; }
.admin-nav-link:hover, .admin-nav-link.active { background: #eff6ff; color: var(--accent-dark); text-decoration: none; }
.admin-nav-link i { width: 18px; color: var(--muted); }
.admin-nav-link:hover i, .admin-nav-link.active i { color: var(--accent-dark); }
.admin-content { min-width: 0; }

/* ===== STATS CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; display: flex; align-items: center; gap: 1rem; }
.stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-info .num { font-size: 1.6rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-info .label { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }

/* ===== TABLE ===== */
.table-wrap { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: #f1f5f9; text-align: left; padding: 0.85rem 1.2rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-bottom: 1px solid var(--border); }
td { padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; padding: 0.2rem 0.65rem; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-student { background: #dbeafe; color: #1e40af; }
.badge-doc { background: #dbeafe; color: #1e40af; }
.badge-link { background: #d1fae5; color: #065f46; }
.badge-video { background: #fce7f3; color: #831843; }

/* ===== CARD ===== */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.8rem; }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 1.2rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem; }

/* ===== PROFILE ===== */
.profile-header { background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: var(--radius); padding: 2.5rem; display: flex; align-items: center; gap: 2rem; color: #fff; margin-bottom: 2rem; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #fff; flex-shrink: 0; }
.profile-info h2 { font-size: 1.6rem; font-weight: 700; }
.profile-info p { color: rgba(255,255,255,0.75); margin-top: 0.3rem; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state i { font-size: 3rem; opacity: 0.3; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.2rem; font-weight: 600; color: var(--text); margin-bottom: 0.5rem; }

/* ===== DIVIDER ===== */
hr.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ===== FOOTER ===== */
.site-footer { background: var(--primary); color: rgba(255,255,255,0.6); text-align: center; padding: 1.2rem; font-size: 0.85rem; margin-top: auto; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--primary); padding: 1rem; z-index: 99; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .login-left { display: none; }
  .login-right { width: 100%; }
  .admin-grid { grid-template-columns: 1fr; }
  .subjects-grid { grid-template-columns: 1fr; }
  .main-wrap { padding: 1.2rem 1rem; }
  .profile-header { flex-direction: column; text-align: center; }
}
