/* ==========================================================================
   JMB e-Learning - Master Stylesheet
   ========================================================================== */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Merriweather:ital,wght@0,400;0,700;1,400&display=swap');

/* --- Brand Variables --- */
:root {
  --primary-navy: #1A237E;
  --primary-gold: #FBC02D;
  --secondary-green: #2E7D32;
  --danger-red: #C62828;
  
  --text-dark: #2C3E50;
  --text-light: #6B7280;
  --text-muted: #9CA3AF;
  --border-color: #E5E7EB;
}

/* --- Global Reset --- */
* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;   /* fallback for older browsers */
  overflow-x: clip;     /* modern: clips without creating a scroll container */
}

body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;   /* correct height on mobile (dynamic toolbars) */
  color: var(--text-dark);
}

/* ==========================================================================
   LOGIN PAGE STYLES
   ========================================================================== */

body.login-page {
  position: relative;
  /* Background with gradient overlay using the local image */
  background-image: 
    linear-gradient(135deg, rgba(15, 26, 63, 0.9) 0%, rgba(27, 42, 94, 0.85) 100%),
    url('../assets/login_bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* Soft gold glow (top-right) */
body.login-page::before {
  content: '';
  position: fixed;      /* fixed => never creates scrollbars */
  top: -150px;
  right: -150px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(251, 192, 45, 0.15) 0%, rgba(251, 192, 45, 0) 70%);
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
}

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
}

.login-container-wide {
  display: flex;
  max-width: 1160px;
  width: 100%;
  gap: 40px;
  align-items: center;
}

/* Left Side: School Identity */
.school-identity {
  flex: 5;
  color: white;
}

.portal-tag {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(251, 192, 45, 0.15);
  border: 1px solid rgba(251, 192, 45, 0.5);
  border-radius: 20px;
  color: var(--primary-gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.school-title {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.8px;
  margin: 0;
}

.gold-divider {
  width: 64px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-gold) 0%, rgba(251, 192, 45, 0.3) 100%);
  border-radius: 2px;
  margin: 18px 0;
}

.school-motto {
  color: var(--primary-gold);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 1.4px;
  line-height: 1.4;
  margin-bottom: 30px;
}

.verse-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
}

.verse-line {
  width: 3px;
  background: var(--primary-gold);
  border-radius: 2px;
  flex-shrink: 0;
}

.verse-text small {
  display: block;
  color: rgba(251, 192, 45, 0.95);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  margin-bottom: 6px;
}

.verse-text p {
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  line-height: 1.5;
  font-style: italic;
  margin: 0;
  font-family: 'Merriweather', serif;
}

/* Right Side: Login Card (Glassmorphism) */
.login-card {
  flex: 4;
  max-width: 440px;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 40px 36px 32px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

/* Logo in gold ring */
.logo-ring {
  width: 98px;
  height: 98px;
  margin: 0 auto 22px;
  background: linear-gradient(135deg, var(--primary-gold), rgba(251, 192, 45, 0.55));
  border-radius: 50%;
  padding: 5px;
  box-shadow: 0 6px 20px rgba(251, 192, 45, 0.3);
}

.logo-inner {
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 50%;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-inner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.welcome-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-navy);
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.welcome-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 13.5px;
  margin-bottom: 28px;
}

/* Form Controls */
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-control {
  border: 1px solid #D1D5DB;
  border-radius: 12px;
  padding: 12px 15px;
  font-size: 15px;
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--primary-navy);
  box-shadow: 0 0 0 4px rgba(26, 35, 126, 0.1);
}

.input-group-text {
  background-color: transparent;
  border-right: none;
  color: var(--text-light);
}

.input-group .form-control {
  border-left: none;
}

.btn-signin {
  background-color: var(--primary-navy);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15.5px;
  font-weight: 600;
  width: 100%;
  transition: background 0.2s;
}

.btn-signin:hover {
  background-color: #121858;
  color: white;
}

.forgot-text {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-light);
  margin-top: 16px;
}

/* ==========================================================================
   DASHBOARD LAYOUT
   ========================================================================== */

body.dashboard-page {
  background-color: #F8F9FA;
}

.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Mobile Top Bar (Hidden on Desktop) */
.mobile-topbar {
  display: none;
  background-color: var(--primary-navy);
  color: white;
  padding: 12px 20px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 999;
}

.btn-menu-toggle {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  padding: 0;
  cursor: pointer;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--primary-navy);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  height: 100dvh;
  left: 0;
  top: 0;
  z-index: 1000;
  transition: transform 0.3s ease-in-out;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  padding: 2px;
}

.sidebar-brand {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-brand small {
  display: block;
  font-size: 11px;
  color: var(--primary-gold);
  font-weight: 400;
  letter-spacing: 1px;
}

.sidebar-menu {
  padding: 20px 12px;
  flex: 1;
  overflow-y: auto;
}

.menu-label {
  font-size: 11px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
  letter-spacing: 1px;
  margin: 15px 0 8px 12px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.menu-item:hover, .menu-item.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.menu-item i {
  font-size: 18px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: 0.2s;
}

.btn-logout:hover {
  background: rgba(198, 40, 40, 0.2);
  border-color: var(--danger-red);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px; /* Same as sidebar width */
  padding: 24px;
  width: 100%;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-navy);
  margin: 0;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  font-weight: 600;
  font-size: 14px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary-navy);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Cards & Stats */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.blue { background: rgba(26, 35, 126, 0.1); color: var(--primary-navy); }
.stat-icon.gold { background: rgba(251, 192, 45, 0.1); color: #B28704; }
.stat-icon.green { background: rgba(46, 125, 50, 0.1); color: var(--secondary-green); }

.stat-info h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
}

.stat-info p {
  margin: 0;
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */

@media (max-width: 900px) {
  /* Login Page Stacking */
  .login-container-wide {
    flex-direction: column;
    gap: 30px;
  }
  .school-identity {
    text-align: center;
  }
  .gold-divider {
    margin: 18px auto;
  }
  .verse-box {
    text-align: left;
    max-width: 440px;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  /* iOS: background-attachment: fixed is buggy/janky — disable it */
  body.login-page {
    background-attachment: scroll;
  }

  /* More room for the form on small phones */
  .login-card {
    padding: 32px 22px 26px;
  }

  /* Dashboard Mobile */
  .mobile-topbar {
    display: flex;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .sidebar-overlay.show {
    display: block;
  }
  
  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 24px;
  }

  .top-bar {
    display: none !important; /* Hide top bar on mobile, use mobile-topbar instead */
  }
}