/* ==========================================================================
   MATERIAL DESIGN COLOR PALETTES & THEME ENGINE
   ========================================================================== */

:root {
  /* Default: Emerald Green (Islamic & Egyptian Umrah Theme) */
  --primary: #059669;
  --primary-hover: #047857;
  --primary-active: #065f46;
  --primary-light: #ecfdf5;
  --primary-border: #a7f3d0;
  --primary-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --primary-shadow: rgba(5, 150, 105, 0.25);
  --accent: #10b981;

  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-header: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --card-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  --font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

/* Nile Teal */
[data-material-theme="teal"] {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-active: #115e59;
  --primary-light: #f0fdfa;
  --primary-border: #99f6e4;
  --primary-gradient: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  --primary-shadow: rgba(13, 148, 136, 0.25);
  --accent: #14b8a6;
}

/* Royal Indigo */
[data-material-theme="indigo"] {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-active: #3730a3;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --primary-shadow: rgba(79, 70, 229, 0.25);
  --accent: #6366f1;
}

/* Makkah Amber / Gold */
[data-material-theme="amber"] {
  --primary: #d97706;
  --primary-hover: #b45309;
  --primary-active: #92400e;
  --primary-light: #fffbeb;
  --primary-border: #fde68a;
  --primary-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  --primary-shadow: rgba(217, 119, 6, 0.25);
  --accent: #f59e0b;
}

/* Deep Purple */
[data-material-theme="purple"] {
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-active: #5b21b6;
  --primary-light: #f5f3ff;
  --primary-border: #ddd6fe;
  --primary-gradient: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
  --primary-shadow: rgba(124, 58, 237, 0.25);
  --accent: #8b5cf6;
}

/* Crimson Rose */
[data-material-theme="rose"] {
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-active: #9f1239;
  --primary-light: #fff1f2;
  --primary-border: #fecdd3;
  --primary-gradient: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
  --primary-shadow: rgba(225, 29, 72, 0.25);
  --accent: #f43f5e;
}

/* Ocean Blue */
[data-material-theme="blue"] {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  --primary-shadow: rgba(37, 99, 235, 0.25);
  --accent: #3b82f6;
}

/* Slate Modern */
[data-material-theme="slate"] {
  --primary: #475569;
  --primary-hover: #334155;
  --primary-active: #1e293b;
  --primary-light: #f8fafc;
  --primary-border: #cbd5e1;
  --primary-gradient: linear-gradient(135deg, #475569 0%, #64748b 100%);
  --primary-shadow: rgba(71, 85, 105, 0.25);
  --accent: #64748b;
}

/* ==========================================================================
   DARK MODE OVERRIDES
   ========================================================================== */
[data-theme-mode="dark"] {
  --bg-body: #0b0f19;
  --bg-card: #151d30;
  --bg-sidebar: #101626;
  --bg-header: #101626;
  --border-color: #242f47;
  --border-light: #1c253b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary-light: rgba(16, 185, 129, 0.12);
  --primary-border: rgba(16, 185, 129, 0.25);
  --card-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  --card-hover-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

[data-theme-mode="dark"][data-material-theme="teal"] { --primary-light: rgba(20, 184, 166, 0.12); --primary-border: rgba(20, 184, 166, 0.25); }
[data-theme-mode="dark"][data-material-theme="indigo"] { --primary-light: rgba(99, 102, 241, 0.12); --primary-border: rgba(99, 102, 241, 0.25); }
[data-theme-mode="dark"][data-material-theme="amber"] { --primary-light: rgba(245, 158, 11, 0.12); --primary-border: rgba(245, 158, 11, 0.25); }
[data-theme-mode="dark"][data-material-theme="purple"] { --primary-light: rgba(139, 92, 246, 0.12); --primary-border: rgba(139, 92, 246, 0.25); }
[data-theme-mode="dark"][data-material-theme="rose"] { --primary-light: rgba(244, 63, 94, 0.12); --primary-border: rgba(244, 63, 94, 0.25); }
[data-theme-mode="dark"][data-material-theme="blue"] { --primary-light: rgba(59, 130, 246, 0.12); --primary-border: rgba(59, 130, 246, 0.25); }
[data-theme-mode="dark"][data-material-theme="slate"] { --primary-light: rgba(100, 116, 139, 0.12); --primary-border: rgba(100, 116, 139, 0.25); }

/* Fonts */
[data-font="cairo"] { --font-family: 'Cairo', system-ui, sans-serif; }
[data-font="tajawal"] { --font-family: 'Tajawal', system-ui, sans-serif; }
[data-font="alexandria"] { --font-family: 'Alexandria', system-ui, sans-serif; }

/* Accessibility text-size scale — every Tailwind text/spacing utility here is
   rem-based, so scaling the root font-size scales the whole UI proportionally
   instead of needing per-component overrides. "normal" is the default 16px. */
html[data-font-size="large"] { font-size: 18px; }
html[data-font-size="xlarge"] { font-size: 20px; }

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-family);
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Utility Theme Classes */
.bg-primary-main { background-color: var(--primary) !important; }
.bg-primary-hover:hover { background-color: var(--primary-hover) !important; }
.bg-primary-gradient { background: var(--primary-gradient) !important; }
.bg-primary-light { background-color: var(--primary-light) !important; }
.text-primary-main { color: var(--primary) !important; }
.border-primary-main { border-color: var(--primary) !important; }
.border-primary-light { border-color: var(--primary-border) !important; }

.btn-primary-theme {
  background: var(--primary-gradient);
  color: #ffffff !important;
  border: none;
  box-shadow: 0 2px 8px var(--primary-shadow);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary-theme:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-shadow);
  opacity: 0.95;
}

/* ==========================================================================
   FLOATING GEAR BUTTON & SETTINGS BOX
   ========================================================================== */
.gear-button {
  position: fixed;
  top: 50%;
  inset-inline-end: 0;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: var(--primary-gradient);
  color: #ffffff;
  border-start-start-radius: 12px;
  border-end-start-radius: 12px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: -2px 4px 15px var(--primary-shadow);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gear-button:hover {
  width: 54px;
}

.gear-button i {
  font-size: 1.35rem;
  transition: transform 0.6s ease;
}

.gear-button:hover i {
  transform: rotate(90deg);
}

/* Settings Box Overlay & Drawer */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.settings-overlay.active {
  opacity: 1;
  visibility: visible;
}

.settings-box {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: -360px;
  width: 340px;
  max-width: 90vw;
  background: var(--bg-card);
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
  z-index: 10001;
  transition: inset-inline-end 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  border-inline-start: 1px solid var(--border-color);
}

.settings-box.active {
  inset-inline-end: 0;
}

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

.settings-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

/* Swatches */
.theme-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 10px;
}

.swatch-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 3px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}

.swatch-btn:hover {
  transform: scale(1.08);
}

.swatch-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--primary);
}

.swatch-btn.active::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.85rem;
}

/* Toggle Switch */
.mode-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: var(--bg-body);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-top: 10px;
}

.mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 9px;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s;
}

.mode-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.font-size-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: var(--bg-body);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-top: 10px;
}

.font-size-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border-radius: 9px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s;
}

.font-size-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

/* ======= ANIMATIONS & MICRO-INTERACTIONS ======= */

/* Fade Up — cards, content blocks on load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-up {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Scale Up — modals */
@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.93);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-up {
    animation: scaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Card hover lift */
.card-hover-lift {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
}
.card-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.1), 0 4px 8px -2px rgba(0, 0, 0, 0.06);
}

/* Pulse badge — for available seats indicator */
@keyframes pulseBadge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; transform: scale(1.05); }
}

.badge-pulse {
    animation: pulseBadge 2s ease-in-out infinite;
}

/* Shimmer loading skeleton */
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-card) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.75rem;
}

/* Progress bar smooth fill */
.progress-fill {
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar link hover slide (RTL-aware) */
.sidebar-link {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="rtl"] .sidebar-link:hover {
    transform: translateX(-3px);
}

[dir="ltr"] .sidebar-link:hover {
    transform: translateX(3px);
}

/* Flash message slide in */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flash-animate {
    animation: slideInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Button ripple effect */
.btn-primary-theme {
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary-theme:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--primary-shadow);
}

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

/* Status dot pulse */
@keyframes dotPulse {
    0% { box-shadow: 0 0 0 0 var(--primary-shadow); }
    70% { box-shadow: 0 0 0 6px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.status-dot-active {
    animation: dotPulse 2s infinite;
}

/* Table row hover */
table tr {
    transition: background-color 0.15s ease;
}

/* Modal backdrop blur transition */
.modal-backdrop {
    transition: opacity 0.2s ease;
}

/* Input focus animation */
input:focus, select:focus, textarea:focus {
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 0 3px var(--primary-shadow);
}

/* Stats card counter animation */
@keyframes countUp {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

.stat-number {
    animation: countUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Ferry section reveal */
@keyframes slideDown {
    from { opacity: 0; max-height: 0; overflow: hidden; }
    to   { opacity: 1; max-height: 500px; overflow: visible; }
}

.ferry-section-animate {
    animation: slideDown 0.35s ease forwards;
}

