/* ========================================
   Cap-Stone Hall Portal — Main Stylesheet
   ======================================== */

:root {
  --navy: #0a1628;
  --navy-mid: #112244;
  --gold: #c8922a;
  --gold-light: #e8b84d;
  --gold-pale: #fdf5e4;
  --cream: #faf8f4;
  --white: #ffffff;
  --gray-100: #f0ede8;
  --gray-200: #e0dbd3;
  --gray-500: #8a8070;
  --gray-700: #4a4540;
  --success: #2d7a4f;
  --danger: #8a1a1a;
  --info: #1a5c8a;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(10,22,40,0.08);
  --shadow-md: 0 4px 24px rgba(10,22,40,0.12);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--navy);
  font-size: 14px;
}

/* ===== LOGIN ===== */
.login-body { background: var(--navy); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-bg {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(200,146,42,0.12) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(200,146,42,0.06) 0%, transparent 50%);
}

.login-container {
  position: relative; z-index: 1; width: 100%; max-width: 440px; padding: 1.5rem;
}

.login-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(200,146,42,0.2);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  backdrop-filter: blur(12px);
}

.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-crest {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; box-shadow: 0 0 32px rgba(200,146,42,0.4);
  font-size: 28px; color: var(--navy);
}
.login-brand h1 { font-family: 'Playfair Display', serif; font-size: 1.5rem; color: #fff; }
.login-brand h2 { font-family: 'Playfair Display', serif; font-size: 1rem; color: var(--gold-light); font-weight: 600; }
.login-brand p { font-size: 0.75rem; color: rgba(255,255,255,0.5); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.1em; }

.login-divider { height: 1px; background: linear-gradient(90deg, transparent, rgba(200,146,42,0.4), transparent); margin: 1.25rem 0; }
.login-subtitle { text-align: center; color: rgba(255,255,255,0.7); font-size: 0.88rem; font-weight: 500; margin-bottom: 1.25rem; text-transform: uppercase; letter-spacing: 0.1em; }

.role-tabs { display: flex; gap: 4px; background: rgba(0,0,0,0.3); border-radius: 8px; padding: 3px; margin-bottom: 1.5rem; }
.role-tab {
  flex: 1; padding: 0.5rem 0.25rem; border: none; background: transparent;
  color: rgba(255,255,255,0.5); border-radius: 6px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 0.82rem; font-weight: 500;
  transition: all 0.2s;
}
.role-tab.active { background: var(--gold); color: var(--navy); font-weight: 700; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; color: rgba(255,255,255,0.7); font-size: 0.78rem; font-weight: 600; margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.05em; }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.4); font-size: 14px; }
.form-input {
  width: 100%; padding: 0.7rem 1rem 0.7rem 2.4rem;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(200,146,42,0.25);
  border-radius: 8px; color: #fff; font-family: 'DM Sans', sans-serif; font-size: 0.92rem;
  transition: border-color 0.2s; outline: none;
}
.form-input:focus { border-color: var(--gold); background: rgba(255,255,255,0.12); }
.form-input::placeholder { color: rgba(255,255,255,0.3); }
.toggle-pass { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: rgba(255,255,255,0.4); cursor: pointer; }
.remember-check { display: flex; align-items: center; gap: 0.5rem; color: rgba(255,255,255,0.6); font-size: 0.82rem; margin-bottom: 1rem; cursor: pointer; }
.btn-login {
  width: 100%; padding: 0.8rem; background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border: none; border-radius: 8px; color: var(--navy); font-family: 'DM Sans', sans-serif;
  font-weight: 700; font-size: 0.95rem; cursor: pointer; transition: all 0.15s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(200,146,42,0.4); }
.login-error { margin-top: 0.75rem; color: #ff8080; font-size: 0.82rem; text-align: center; background: rgba(255,0,0,0.1); padding: 0.5rem; border-radius: 6px; }
.login-footer { text-align: center; color: rgba(255,255,255,0.2); font-size: 0.68rem; margin-top: 1.5rem; }

/* ===== PORTAL LAYOUT ===== */
.top-nav {
  background: var(--navy); height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}
.nav-brand { display: flex; align-items: center; gap: 0.75rem; }
.nav-logo { width: 34px; height: 34px; background: linear-gradient(135deg, var(--gold), var(--gold-light)); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--navy); font-size: 16px; }
.brand-name { font-family: 'Playfair Display', serif; color: #fff; font-size: 1rem; font-weight: 600; }
.nav-session-badge { font-size: 0.75rem; color: var(--gold-light); background: rgba(200,146,42,0.12); padding: 0.3rem 0.8rem; border-radius: 20px; border: 1px solid rgba(200,146,42,0.2); }
.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-user { display: flex; align-items: center; gap: 0.5rem; color: rgba(255,255,255,0.75); font-size: 0.85rem; }
.nav-avatar { width: 30px; height: 30px; background: var(--gold); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.72rem; color: var(--navy); }
.btn-logout { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); padding: 0.35rem 0.8rem; border-radius: 6px; cursor: pointer; font-size: 0.82rem; font-family: 'DM Sans', sans-serif; transition: all 0.15s; display: flex; align-items: center; gap: 0.35rem; }
.btn-logout:hover { background: rgba(255,255,255,0.15); color: #fff; }

.portal-layout { display: flex; min-height: calc(100vh - 60px); }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px; background: var(--white); border-right: 1px solid var(--gray-200);
  padding: 1.25rem 0.75rem; flex-shrink: 0;
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
.sidebar-inner {}
.sidebar-section { margin-bottom: 1rem; }
.sidebar-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gray-500); padding: 0 0.5rem; margin-bottom: 0.35rem; }
.sidebar-item {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem;
  border-radius: 8px; color: var(--gray-700); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s; text-decoration: none; position: relative;
}
.sidebar-item:hover { background: var(--gray-100); color: var(--navy); }
.sidebar-item.active { background: var(--gold-pale); color: var(--gold); font-weight: 600; }
.sidebar-badge {
  position: absolute; right: 8px; background: var(--danger); color: #fff;
  font-size: 0.65rem; font-weight: 700; padding: 1px 5px; border-radius: 10px;
}

/* ===== MAIN CONTENT ===== */
.portal-content { flex: 1; padding: 1.75rem; overflow-x: hidden; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-title { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.page-subtitle { color: var(--gray-500); font-size: 0.82rem; margin-top: 0.2rem; }
.page-actions { display: flex; align-items: center; }

/* ===== BUTTONS ===== */
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--navy); border: none; padding: 0.55rem 1.2rem; border-radius: 8px; cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 0.85rem; text-decoration: none; display: inline-flex; align-items: center; transition: all 0.15s; }
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(200,146,42,0.3); color: var(--navy); }
.btn-outline-gold { background: transparent; color: var(--gold); border: 1.5px solid var(--gold); padding: 0.5rem 1.1rem; border-radius: 8px; cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.85rem; text-decoration: none; display: inline-flex; align-items: center; transition: all 0.15s; }
.btn-outline-gold:hover { background: var(--gold-pale); }
.btn-link { color: var(--gold); font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-xs { background: var(--navy); color: #fff; border: none; padding: 0.25rem 0.5rem; border-radius: 5px; cursor: pointer; font-size: 0.75rem; text-decoration: none; display: inline-flex; align-items: center; gap: 0.2rem; transition: background 0.15s; }
.btn-xs:hover { background: var(--gold); color: var(--navy); }
.btn-xs-gold { background: var(--gold); color: var(--navy); }
.btn-xs-warn { background: #b85c1a; }
.btn-sm { font-size: 0.82rem; padding: 0.4rem 0.9rem; }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.1rem 1.25rem; display: flex; gap: 1rem; align-items: center; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-blue::before { background: #1a5c8a; }
.stat-gold::before { background: var(--gold); }
.stat-green::before { background: var(--success); }
.stat-purple::before { background: #6b3a8a; }
.stat-red::before { background: var(--danger); }
.stat-dark::before { background: var(--navy); }
.stat-icon { font-size: 1.5rem; opacity: 0.6; }
.stat-blue .stat-icon { color: #1a5c8a; }
.stat-gold .stat-icon { color: var(--gold); }
.stat-green .stat-icon { color: var(--success); }
.stat-purple .stat-icon { color: #6b3a8a; }
.stat-red .stat-icon { color: var(--danger); }
.stat-dark .stat-icon { color: var(--navy); }
.stat-value { font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: 0.72rem; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.2rem; }

/* ===== CARD PANEL ===== */
.card-panel { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--gray-100); }
.panel-title { font-family: 'Playfair Display', serif; font-size: 0.95rem; font-weight: 700; color: var(--navy); }
.panel-body { padding: 1.25rem; }

/* ===== PERFORMANCE BARS ===== */
.perf-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.perf-label { width: 100px; font-size: 0.8rem; font-weight: 500; color: var(--navy); flex-shrink: 0; }
.perf-track { flex: 1; height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.perf-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.perf-meta { display: flex; flex-direction: column; align-items: flex-end; min-width: 80px; }
.perf-avg { font-size: 0.82rem; font-weight: 700; }
.perf-count { font-size: 0.68rem; color: var(--gray-500); }

/* ===== QUICK ACTIONS ===== */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
.quick-action-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; cursor: pointer; text-decoration: none; color: var(--navy); transition: all 0.15s; box-shadow: var(--shadow); }
.quick-action-card:hover { border-color: var(--gold); background: var(--gold-pale); transform: translateY(-2px); color: var(--navy); }
.quick-action-card i { font-size: 1.5rem; color: var(--gold); }
.quick-action-card span { font-size: 0.8rem; font-weight: 600; text-align: center; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.filter-input { padding: 0.52rem 0.9rem; border: 1px solid var(--gray-200); border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; outline: none; min-width: 200px; flex: 1; transition: border-color 0.2s; }
.filter-input:focus { border-color: var(--gold); }
.filter-select { padding: 0.52rem 0.9rem; border: 1px solid var(--gray-200); border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; outline: none; background: #fff; transition: border-color 0.2s; }
.filter-select:focus { border-color: var(--gold); }

/* ===== DATA TABLE ===== */
.table-panel { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th { background: var(--navy); color: var(--gold-light); padding: 0.7rem 1rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; text-align: left; white-space: nowrap; }
.data-table tbody tr { border-bottom: 1px solid var(--gray-100); transition: background 0.1s; }
.data-table tbody tr:hover { background: #fdf9f4; }
.data-table tbody td { padding: 0.65rem 1rem; font-size: 0.85rem; color: var(--gray-700); }
.table-footer { padding: 0.75rem 1rem; border-top: 1px solid var(--gray-100); }
.panel-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.panel-table th { background: var(--gray-100); padding: 0.5rem 1rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-700); text-align: left; }
.panel-table td { padding: 0.5rem 1rem; border-bottom: 1px solid var(--gray-100); }
.panel-table tr:last-child td { border-bottom: none; }
.actions-cell { display: flex; gap: 4px; align-items: center; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 0.18rem 0.55rem; border-radius: 20px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-blue { background: #e8f0f5; color: var(--info); }
.badge-pink { background: #f5e8ee; color: #8a1a5c; }
.badge-green { background: #e8f5ee; color: var(--success); }
.badge-gold { background: var(--gold-pale); color: var(--gold); }
.badge-red { background: #f5e8e8; color: var(--danger); }
.badge-class { background: var(--navy); color: var(--gold-light); padding: 0.18rem 0.55rem; border-radius: 5px; font-size: 0.72rem; font-weight: 600; }

/* ===== RESULT TABLE ===== */
.result-entry-table .score-input { width: 48px; text-align: center; border: 1px solid var(--gray-200); border-radius: 5px; padding: 0.2rem; font-size: 0.85rem; }
.result-entry-table .score-exam { width: 52px; }

/* Grade badges */
.grade-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.72rem; font-weight: 700; background: var(--gray-100); color: var(--navy); }
.grade-ap { background: #e8f5ee; color: #1a5c8a; }
.grade-a { background: #e8f5ee; color: var(--success); }
.grade-bp { background: #e8f0f5; color: #1a5c8a; }
.grade-c { background: #fef9e7; color: #b87a1a; }
.grade-p { background: #fff3e8; color: var(--warn); }
.grade-f { background: #f5e8e8; color: var(--danger); }

/* ===== STUDENT INFO BAR ===== */
.student-info-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.info-badge { background: #fff; border: 1px solid var(--gray-200); border-radius: 20px; padding: 0.3rem 0.8rem; font-size: 0.8rem; font-weight: 500; color: var(--navy); display: flex; align-items: center; }

/* ===== STUDENT LINK ===== */
.student-link { color: var(--navy); font-weight: 600; text-decoration: none; }
.student-link:hover { color: var(--gold); text-decoration: underline; }

/* ===== GROUP HEADER ROW ===== */
.group-header-row td { background: var(--navy-mid); color: var(--gold-light); font-weight: 700; }
.sub-result-row td:nth-child(2) { padding-left: 1.5rem; font-style: italic; }

/* ===== SUMMARY STAT CARD ===== */
.summary-stat-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem; text-align: center; box-shadow: var(--shadow); }
.ss-value { font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 700; color: var(--navy); }
.ss-label { font-size: 0.72rem; color: var(--gray-500); text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; margin-top: 0.3rem; }

/* ===== BEHAVIOUR ROWS ===== */
.behaviour-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.beh-label { flex: 1; font-size: 0.78rem; color: var(--navy); }
.rating-dots { display: flex; gap: 3px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gray-200); }
.dot.filled { background: var(--gold); }
.beh-score { font-size: 0.72rem; font-weight: 600; color: var(--gray-700); min-width: 28px; text-align: right; }

/* ===== ATTENDANCE ROWS ===== */
.att-row { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid var(--gray-100); font-size: 0.85rem; }
.att-row strong { font-family: 'Playfair Display', serif; font-size: 1.1rem; }

/* ===== RESUMPTION BOX SMALL ===== */
.resumption-box-sm { background: var(--navy); color: #fff; border-radius: 8px; padding: 0.75rem; text-align: center; }
.res-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold-light); }
.res-date { font-family: 'Playfair Display', serif; font-size: 0.9rem; font-weight: 700; margin-top: 0.2rem; }

/* ===== ALERT ===== */
.alert { border-radius: 8px; border: none; font-size: 0.85rem; }
.alert-success { background: #e8f5ee; color: var(--success); }
.alert-danger { background: #f5e8e8; color: var(--danger); }
.alert-warning { background: #fff3e8; color: #b85c1a; }
.alert-info { background: #e8f0f5; color: var(--info); }

/* ===== PAYMENT ===== */
.payment-form { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.5rem; max-width: 480px; }

/* ===== NOTICE ===== */
.notice-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 0.75rem; box-shadow: var(--shadow); }
.notice-title { font-weight: 700; font-size: 0.95rem; color: var(--navy); margin-bottom: 0.35rem; }
.notice-body { font-size: 0.85rem; color: var(--gray-700); line-height: 1.6; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .portal-content { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; }
  .filter-bar { gap: 0.4rem; }
  .filter-input { min-width: 100%; }
}
