:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-tertiary: #1e293b;
  --bg-card: #151e32;
  --border-color: #334155;
  --border-focus: #818cf8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.2);
  --text-primary: #ffffff;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.18);
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --sidebar-width: 340px;
  --notes-width: 380px;
}

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

/* WCAG 2.1 Focus Indicator */
*:focus-visible {
  outline: 2px solid var(--border-focus) !important;
  outline-offset: 2px !important;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Top Navigation Bar */
header.navbar {
  height: 58px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 100;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  cursor: pointer;
  background: none;
  border: none;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 50%;
}

.breadcrumbs {
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumbs span.current {
  color: var(--text-primary);
  font-weight: 600;
}

.system-status-pill {
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Accessible Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  min-height: 38px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn:hover:not(:disabled) {
  background-color: var(--border-color);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
}

.btn-icon {
  padding: 0.45rem;
  min-width: 38px;
  min-height: 38px;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Main Container */
main.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Home / Course Catalog View */
#view-catalog {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.catalog-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.catalog-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.catalog-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.stat-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Accessible Course Card */
button.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  width: 100%;
}

button.course-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px -3px var(--accent-light);
}

.course-banner {
  height: 130px;
  background: linear-gradient(135deg, #1e1e38, #2a2050);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 2.5rem;
}

.course-content {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.course-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.course-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
}

.course-resume-btn {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  color: #a5b4fc;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.progress-bar-container {
  background: var(--bg-tertiary);
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: auto;
}

.progress-bar-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Course Player Theater View */
#view-player {
  flex: 1;
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* Left Sidebar (Course Tree) */
.sidebar-nav {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-search input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}

.modules-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.module-group {
  margin-bottom: 0.75rem;
}

.module-header {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: inherit;
  text-align: left;
}

.module-header:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.module-lessons {
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-left: 0.5rem;
}

.module-lessons.hidden {
  display: none;
}

button.lesson-item {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.15s ease;
  background: none;
  border: 1px solid transparent;
  font-family: inherit;
  text-align: left;
}

button.lesson-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

button.lesson-item.active {
  background: var(--accent-light);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--accent);
}

.lesson-status-icon {
  font-size: 0.85rem;
  width: 16px;
  text-align: center;
}

.status-completed { color: var(--success); }
.status-inprogress { color: var(--warning); }
.status-unwatched { color: var(--text-muted); }

.lesson-title-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-badge-notes {
  font-size: 0.7rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.lesson-badge-sub {
  font-size: 0.65rem;
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-weight: 700;
}

/* Center Theater (Video + Controls) */
.theater-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow-y: auto;
  position: relative;
}

.video-player-wrapper {
  position: relative;
  background: #000;
  width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

video#main-video {
  width: 100%;
  height: 100%;
  max-height: 70vh;
  outline: none;
}

/* OSD Overlay (HUD on Video) */
.osd-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 20px;
  font-size: 1.25rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 50;
}

.osd-overlay.show {
  opacity: 1;
}

.player-bottom-bar {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.current-lesson-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.current-lesson-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.player-custom-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.playback-speed-group {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.speed-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.6rem;
  min-height: 34px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.speed-btn.active, .speed-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.lesson-nav-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Right Sidebar (Notes & Bookmarks) */
.notes-sidebar {
  width: var(--notes-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

.notes-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notes-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.save-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.notes-toolbar {
  padding: 0.4rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
}

.notes-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.notes-tab-btn {
  flex: 1;
  padding: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  border-bottom: 2px solid transparent;
}

.notes-tab-btn.active {
  color: #818cf8;
  border-bottom-color: var(--accent);
}

.notes-editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem;
}

textarea#notes-editor {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 0.85rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.notes-preview {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Timestamp badge */
.ts-chip {
  display: inline-flex;
  align-items: center;
  background: var(--accent-light);
  color: #a5b4fc;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0 0.2rem;
  user-select: none;
}

.ts-chip:hover {
  background: var(--accent);
  color: #fff;
}

/* Bookmarks tab */
.bookmarks-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bookmark-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

/* Toast notifications with ARIA live */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  font-size: 0.875rem;
  animation: slideIn 0.2s ease-out;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 260px;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

.toast-close:hover {
  color: #fff;
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive Mobile Navigation */
@media (max-width: 992px) {
  body {
    overflow: auto;
  }
  #view-player {
    flex-direction: column;
  }
  .sidebar-nav, .notes-sidebar {
    width: 100%;
    height: auto;
    max-height: 50vh;
  }
}

/* Modal Backdrop & Dialog */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleIn 0.2s ease-out;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 65vh;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.modal-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9rem;
}

.modal-step-item.success {
  border-color: rgba(16, 185, 129, 0.4);
}

.modal-step-icon {
  font-size: 1.1rem;
}

.modal-result-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}

.gdrive-course-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.gdrive-course-item:last-child {
  border-bottom: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Touch Gestures Overlay on Video */
.touch-gestures-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  pointer-events: none;
  z-index: 40;
}

.touch-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  pointer-events: auto;
}

.touch-center {
  flex: 0.8;
}

.seek-ripple {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1rem;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.seek-ripple.active {
  opacity: 1;
  transform: scale(1.1);
}

/* Mobile Bottom Navigation Bar (< 768px) */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  body {
    padding-bottom: 60px;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.2rem;
    cursor: pointer;
  }

  .mobile-nav-btn.active {
    color: var(--accent);
  }

  .mobile-nav-btn .mob-icon {
    font-size: 1.2rem;
  }

  /* Pane visibility on mobile */
  #view-player.mobile-mode-video #pane-modules,
  #view-player.mobile-mode-video #pane-notes {
    display: none !important;
  }
  #view-player.mobile-mode-video #pane-video {
    display: flex !important;
  }

  #view-player.mobile-mode-modules #pane-video,
  #view-player.mobile-mode-modules #pane-notes {
    display: none !important;
  }
  #view-player.mobile-mode-modules #pane-modules {
    display: flex !important;
    width: 100% !important;
    max-height: calc(100vh - 120px) !important;
  }

  #view-player.mobile-mode-notes #pane-video,
  #view-player.mobile-mode-notes #pane-modules {
    display: none !important;
  }
  #view-player.mobile-mode-notes #pane-notes {
    display: flex !important;
    width: 100% !important;
    max-height: calc(100vh - 120px) !important;
  }
}

/* ---------------- USER MENU & AUTH STYLES ---------------- */

.user-menu-wrapper {
  position: relative;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.user-profile-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.user-avatar {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--accent-light);
  color: var(--accent);
}

.user-role-badge.role-admin {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.user-role-badge.role-student {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.dropdown-chevron {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  padding: 0.5rem 0;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

.user-menu-header {
  padding: 0.6rem 1rem;
}

.user-menu-fullname {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-menu-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.user-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.4rem 0;
}

.user-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.user-menu-item:hover {
  background: var(--bg-card);
  color: #fff;
}

.user-menu-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ---------------- LOGIN MODAL ---------------- */

.login-modal-box {
  max-width: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.alert-banner {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

/* ---------------- ADMIN DASHBOARD MODAL ---------------- */

.admin-modal-box {
  max-width: 860px;
  width: 95vw;
}

.admin-tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  padding: 0 1rem;
  gap: 0.5rem;
}

.admin-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.admin-tab-btn:hover {
  color: var(--text-primary);
}

.admin-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.admin-modal-body {
  max-height: 70vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.admin-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-form-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  animation: fadeIn 0.2s ease-out;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-grid select,
.form-grid input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}

.table-responsive {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* System Telemetry Cards */
.diag-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.diag-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.diag-card-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
}

.diag-card-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.diag-card-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
