/* ==========================================================================
   Celestial Hijri - Styling System
   Theme: Glassmorphism / Dark Celestial / Gold Accent
   ========================================================================== */

/* Custom Variables */
:root {
  color-scheme: dark;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-arabic: 'Amiri', serif;
  
  /* Color Palette */
  --bg-deep-space: #030712;
  --bg-cosmic-sky: #0b1329;
  --card-bg: rgba(15, 23, 42, 0.4);
  --card-bg-hover: rgba(15, 23, 42, 0.55);
  --border-glass: rgba(255, 255, 255, 0.07);
  --border-gold-glow: rgba(251, 191, 36, 0.25);
  
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;
  
  --gold-primary: #fbbf24;
  --gold-dark: #d97706;
  --gold-light: #fef08a;
  --cyan-accent: #06b6d4;
  --red-accent: #ef4444;
  
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 15px rgba(251, 191, 36, 0.15);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-deep-space);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Starry Sky Background Animation */
.stars-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 40px 70px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 150px, #fbbf24, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 150px 240px, #fff, rgba(0,0,0,0)),
    radial-gradient(2.5px 2.5px at 220px 300px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 300px 80px, #06b6d4, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 340px 340px;
  opacity: 0.25;
  z-index: -2;
  animation: starsTwinkle 120s linear infinite;
}

@keyframes starsTwinkle {
  from { background-position: 0 0; }
  to { background-position: 340px 680px; }
}

/* Glowing Cosmic Orbs */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
  will-change: transform;
}

.glow-orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--gold-dark), rgba(0,0,0,0));
  top: -150px;
  right: -100px;
  animation: floatOrb 25s ease-in-out infinite alternate;
}

.glow-orb-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #0e1e38, #030712);
  bottom: -200px;
  left: -150px;
  animation: floatOrb 35s ease-in-out infinite alternate-reverse;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.15); }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(3, 7, 18, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(251, 191, 36, 0.45);
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* App Containers */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  gap: 24px;
}

/* Glassmorphic Cards */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  box-shadow: var(--shadow-premium);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.card:hover {
  background: var(--card-bg-hover);
  border-color: rgba(251, 191, 36, 0.15);
}

.card-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.03) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

/* App Header styling */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  box-shadow: var(--shadow-premium);
  animation: fadeInUp 0.6s ease-out;
  position: relative;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Language Toggle in Header */
.header-lang-selector {
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 10;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: var(--gold-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition-smooth);
}

.lang-icon {
  width: 15px;
  height: 15px;
}

#lbl-lang-toggle {
  min-width: 30px;
  text-align: center;
}

.lang-toggle:hover, .lang-toggle:focus {
  background: rgba(251, 191, 36, 0.2);
  border-color: var(--gold-primary);
  outline: none;
}

/* Keyboard-only focus ring; :focus-visible never matches mouse/touch. */
.lang-toggle:focus-visible,
.nav-btn:focus-visible,
.tab-btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.calendar-day-cell:not(.other-month):focus-visible,
.holiday-item-card:focus-visible,
.celebration-close:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
}

.logo-svg {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.4));
  animation: spinSlow 40s linear infinite;
  will-change: transform;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.header-text h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #fbbf24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-text p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.current-time-badge {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid var(--border-gold-glow);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.05);
}

/* Main Layout Grid */
.main-layout {
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 24px;
  align-items: start;
}

/* Sidebar Columns */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: inset 0 0 10px rgba(251, 191, 36, 0.08); border-color: var(--gold-primary); }
  50% { box-shadow: 0 0 24px rgba(251, 191, 36, 0.5), inset 0 0 12px rgba(251, 191, 36, 0.25); border-color: var(--gold-light); }
}

/* Form inputs & tabs styling */
.conversion-card {
  padding: 24px;
  animation: fadeInUp 0.9s ease-out;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 12px;
}

.icon-title {
  width: 20px;
  height: 20px;
  color: var(--gold-primary);
}

.tabs {
  display: flex;
  background: rgba(3, 7, 18, 0.5);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-smooth);
}

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

.tab-btn.active {
  background: var(--gold-primary);
  color: var(--text-dark);
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.25);
}

.conversion-form {
  display: none;
}

.conversion-form.active-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  background: rgba(3, 7, 18, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-smooth);
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.15);
}

.form-input option {
  background-color: var(--bg-cosmic-sky);
  color: var(--text-primary);
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Buttons styling */
.btn-primary {
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
  color: var(--text-dark);
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.35);
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-primary) 100%);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--gold-primary);
}

.icon {
  width: 16px;
  height: 16px;
}

.conversion-result {
  background: rgba(251, 191, 36, 0.05);
  border: 1px solid rgba(251, 191, 36, 0.15);
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

.conversion-result.hidden {
  display: none;
}

.conversion-result strong {
  color: var(--gold-primary);
  display: block;
  font-size: 16px;
  margin-top: 4px;
  animation: fadeIn 0.35s ease;
}

/* Preferences styling */
.settings-card {
  padding: 24px;
  animation: fadeInUp 1s ease-out;
}

.settings-card .input-group {
  margin-bottom: 16px;
}

.settings-card .form-row .input-group {
  margin-bottom: 0;
}

/* Calendar Panel styling */
.calendar-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeInUp 0.7s ease-out;
}

.calendar-card {
  padding: 30px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  direction: ltr;
}

.nav-controls {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.nav-btn:hover {
  background: rgba(251, 191, 36, 0.1);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.18);
}

.current-month-display {
  text-align: center;
}

.month-name-combo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.month-primary {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.month-arabic {
  font-family: var(--font-arabic);
  font-size: 32px;
  color: var(--gold-primary);
  font-weight: 700;
  line-height: 1;
}

.month-arabic.english-sub {
  font-family: var(--font-sans);
  font-size: 22px;
  letter-spacing: 0.5px;
}

/* Paint the loaded Amiri face on prominent Arabic-only text (Arabic mode only) */
body[dir="rtl"] .month-primary,
body[dir="rtl"] .holiday-name {
  font-family: var(--font-arabic);
}

.year-combo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
}

.year-primary {
  font-size: 16px;
  font-weight: 600;
  color: var(--gold-light);
}

.year-gregorian {
  font-size: 13px;
  color: var(--text-muted);
}

/* Calendar Weekdays and Grid styling */
.calendar-body {
  margin-bottom: 24px;
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.weekday-row span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-day-cell {
  aspect-ratio: 1.1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 8px 10px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

.calendar-day-cell:hover:not(.other-month) {
  background: rgba(251, 191, 36, 0.06);
  border-color: rgba(251, 191, 36, 0.3);
  transform: translateY(-2px);
}

.calendar-day-cell.other-month {
  opacity: 0.15;
  cursor: default;
  pointer-events: none;
}

.day-cell-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.day-cell-greg {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Cell States */
.calendar-day-cell.is-selected {
  border-color: var(--gold-primary);
  background: rgba(251, 191, 36, 0.08);
  box-shadow: inset 0 0 10px rgba(251, 191, 36, 0.08);
}

.calendar-day-cell.is-today {
  border-color: var(--cyan-accent);
  background: rgba(6, 182, 212, 0.08);
}

.calendar-day-cell.is-today .day-cell-num {
  color: #22d3ee;
}

.calendar-day-cell.has-holiday {
  background: rgba(217, 119, 6, 0.04);
}

/* Event indicator dot */
.day-indicators {
  display: flex;
  justify-content: center;
  gap: 3px;
  height: 6px;
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.today-dot { background-color: var(--cyan-accent); }
.holiday-dot { 
  background-color: var(--gold-primary); 
  box-shadow: 0 0 5px var(--gold-primary);
}

/* Calendar Footer */
.calendar-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-glass);
  padding-top: 20px;
}

.legend {
  display: flex;
  gap: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Significant dates / yearly list styling */
.holidays-list-card {
  padding: 28px;
  animation: fadeInUp 0.9s ease-out;
}

.active-year-badge {
  background: rgba(251, 191, 36, 0.1);
  color: var(--gold-primary);
  border: 1px solid var(--border-gold-glow);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-inline-start: auto;
}

.holidays-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 10px;
}

.holiday-item-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.holiday-item-card:hover {
  background: rgba(251, 191, 36, 0.05);
  border-color: rgba(251, 191, 36, 0.25);
  transform: translateY(-2px);
}

.holiday-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.holiday-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.holiday-hijri-date {
  font-size: 12px;
  color: var(--gold-primary);
  font-weight: 600;
}

.holiday-gregorian-date {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  background: rgba(3, 7, 18, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
  text-align: right;
  white-space: nowrap;
}

/* Footer Credit styling */
.app-footer-bar {
  text-align: center;
  padding: 20px 0 24px;
  margin-top: 4px;
  border-top: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.brand-credit {
  color: var(--gold-primary);
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

/* Common Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Media Queries for Responsiveness & Mobile Excellence */
@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* Flatten structure to arrange cards in premium mobile-centric order */
  .sidebar-panel,
  .calendar-panel {
    display: contents;
  }
  
  .conversion-card {
    grid-row: 1;
  }
  
  .calendar-card {
    grid-row: 2;
  }

  .holidays-list-card {
    grid-row: 3;
  }

  .settings-card {
    grid-row: 4;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 16px;
    gap: 16px;
  }

  .app-header {
    flex-direction: column;
    gap: 14px;
    text-align: center;
    padding: 16px;
  }
  
  .header-logo {
    flex-direction: column;
    gap: 8px;
  }

  .current-time-badge {
    font-size: 13px;
    padding: 6px 14px;
    width: 100%;
    justify-content: center;
  }

  .calendar-card {
    padding: 16px;
  }

  .month-primary {
    font-size: 22px;
  }
  
  .month-arabic {
    font-size: 26px;
  }
  
  .month-arabic.english-sub {
    font-size: 18px;
  }
  
  .year-primary {
    font-size: 14px;
  }
  
  .year-gregorian {
    font-size: 11px;
  }

  .nav-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  /* Compact calendar cells for small screens */
  .days-grid {
    gap: 4px;
  }
  
  .calendar-day-cell {
    aspect-ratio: 1;
    padding: 4px 6px 14px;
    border-radius: 10px;
  }
  
  .day-cell-num {
    font-size: 18px;
  }
  
  .day-cell-greg {
    font-size: 9px;
  }

  .day-indicators {
    bottom: 4px;
    height: 4px;
  }

  .dot {
    width: 4px;
    height: 4px;
  }

  /* Prevent iOS Safari from auto-zooming on input focus (minimum 16px) */
  .form-input {
    font-size: 16px !important;
    padding: 12px;
  }

  .btn-primary {
    padding: 14px 20px;
    font-size: 15px;
  }

  /* Compact list card */
  .holidays-list-card {
    padding: 20px;
  }

  .holidays-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .holiday-item-card {
    padding: 12px;
  }

  .holiday-name {
    font-size: 14px;
  }

  .holiday-hijri-date {
    font-size: 11px;
  }

  .holiday-gregorian-date {
    font-size: 12px;
    padding: 4px 8px;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: 10px;
    gap: 12px;
  }

  .calendar-card {
    padding: 12px 8px;
  }

  .weekday-row span {
    font-size: 12px;
    letter-spacing: 0.5px;
  }

  .calendar-day-cell {
    padding: 2px 4px 12px;
  }

  .day-cell-num {
    font-size: 16px;
  }

  .day-cell-greg {
    display: none; /* Hide Gregorian date on extremely tiny viewports inside cells to maintain layout */
  }

  .day-indicators {
    bottom: 2px;
  }

  .legend {
    flex-wrap: wrap;
    gap: 8px;
  }

  .current-month-display {
    max-width: 150px;
  }

  .month-primary {
    font-size: 18px;
  }

  .month-arabic {
    font-size: 22px;
  }
  
  .month-arabic.english-sub {
    font-size: 16px;
  }
}

/* ==========================================================================
   Touch & Mobile Interaction Best Practices
   (this app is used primarily on phones)
   ========================================================================== */

html {
  /* Stop iOS/Android from inflating text on orientation change */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  /* Don't chain over-scroll to the page (no accidental pull-to-refresh in app) */
  overscroll-behavior-y: contain;
}

/* All interactive controls: remove the grey tap flash, kill the legacy 300ms
   tap delay, and prevent accidental text selection / long-press callouts. */
button,
select,
a,
.tab-btn,
.nav-btn,
.calendar-day-cell,
.holiday-item-card,
.lang-toggle {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Inputs still need normal text interaction */
input,
.form-input {
  -webkit-user-select: auto;
  user-select: auto;
  touch-action: manipulation;
}

/* Comfortable minimum touch targets (~44px per WCAG / iOS HIG) */
.nav-btn,
.tab-btn,
.btn-primary,
.btn-secondary,
.lang-toggle,
.form-input,
select.form-input {
  min-height: 44px;
}

/* On touch devices :hover is unreliable and can "stick" after a tap.
   Neutralize the hover lift effects there; :active provides feedback instead. */
@media (hover: none) {
  .calendar-day-cell:hover:not(.other-month),
  .holiday-item-card:hover,
  .btn-primary:hover,
  .nav-btn:hover {
    transform: none;
  }
}

/* Immediate, tactile press feedback for touch (and mouse) */
.calendar-day-cell:not(.other-month):active {
  transform: scale(0.96);
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.4);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.btn-secondary:active,
.tab-btn:active,
.lang-toggle:active {
  background: rgba(251, 191, 36, 0.18);
}

.nav-btn:active {
  background: rgba(251, 191, 36, 0.18);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

.holiday-item-card:active {
  transform: scale(0.98);
  background: rgba(251, 191, 36, 0.08);
}

/* Respect notch / rounded-corner safe areas (viewport-fit=cover) */
@supports (padding: max(0px)) {
  .app-container {
    padding-top: max(24px, env(safe-area-inset-top));
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 768px) {
  @supports (padding: max(0px)) {
    .app-container {
      padding-top: max(16px, env(safe-area-inset-top));
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
      padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
  }
}

/* Honor users who prefer reduced motion: drop the ambient animations */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .stars-container,
  .glow-orb,
  .logo-svg {
    animation: none !important;
  }
}

/* ==========================================================================
   Birthday Celebration Overlay (Easter Egg)
   ========================================================================== */

.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 38%, rgba(11, 19, 41, 0.92), rgba(3, 7, 18, 0.97));
  animation: celebFadeIn 0.4s ease both;
}

.celebration-overlay.closing {
  animation: celebFadeOut 0.4s ease forwards;
}

@keyframes celebFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes celebFadeOut { from { opacity: 1; } to { opacity: 0; } }

.celebration-overlay.closing .celebration-content {
  animation: celebPopOut 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes celebPopOut {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.85); opacity: 0; }
}

.fireworks-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.floating-emojis {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.floating-emoji {
  position: absolute;
  top: -48px;
  opacity: 0;
  animation-name: floatDown;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

@keyframes floatDown {
  0% { transform: translateY(-48px) rotate(0deg); opacity: 0; }
  10% { opacity: 0.95; }
  90% { opacity: 0.95; }
  100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

.celebration-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 28px 24px;
  max-width: 560px;
  animation: celebPop 0.6s cubic-bezier(0.18, 1.25, 0.4, 1) both;
}

@keyframes celebPop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.celebration-emoji {
  font-size: clamp(54px, 14vw, 78px);
  line-height: 1;
  animation: celebBounce 1.6s ease-in-out infinite;
}

@keyframes celebBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-14px) scale(1.08); }
}

.celebration-title {
  font-size: clamp(26px, 7vw, 38px);
  font-weight: 800;
  margin: 14px 0 10px;
  background: linear-gradient(135deg, #fbbf24, #ec4899, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: celebGlow 2s ease-in-out infinite;
}

@keyframes celebGlow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(236, 72, 153, 0.4)); }
  50% { filter: drop-shadow(0 0 22px rgba(251, 191, 36, 0.6)); }
}

.celebration-sub {
  font-size: clamp(15px, 4vw, 18px);
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 26px;
}

.celebration-close {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
  color: var(--text-dark);
  border: none;
  border-radius: 30px;
  padding: 13px 36px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans);
  box-shadow: 0 6px 22px rgba(251, 191, 36, 0.4);
  transition: var(--transition-smooth);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.celebration-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(251, 191, 36, 0.55);
}

.celebration-close:active {
  transform: scale(0.96);
}
