/* ============================================
   OUDIFY — Design System
   Glassmorphic Dark Theme with Ottoman Warmth
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================
   1. CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* --- Backgrounds --- */
  --bg-deep: #06060b;
  --bg-surface: rgba(255, 255, 255, 0.03);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);
  --bg-glass-active: rgba(255, 255, 255, 0.12);
  --bg-elevated: rgba(255, 255, 255, 0.07);

  /* --- Borders --- */
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.15);
  --border-glass-accent: rgba(212, 165, 116, 0.3);
  --border-glass-accent-strong: rgba(212, 165, 116, 0.5);

  /* --- Accent Colors --- */
  --accent-primary: #d4a574;
  --accent-primary-rgb: 212, 165, 116;
  --accent-glow: rgba(212, 165, 116, 0.15);
  --accent-glow-strong: rgba(212, 165, 116, 0.3);
  --accent-gold: #c9953c;
  --accent-gold-light: #e0b96e;

  /* --- Text --- */
  --text-primary: #f0ece4;
  --text-secondary: rgba(240, 236, 228, 0.6);
  --text-muted: rgba(240, 236, 228, 0.35);
  --text-accent: var(--accent-primary);

  /* --- Semantic Colors --- */
  --success: #4ade80;
  --success-glow: rgba(74, 222, 128, 0.15);
  --warning: #fbbf24;
  --warning-glow: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-glow: rgba(248, 113, 113, 0.15);

  /* --- Spacing --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* --- Border Radius --- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* --- Typography --- */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* --- Shadows --- */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);
  --shadow-glow-strong: 0 0 60px var(--accent-glow-strong);
  --shadow-inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  /* --- Transitions --- */
  --transition-fast: 150ms ease-out;
  --transition-base: 200ms ease-out;
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- Z-Index Scale --- */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sidebar: 200;
  --z-modal: 300;
  --z-toast: 400;

  /* --- Layout --- */
  --sidebar-width: 240px;
  --sidebar-collapsed: 72px;
  --bottom-bar-height: 64px;
  --header-height: 0px;
  --content-max-width: 1200px;
}

/* ============================================
   2. Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-deep);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle background pattern overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(212, 165, 116, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(212, 165, 116, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(100, 80, 60, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-gold-light);
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

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

::selection {
  background: rgba(212, 165, 116, 0.3);
  color: var(--text-primary);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   3. Typography Utilities
   ============================================ */
.font-display {
  font-family: var(--font-display);
}

.font-body {
  font-family: var(--font-body);
}

.font-mono {
  font-family: var(--font-mono);
}

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-center { text-align: center; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.08em; }

/* Special perde name style */
.perde-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* Frequency / numeric display */
.freq-display {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* ============================================
   4. Glassmorphism Components
   ============================================ */

/* --- Base Glass Panel --- */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), var(--shadow-inner-highlight);
  transition:
    background var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-base);
}

.glass:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
}

/* --- Accent Glass (with amber glow) --- */
.glass--accent {
  border-color: var(--border-glass-accent);
  box-shadow:
    var(--shadow-lg),
    var(--shadow-glow),
    var(--shadow-inner-highlight);
}

.glass--accent:hover {
  border-color: var(--border-glass-accent-strong);
  box-shadow:
    var(--shadow-lg),
    var(--shadow-glow-strong),
    var(--shadow-inner-highlight);
}

/* --- Strong Glass (more visible) --- */
.glass--strong {
  background: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.12);
}

/* --- Subtle Glass (barely visible) --- */
.glass--subtle {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ============================================
   5. Button Components
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary: amber filled */
.btn--primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-gold));
  color: #0a0a0f;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(212, 165, 116, 0.3);
}

.btn--primary:hover {
  box-shadow: 0 4px 24px rgba(212, 165, 116, 0.45);
  transform: translateY(-1px);
}

/* Ghost: glass button */
.btn--ghost {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn--ghost:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
}

/* Pill: rounded glass button */
.btn--pill {
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-5);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn--pill:hover {
  color: var(--text-primary);
  border-color: var(--border-glass-hover);
  background: var(--bg-glass-hover);
}

.btn--pill.active {
  background: rgba(212, 165, 116, 0.15);
  border-color: var(--border-glass-accent);
  color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

/* Icon button */
.btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn--icon:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

/* Large CTA */
.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* ============================================
   6. Card Component
   ============================================ */

.card {
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.card__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.card__icon {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
}

/* ============================================
   7. Tag / Badge
   ============================================ */

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.tag--accent {
  background: rgba(212, 165, 116, 0.1);
  border-color: rgba(212, 165, 116, 0.2);
  color: var(--accent-primary);
}

.tag--success {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.2);
  color: var(--success);
}

/* ============================================
   8. Dropdown
   ============================================ */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition-fast);
}

.dropdown__trigger:hover {
  border-color: var(--border-glass-hover);
  background: var(--bg-glass-hover);
}

.dropdown__trigger svg {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  transition: transform var(--transition-fast);
}

.dropdown.open .dropdown__trigger svg {
  transform: rotate(180deg);
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 200px;
  background: rgba(20, 20, 30, 0.95);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition:
    opacity var(--transition-base),
    transform var(--transition-base);
}

.dropdown.open .dropdown__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown__item:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.dropdown__item.active {
  color: var(--accent-primary);
  background: rgba(212, 165, 116, 0.08);
}

/* ============================================
   9. Utility Classes
   ============================================ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
