/* ============================================
   Liquid Glass Design System
   Apple WWDC 2025 Inspired - Glasmorphism
   ============================================ */

/* --- Light Mode (Default) --- */
:root {
  --bg-base: #f2f2f7;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-heavy: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
  --text-primary: #1c1c1e;
  --text-secondary: #3c3c43;
  --text-tertiary: #8e8e93;
  --accent: #007AFF;
  --accent-hover: #0062cc;
  --accent-light: rgba(0, 122, 255, 0.12);
  --error: #FF3B30;
  --error-bg: rgba(255, 59, 48, 0.1);
  --success: #34C759;
  --success-bg: rgba(52, 199, 89, 0.1);
  --warning: #FF9500;
  --warning-bg: rgba(255, 149, 0, 0.1);
  --glass-shadow: 0 2px 16px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.05);
  --glass-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.05);
  --orb-1: rgba(0, 122, 255, 0.15);
  --orb-2: rgba(88, 86, 214, 0.12);
  --orb-3: rgba(52, 199, 89, 0.10);
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg-base: #000000;
  --glass-bg: rgba(44, 44, 46, 0.65);
  --glass-bg-heavy: rgba(44, 44, 46, 0.82);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-primary: #ffffff;
  --text-secondary: #ebebf5;
  --text-tertiary: #8e8e93;
  --accent: #0A84FF;
  --accent-hover: #409cff;
  --accent-light: rgba(10, 132, 255, 0.15);
  --error: #FF453A;
  --error-bg: rgba(255, 69, 58, 0.15);
  --success: #30D158;
  --success-bg: rgba(48, 209, 88, 0.15);
  --warning: #FF9F0A;
  --warning-bg: rgba(255, 159, 10, 0.15);
  --glass-shadow: 0 2px 16px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.05);
  --glass-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.05);
  --orb-1: rgba(10, 132, 255, 0.12);
  --orb-2: rgba(94, 92, 230, 0.10);
  --orb-3: rgba(48, 209, 88, 0.08);
}

/* --- Gradient Mesh Background --- */
.gradient-mesh {
  background-color: var(--bg-base);
  position: relative;
  overflow-x: hidden;
}

.gradient-mesh::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, var(--orb-1) 0%, transparent 70%);
  animation: orb-float-1 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.gradient-mesh::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, var(--orb-2) 0%, transparent 70%);
  animation: orb-float-2 25s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes orb-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(10%, 15%) scale(1.1); }
  66% { transform: translate(-5%, -10%) scale(0.95); }
}

@keyframes orb-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-15%, -10%) scale(1.05); }
  66% { transform: translate(10%, 5%) scale(1.1); }
}

/* --- Glass Utility Classes --- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-heavy {
  background: var(--glass-bg-heavy);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-lg);
}

.glass-sidebar {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* --- Glass Input --- */
.glass-input {
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.glass-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* --- Glass Buttons --- */
.glass-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  white-space: nowrap;
}

.glass-button-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

.glass-button-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.35);
  transform: translateY(-1px);
}

.glass-button-secondary {
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.glass-button-secondary:hover {
  background: var(--glass-bg-heavy);
  transform: translateY(-1px);
}

.glass-button-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}

.glass-button-ghost:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* --- Glass Badge --- */
.glass-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  background: var(--glass-bg);
  backdrop-filter: blur(8px) saturate(150%);
  -webkit-backdrop-filter: blur(8px) saturate(150%);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.glass-badge-accent {
  background: var(--accent-light);
  color: var(--accent);
  border-color: transparent;
}

/* --- Theme Toggle --- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background: var(--glass-bg-heavy);
  color: var(--accent);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Sun icon hidden in light mode, Moon icon hidden in dark mode */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* --- Transitions --- */
*, *::before, *::after {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

/* Reset transition for elements that shouldn't animate */
input, textarea, select, button, a,
.no-transition, .no-transition * {
  transition-property: none;
}

/* Re-enable specific transitions for interactive elements */
input, textarea, select {
  transition: border-color 0.2s, box-shadow 0.2s;
}

button, a {
  transition: background-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
}

/* Ensure glass content sits above background orbs */
.gradient-mesh > * {
  position: relative;
  z-index: 1;
}
