/* ==========================================================================
   CS REVOLT - GATE LMS DESIGN SYSTEM & CORE STYLES
   Derived from CS Revolt Identity: Cyber Cyan (#1fb5f5), Revolt Orange (#f7931e)
   ========================================================================== */

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

:root {
  /* Common Brand Colors */
  --brand-cyan: #1fb5f5;
  --brand-cyan-light: #6fd0fb;
  --brand-cyan-dark: #0b72c0;
  --brand-cyan-glow: rgba(31, 181, 245, 0.35);

  --brand-orange: #f7931e;
  --brand-orange-light: #ffb14d;
  --brand-orange-dark: #c96a05;
  --brand-orange-glow: rgba(247, 147, 30, 0.35);

  --brand-gold: #ffb703;
  --brand-blue: #1565c0;

  /* Font Families */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --header-height: 72px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================= DARK THEME (DEFAULT) ================= */
body[data-theme="dark"],
:root {
  --bg-primary: #061431;
  --bg-secondary: #0a1f47;
  --bg-card: rgba(12, 32, 72, 0.82);
  --bg-card-hover: rgba(18, 46, 98, 0.92);
  --bg-card-active: #143064;
  --bg-input: #081a3d;
  --bg-sidebar: #07183a;

  --border-subtle: rgba(31, 181, 245, 0.18);
  --border-strong: rgba(31, 181, 245, 0.40);
  --border-orange: rgba(247, 147, 30, 0.40);

  --text-primary: #f8fafc;
  --text-secondary: #b4c3dc;
  --text-muted: #8396b6;
  --text-inverse: #061431;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(31, 181, 245, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 35px rgba(31, 181, 245, 0.15);
  --shadow-glow-cyan: 0 0 25px rgba(31, 181, 245, 0.3);
  --shadow-glow-orange: 0 0 25px rgba(247, 147, 30, 0.35);

  --circuit-grid: radial-gradient(rgba(31, 181, 245, 0.06) 1px, transparent 1px);
}

/* ================= LIGHT THEME ================= */
body[data-theme="light"] {
  --bg-primary: #e8eff9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f8ff;
  --bg-card-active: #dde9f8;
  --bg-input: #eef3fa;
  --bg-sidebar: #ffffff;

  --border-subtle: rgba(10, 42, 94, 0.16);
  --border-strong: rgba(21, 101, 192, 0.45);
  --border-orange: rgba(201, 106, 5, 0.45);

  --text-primary: #0a1b3d;
  --text-secondary: #33445f;
  --text-muted: #5b6b85;
  --text-inverse: #ffffff;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 18px rgba(10, 42, 94, 0.12);
  --shadow-lg: 0 16px 36px rgba(15, 23, 42, 0.12), 0 0 25px rgba(31, 181, 245, 0.08);
  --shadow-glow-cyan: 0 4px 16px rgba(21, 101, 192, 0.28);
  --shadow-glow-orange: 0 4px 16px rgba(217, 94, 0, 0.25);

  --circuit-grid: radial-gradient(rgba(21, 101, 192, 0.10) 1px, transparent 1px);
}

/* ================= BASE RESETS ================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  background-image: var(--circuit-grid);
  background-size: 28px 28px;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  width: 100%;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
  box-sizing: border-box;
}

/* Prevent auto-zooming on iOS for form inputs */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

img, svg, video, iframe {
  max-width: 100%;
  display: block;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(31, 181, 245, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--brand-cyan);
}

/* ================= UTILITY CLASSES ================= */
.container {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .container {
    padding: 0 20px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
}

@media (max-width: 360px) {
  .container {
    padding: 0 12px;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-cyan {
  background: rgba(31, 181, 245, 0.12);
  color: var(--brand-cyan);
  border: 1px solid rgba(31, 181, 245, 0.28);
}

.badge-orange {
  background: rgba(247, 147, 30, 0.12);
  color: var(--brand-orange);
  border: 1px solid rgba(247, 147, 30, 0.32);
}

.badge-admin {
  background: linear-gradient(135deg, rgba(247, 147, 30, 0.2), rgba(255, 183, 3, 0.2));
  color: #ffb703;
  border: 1px solid rgba(255, 183, 3, 0.4);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #1e9be8, var(--brand-royal));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(31, 181, 245, 0.28);
  font-weight: 700;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(31, 181, 245, 0.45);
}

.btn-orange {
  background: linear-gradient(135deg, var(--brand-orange), #e8710a);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(247, 147, 30, 0.35);
  font-weight: 700;
}
.btn-orange:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(247, 147, 30, 0.55);
}

.btn-outline {
  background: rgba(14, 25, 48, 0.4);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(8px);
}
.btn-outline:hover {
  background: rgba(31, 181, 245, 0.1);
  border-color: var(--brand-cyan);
  color: var(--brand-cyan);
}

body[data-theme="light"] .btn-outline {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #94a3b8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-weight: 600;
}
body[data-theme="light"] .btn-outline:hover {
  background: #f0f9ff;
  border-color: #0284c7;
  color: #0284c7;
}

.btn-ghost {
  color: var(--text-secondary);
  background: transparent;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(31, 181, 245, 0.08);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ================= TOP NAVIGATION ================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(6, 11, 24, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  transition: var(--transition);
}

body[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  flex-wrap: nowrap;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  aspect-ratio: 1 / 1;
  display: block;
  background: transparent;
  border: 2px solid var(--brand-cyan);
  box-shadow: 0 0 15px rgba(31, 181, 245, 0.4);
  transition: var(--transition);
  flex-shrink: 0;
}
.brand-wrapper:hover .brand-logo-img {
  transform: rotate(10deg) scale(1.05);
  box-shadow: 0 0 20px rgba(247, 147, 30, 0.6);
  border-color: var(--brand-orange);
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 3px;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-title .cs {
  color: var(--brand-cyan);
  text-shadow: 0 0 14px rgba(31, 181, 245, 0.45);
}

.brand-title .revolt {
  color: var(--brand-orange);
  text-shadow: 0 0 14px rgba(247, 147, 30, 0.45);
}

.brand-sub {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Header Right Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.yt-link-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 0, 0, 0.12);
  border: 1px solid rgba(255, 0, 0, 0.3);
  color: #ff4d4d;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  transition: var(--transition);
}
.yt-link-badge:hover {
  background: #ff0000;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
  transform: translateY(-1px);
}

/* Buy me a Coffee Button: a coffee-toned pill to sit beside the YouTube badge */
.btn-coffee {
  background: rgba(146, 84, 34, 0.12);
  border: 1px solid rgba(146, 84, 34, 0.35);
  color: #7a4419;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.btn-coffee:hover {
  background: #6f3d17;
  border-color: #6f3d17;
  color: #fff7ed;
  box-shadow: 0 4px 14px rgba(111, 61, 23, 0.35);
  transform: translateY(-1px);
}
body[data-theme="dark"] .btn-coffee {
  background: rgba(214, 160, 105, 0.12);
  border-color: rgba(214, 160, 105, 0.38);
  color: #e8b98a;
}
body[data-theme="dark"] .btn-coffee:hover {
  background: #a8642c;
  border-color: #a8642c;
  color: #fff7ed;
}

/* User Role Switcher Pill */
.role-pill-switch {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  position: relative;
}

.role-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  transition: var(--transition);
}

.role-btn.active {
  color: #060b18;
  font-weight: 700;
}

.role-btn.student.active {
  background: var(--brand-cyan);
  box-shadow: 0 2px 10px rgba(31, 181, 245, 0.4);
}

.role-btn.admin.active {
  background: var(--brand-orange);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(247, 147, 30, 0.4);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.15rem;
  transition: var(--transition);
}
.theme-toggle-btn:hover {
  border-color: var(--brand-cyan);
  color: var(--brand-cyan);
  box-shadow: 0 0 12px rgba(31, 181, 245, 0.25);
  transform: rotate(20deg);
}

/* ================= HEADER RESPONSIVENESS ================= */
@media (max-width: 900px) {
  .header-actions {
    gap: 8px;
  }
  .header-actions .btn-coffee {
    padding: 7px 12px;
    font-size: 0.82rem;
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: 56px;
  }
  .app-header {
    height: 56px;
  }
  .header-inner {
    gap: 8px;
  }
  .brand-wrapper {
    gap: 8px;
    flex-shrink: 0;
  }
  .brand-logo-img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }
  .brand-title {
    font-size: 1.12rem;
    white-space: nowrap;
  }
  .brand-sub {
    display: none;
  }
  .header-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
  }
  /* Restore YouTube button as sleek circular icon button on mobile */
  .yt-link-badge {
    display: inline-flex !important;
    width: 32px;
    height: 32px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(255, 0, 0, 0.12);
    border: 1px solid rgba(255, 0, 0, 0.35);
    transition: var(--transition);
  }
  .yt-link-badge:hover {
    background: rgba(255, 0, 0, 0.22);
    transform: translateY(-1px);
  }
  .yt-link-badge span {
    display: none !important;
  }
  .yt-link-badge .yt-icon {
    width: 17px;
    height: 17px;
    margin: 0;
    color: #ff0000;
  }
  .header-actions .btn-coffee {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.95rem;
    flex-shrink: 0;
  }
  .header-actions .btn-coffee span:nth-child(2) {
    display: none;
  }
  .cloud-status-badge {
    display: none !important;
  }
  .user-profile-widget {
    padding: 3px 6px 3px 3px !important;
    gap: 4px !important;
    flex-shrink: 0;
  }
  .user-profile-widget .user-avatar-badge {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.85rem !important;
  }
  .user-profile-widget .user-name-text,
  .user-profile-widget #userRoleBadgeDisplay {
    display: none !important;
  }
  .theme-toggle-btn {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    flex-shrink: 0;
  }
}

@media (max-width: 420px) {
  .header-inner {
    gap: 6px;
    padding: 0 10px;
  }
  .brand-wrapper {
    gap: 6px;
  }
  .brand-logo-img {
    width: 28px;
    height: 28px;
  }
  .brand-title {
    font-size: 1.02rem;
  }
  .cloud-status-badge {
    display: none !important;
  }
  .header-actions {
    gap: 5px;
  }
  .yt-link-badge,
  .header-actions .btn-coffee,
  .theme-toggle-btn {
    width: 30px;
    height: 30px;
  }
}

