/* ============================================
   Booking Platform - Custom Styles
   Flexi Place 場地預約系統
   ============================================ */

:root {
  --brand-primary: #4F46E5;
  --brand-primary-light: #818CF8;
  --brand-primary-dark: #3730A3;
  --brand-accent: #F59E0B;
  --brand-success: #10B981;
  --brand-danger: #EF4444;
  --brand-warning: #F59E0B;
  --brand-surface: #FFFFFF;
  --brand-bg: #F8FAFC;
  --brand-border: #E2E8F0;
  --brand-text: #0F172A;
  --brand-text-muted: #64748B;
  --font-sans: 'Outfit', system-ui, -apple-system, sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-sans);
  background: var(--brand-bg);
  color: var(--brand-text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.animate-fade-up { animation: fadeInUp 0.5s ease-out forwards; }
.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }
.animate-scale-in { animation: scaleIn 0.3s ease-out forwards; }
.animate-slide-in { animation: slideInRight 0.4s ease-out forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Staggered children */
.stagger > * { animation: fadeInUp 0.5s ease-out forwards; opacity: 0; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }

/* ---- Gradient Utilities ---- */
.gradient-warm { background: linear-gradient(135deg, #fbbf24 0%, #fb923c 50%, #fb7185 100%); }
.gradient-vibrant { background: linear-gradient(135deg, #d946ef 0%, #ec4899 50%, #f43f5e 100%); }
.gradient-cool { background: linear-gradient(135deg, #22d3ee 0%, #60a5fa 50%, #6366f1 100%); }
.gradient-amber { background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 50%, #fb923c 100%); }
.gradient-sage { background: linear-gradient(135deg, #6ee7b7 0%, #34d399 50%, #14b8a6 100%); }
.gradient-rose { background: linear-gradient(135deg, #fda4af 0%, #f472b6 50%, #e879f9 100%); }
.gradient-coral { background: linear-gradient(135deg, #fb923c 0%, #f87171 50%, #ec4899 100%); }
.gradient-mint { background: linear-gradient(135deg, #5eead4 0%, #34d399 50%, #22c55e 100%); }
.gradient-sky { background: linear-gradient(135deg, #7dd3fc 0%, #60a5fa 50%, #6366f1 100%); }
.gradient-violet { background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #4f46e5 100%); }

/* ---- Glass Effect ---- */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-dark {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---- Card Hover ---- */
.card-hover {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
}

/* ---- Button Effects ---- */
.btn-press {
  transition: transform 0.1s ease;
}
.btn-press:active {
  transform: scale(0.96);
}

/* ---- Time Slot Grid ---- */
.time-slot {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  user-select: none;
  font-variant-numeric: tabular-nums;
}
.time-slot:hover:not(.disabled) {
  border-color: var(--brand-primary);
  background: rgba(79, 70, 229, 0.06);
}
.time-slot.selected {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.35);
}
.time-slot.selected:hover:not(.disabled) {
  background: #4338ca;
  color: white;
  border-color: var(--brand-primary);
}
.time-slot.disabled {
  cursor: not-allowed;
  background: #f8fafc;
  border-color: #e8edf3;
  color: #a3aebd;
}
.time-slot.disabled:hover {
  border-color: #e8edf3;
  background: #f8fafc;
}

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- Hide scrollbar for horizontal scroll ---- */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* ---- 可點擊橫向 tab 列：必須露出細滾動條（藏起來會讓溢出項點不到），
       滾輪橫滾由 JS 的 wheel 委託處理（.hscroll-tabs） ---- */
.hscroll-tabs { scrollbar-width: thin; }
.hscroll-tabs::-webkit-scrollbar { height: 6px; }
.hscroll-tabs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ---- Skeleton Loading ---- */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ---- Status Badges ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---- Mobile Bottom Nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--brand-border);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Page Transitions ---- */
.page-enter {
  animation: fadeInUp 0.4s ease-out forwards;
}

/* ---- Modal ---- */
.modal-overlay {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ---- Custom Checkbox ---- */
.custom-checkbox {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}
.custom-checkbox:checked {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}
.custom-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---- Admin Sidebar ---- */
.admin-sidebar-item {
  transition: all 0.2s ease;
}
.admin-sidebar-item.active {
  background: var(--brand-primary);
  color: white;
}
.admin-sidebar-item:not(.active):hover {
  background: #f1f5f9;
}

/* ---- Toast ---- */
.toast {
  animation: fadeInUp 0.3s ease-out forwards;
}

/* ---- Decorative Pattern ---- */
.dot-pattern {
  background-image: radial-gradient(circle, #e2e8f0 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
}
@media (min-width: 769px) {
  .mobile-only { display: none !important; }
}

/* ---- Focus States ---- */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ---- Loading Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
