/* iOS 18 Design System - Glass Theme */

/* Dark mode variable overrides (global). Note: student-theme.css also overrides
   variables on student bodies, but some pages/components rely on :root vars */
html.theme-dark {
  --bg-page: #1c1c1e;
  /* Dark background for the page */
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(235, 235, 245, 0.72);
  --text-tertiary: rgba(235, 235, 245, 0.48);

  --bg-primary: rgba(22, 22, 24, 0.72);
  --bg-secondary: rgba(28, 28, 30, 0.60);
  --bg-tertiary: rgba(35, 35, 38, 0.65);
  --bg-overlay: rgba(0, 0, 0, 0.55);

  --border-color: rgba(255, 255, 255, 0.10);
  --border-light: rgba(255, 255, 255, 0.06);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.55);
}

:root {
  /* iOS 18 Colors */
  --ios-blue: #007AFF;
  --ios-green: #34C759;
  --ios-orange: #FF9500;
  --ios-red: #FF3B30;
  --ios-gray: #8E8E93;
  --ios-gray-light: #C7C7CC;
  --ios-gray-dark: #48484A;

  /* Text Colors */
  --text-primary: #000000;
  --text-secondary: #3C3C43;
  --text-tertiary: #8E8E93;

  /* Background Colors */
  --bg-page: #f0f2f5;
  /* Light background for the page */
  --bg-primary: rgba(255, 255, 255, 0.7);
  --bg-secondary: rgba(255, 255, 255, 0.5);
  --bg-tertiary: rgba(242, 242, 247, 0.6);
  --bg-overlay: rgba(0, 0, 0, 0.4);

  /* Border */
  --border-color: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.04);

  /* Radius - More "puffy" iOS-style radius */
  --radius-xl: 36px;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 16px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);

  /* Spacing */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

body {
  background: var(--bg-page);
  color: var(--text-primary);
}

/* Core Glass Panel */
.glass-panel {
  /* mapped to GlassSurface fallback look */
  background: var(--gs-bg, rgba(255, 255, 255, 0.25));
  backdrop-filter: blur(var(--gs-blur, 12px)) saturate(var(--gs-saturate, 1.8)) brightness(var(--gs-brightness, 1.1));
  -webkit-backdrop-filter: blur(var(--gs-blur, 12px)) saturate(var(--gs-saturate, 1.8)) brightness(var(--gs-brightness, 1.1));
  border: 1px solid var(--gs-border, rgba(255, 255, 255, 0.30));
  box-shadow: var(--gs-shadow,
      0 8px 32px 0 rgba(31, 38, 135, 0.20),
      0 2px 16px 0 rgba(31, 38, 135, 0.10),
      inset 0 1px 0 0 rgba(255, 255, 255, 0.40),
      inset 0 -1px 0 0 rgba(255, 255, 255, 0.20));
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  transition: opacity 0.26s ease-out, transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-panel:hover {
  box-shadow: var(--gs-shadow,
      0 8px 32px 0 rgba(31, 38, 135, 0.20),
      0 2px 16px 0 rgba(31, 38, 135, 0.10),
      inset 0 1px 0 0 rgba(255, 255, 255, 0.40),
      inset 0 -1px 0 0 rgba(255, 255, 255, 0.20));
}

/* Glass Card */
.glass-card {
  /* mapped to GlassSurface fallback look (slightly tighter) */
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(12px) saturate(1.8) brightness(1.12);
  -webkit-backdrop-filter: blur(12px) saturate(1.8) brightness(1.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  box-shadow:
    0 8px 32px 0 rgba(31, 38, 135, 0.18),
    0 2px 16px 0 rgba(31, 38, 135, 0.08),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 0 rgba(255, 255, 255, 0.18);
  transition: opacity 0.26s ease-out;
}

/* Button System - iOS 18 Style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  /* iOS comfortable tap target */
  padding: 0 20px;
  border-radius: calc(var(--radius-sm) + 2px);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.4px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ios-blue);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

.btn-primary:hover {
  background: #0051D5;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.35);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 0.5px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-success {
  background: var(--ios-green);
  color: white;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.25);
}

.btn-success:hover {
  background: #28A745;
  transform: scale(1.02);
}

.btn-danger {
  background: var(--ios-red);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.25);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* Input System - iOS 18 Style */
.input-glass {
  width: 100%;
  padding: 15px 16px;
  background: var(--bg-secondary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 17px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  letter-spacing: -0.4px;
}

.input-glass::placeholder {
  color: var(--text-tertiary);
}

.input-glass:focus {
  /* Use theme variables so dark mode doesn't flash white */
  background: var(--bg-secondary);
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.22);
}

/* If some pages still end up with a light focus background, ensure typed text stays readable */
html.theme-dark .input-glass:focus {
  color: var(--text-primary);
}

/* Badge System - iOS 18 Style */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: calc(var(--radius-sm) - 4px);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.badge-pending {
  background: rgba(255, 149, 0, 0.15);
  color: var(--ios-orange);
}

.badge-completed {
  background: rgba(52, 199, 89, 0.15);
  color: var(--ios-green);
}

/* Alias classes used by AI-check page */
.badge-success {
  background: rgba(52, 199, 89, 0.15);
  color: var(--ios-green);
}

.badge-expired {
  background: rgba(255, 59, 48, 0.15);
  color: var(--ios-red);
}

.badge-danger {
  background: rgba(255, 59, 48, 0.15);
  color: var(--ios-red);
}

.badge-info {
  background: rgba(0, 122, 255, 0.15);
  color: var(--ios-blue);
}

/* Status Indicator - iOS 18 Style */
.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.success {
  background: var(--ios-green);
}

.status-indicator.warning {
  background: var(--ios-orange);
}

.status-indicator.danger {
  background: var(--ios-red);
}

/* Loading Spinner - iOS Glass Style (Unified) */
.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0, 0, 0, 0.10);
  border-top-color: var(--ios-blue);
  border-right-color: rgba(10, 132, 255, 0.22);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Unified ring spinner (preferred) */
.spinner-ring {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0, 0, 0, 0.10);
  border-top-color: var(--ios-blue);
  border-right-color: rgba(10, 132, 255, 0.22);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-ring.sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.spinner-ring.md {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

.spinner-ring.lg {
  width: 44px;
  height: 44px;
  border-width: 3px;
}

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

/* Animations - iOS 18 Style */
.fade-in {
  animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scale-in {
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Toast Messages - iOS 18 Style */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 0.5px solid var(--border-color);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Divider - iOS 18 Style */
.divider {
  height: 0.5px;
  background: var(--border-color);
  margin: var(--spacing-lg) 0;
}

/* Skeleton Loading - iOS 18 Style */
.skeleton {
  background: linear-gradient(90deg,
      rgba(0, 0, 0, 0.06) 25%,
      rgba(0, 0, 0, 0.12) 50%,
      rgba(0, 0, 0, 0.06) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
  min-height: 20px;
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
  border-radius: calc(var(--radius-sm) - 12px);
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 12px;
  border-radius: calc(var(--radius-sm) - 10px);
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Global Custom Scrollbar - iOS/Glass Style */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  border: 1px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
  background-clip: content-box;
}

/* Dark mode scrollbar support */
html.theme-dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

html.theme-dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Firefox scrollbar support */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

html.theme-dark * {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* =========================================
   AI Liquid Glass UI (Competition Risk)
   ========================================= */

.ai-risk-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(60px) saturate(180%) brightness(1.05);
  -webkit-backdrop-filter: blur(60px) saturate(180%) brightness(1.05);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow:
    0 12px 40px 0 rgba(31, 38, 135, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-risk-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 50px 0 rgba(31, 38, 135, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

html.theme-dark .ai-risk-card {
  background: rgba(22, 22, 30, 0.55);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 12px 40px 0 rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

html.theme-dark .ai-risk-card:hover {
  box-shadow:
    0 16px 50px 0 rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Pulsing Border Effect */
.ai-risk-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 20px rgba(0, 122, 255, 0.1);
  opacity: 0;
  animation: none;
  pointer-events: none;
  z-index: 1;
}

.ai-risk-card.scanning::after {
  animation: pulse-blue 2s infinite;
}

.ai-risk-card.alert-high::after {
  box-shadow: inset 0 0 30px rgba(255, 59, 48, 0.15);
  animation: pulse-red 2s infinite;
  opacity: 1;
}

@keyframes pulse-blue {
  0% {
    opacity: 0.3;
    box-shadow: inset 0 0 10px rgba(0, 122, 255, 0.1);
  }

  50% {
    opacity: 0.7;
    box-shadow: inset 0 0 25px rgba(0, 122, 255, 0.25);
  }

  100% {
    opacity: 0.3;
    box-shadow: inset 0 0 10px rgba(0, 122, 255, 0.1);
  }
}

@keyframes pulse-red {
  0% {
    opacity: 0.4;
    box-shadow: inset 0 0 15px rgba(255, 59, 48, 0.2);
  }

  50% {
    opacity: 0.8;
    box-shadow: inset 0 0 35px rgba(255, 59, 48, 0.4);
  }

  100% {
    opacity: 0.4;
    box-shadow: inset 0 0 15px rgba(255, 59, 48, 0.2);
  }
}

/* Liquid Gradient Background */
.ai-liquid-bg {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%,
      rgba(0, 122, 255, 0.08) 0%,
      rgba(52, 199, 89, 0.05) 30%,
      rgba(255, 255, 255, 0) 70%);
  opacity: 0.6;
  filter: blur(60px);
  z-index: 0;
  animation: liquid-move 15s ease-in-out infinite alternate;
}

.ai-risk-card.alert-high .ai-liquid-bg {
  background: radial-gradient(circle at 50% 50%,
      rgba(255, 59, 48, 0.1) 0%,
      rgba(255, 149, 0, 0.08) 40%,
      rgba(255, 255, 255, 0) 70%);
}

@keyframes liquid-move {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  100% {
    transform: translate(-10%, -10%) rotate(5deg);
  }
}

/* Content Styling */
.ai-card-header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.ai-icon-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ios-green);
  box-shadow: 0 0 12px var(--ios-green), 0 0 4px var(--ios-green);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-status-dot.success {
  animation: pulse-dot-green 2s ease-in-out infinite;
}

.ai-status-dot.scanning {
  background: var(--ios-blue);
  box-shadow: 0 0 12px var(--ios-blue), 0 0 4px var(--ios-blue);
  animation: pulse-dot-blue 1.5s ease-in-out infinite;
}

.ai-status-dot.alert {
  background: var(--ios-red);
  box-shadow: 0 0 12px var(--ios-red), 0 0 4px var(--ios-red);
  animation: pulse-dot-red 1.5s ease-in-out infinite;
}

@keyframes pulse-dot-green {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

@keyframes pulse-dot-blue {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.15);
    opacity: 0.7;
  }
}

@keyframes pulse-dot-red {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.15);
    opacity: 0.75;
  }
}

.ai-alert-list {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.ai-alert-item {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

html.theme-dark .ai-alert-item {
  background: rgba(40, 40, 50, 0.45);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ai-alert-item:hover {
  transform: translateY(-2px) scale(1.01);
  background: rgba(255, 255, 255, 0.7);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

html.theme-dark .ai-alert-item:hover {
  background: rgba(45, 45, 55, 0.55);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.ai-alert-item:active {
  transform: translateY(0) scale(0.99);
}

.ai-alert-icon {
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  text-align: center;
}