/* ============================================================
   JustOneEvent — Design System
   A polished, modern event management platform.
   Complements Tailwind CDN with custom properties, animations,
   component classes and utility overrides.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
    /* Palette */
    --color-primary: #4f46e5;
    --color-primary-dark: #4338ca;
    --color-primary-light: #818cf8;
    --color-secondary: #7c3aed;
    --color-accent: #f59e0b;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;

    /* Surface */
    --surface-raised: rgba(255, 255, 255, 0.80);
    --surface-glass: rgba(255, 255, 255, 0.60);
    --backdrop-blur: 16px;

    /* Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-2xl: 1.5rem;

    /* Shadow */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px -8px rgba(0,0,0,0.10), 0 8px 16px -4px rgba(0,0,0,0.04);
    --shadow-glow: 0 0 20px rgba(79,70,229,0.15);

    /* Transitions */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
}

/* ---------- Global ---------- */
*,
*::before,
*::after {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8f9fc;
}

main {
    flex: 1;
}

::selection {
    background: rgba(79, 70, 229, 0.15);
    color: #312e81;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #a5b4fc; }

/* ---------- Navigation (glassmorphism) ---------- */
.nav-glass {
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.nav-link {
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--duration-normal) var(--ease-smooth);
    position: relative;
}

.nav-link:hover {
    background: rgba(79, 70, 229, 0.06);
    color: var(--color-primary);
}

.nav-link.active {
    background: var(--color-primary);
    color: white;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--duration-normal) var(--ease-smooth);
    cursor: pointer;
    border: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    box-shadow: var(--shadow-sm), 0 2px 8px rgba(79,70,229,0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    box-shadow: var(--shadow-md), 0 4px 12px rgba(79,70,229,0.30);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: white;
    box-shadow: var(--shadow-sm), 0 2px 8px rgba(239,68,68,0.25);
}
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), 0 4px 12px rgba(239,68,68,0.30);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: #6b7280;
}
.btn-ghost:hover {
    background: rgba(0,0,0,0.04);
    color: #374151;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-xl);
}

/* ---------- Cards ---------- */
.card {
    background: white;
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-normal) var(--ease-smooth);
}

.card-hover:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: rgba(79,70,229,0.12);
}

.card-event {
    overflow: hidden;
}

.card-event .card-image {
    height: 200px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    position: relative;
    overflow: hidden;
}

.card-event .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-slow) var(--ease-smooth);
}

.card-event:hover .card-image img {
    transform: scale(1.05);
}

/* ---------- Form inputs ---------- */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    transition: all var(--duration-normal) var(--ease-smooth);
    background: white;
    color: #1a1a2e;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}

.form-input::placeholder { color: #9ca3af; }

.form-input.error {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 4px rgba(239,68,68,0.06);
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.badge-free { background: #eef2ff; color: #4338ca; }
.badge-premium {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
    box-shadow: 0 1px 3px rgba(245,158,11,0.3);
}
.badge-published { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-draft { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.badge-confirmed { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-cancelled { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.badge-waitlisted { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---------- Dashboard sidebar ---------- */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: white;
    border-right: 1px solid #f0f0f5;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--duration-normal) var(--ease-smooth);
    text-decoration: none;
    border-radius: var(--radius-xl);
    margin: 0.125rem 0;
}

.sidebar-link:hover {
    background: #f0f0ff;
    color: var(--color-primary);
}

.sidebar-link.active {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}

/* ---------- Stat cards ---------- */
.stat-card {
    background: white;
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: var(--shadow-xs);
    transition: all var(--duration-normal) var(--ease-smooth);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: -0.02em;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* ---------- Tables ---------- */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 0.875rem 1.25rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    background: #fafafc;
    border-bottom: 1px solid #f0f0f5;
}

.data-table td {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    border-bottom: 1px solid #f8f8fb;
}

.data-table tbody tr {
    transition: background var(--duration-fast) var(--ease-smooth);
}

.data-table tbody tr:hover {
    background: #fafaff;
}

/* ---------- Hero section ---------- */
.hero-gradient {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 25%, #4f46e5 60%, #7c3aed 100%);
    position: relative;
    overflow: hidden;
}

.hero-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 20% 80%, rgba(124,58,237,0.25) 0%, transparent 70%),
        radial-gradient(ellipse 40% 60% at 80% 20%, rgba(99,102,241,0.20) 0%, transparent 70%);
    pointer-events: none;
}

/* Animated floating shapes in hero */
.hero-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;
    animation: heroFloat 20s ease-in-out infinite;
    pointer-events: none;
}

.hero-shape-1 {
    width: 400px; height: 400px;
    background: #818cf8;
    top: -10%; right: -5%;
    animation-delay: 0s;
}

.hero-shape-2 {
    width: 300px; height: 300px;
    background: #a78bfa;
    bottom: -10%; left: -5%;
    animation-delay: -7s;
}

.hero-shape-3 {
    width: 200px; height: 200px;
    background: #c4b5fd;
    top: 40%; left: 30%;
    animation-delay: -14s;
}

/* ---------- Pricing ---------- */
.pricing-card {
    background: white;
    border-radius: var(--radius-2xl);
    padding: 2.5rem;
    border: 2px solid #e5e7eb;
    position: relative;
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-smooth);
}

.pricing-card:hover { box-shadow: var(--shadow-lg); }

.pricing-card.featured {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.pricing-price {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #1a1a2e;
}

/* ---------- Flash messages ---------- */
.flash-message {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-xl);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    animation: flashSlideIn var(--duration-slow) var(--ease-spring);
    box-shadow: var(--shadow-md);
}

.flash-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flash-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.flash-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ---------- Toggle switch ---------- */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: var(--duration-normal) var(--ease-smooth);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--duration-normal) var(--ease-smooth);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ---------- HTMX indicators ---------- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }

/* ---------- QR Code ---------- */
.qr-code-container {
    display: flex;
    justify-content: center;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.qr-code-container img {
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
}

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    color: #9ca3af;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: #d1d5db;
}

/* ---------- Progress bars ---------- */
.progress-bar {
    height: 0.5rem;
    background: #f0f0f5;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width var(--duration-slow) var(--ease-smooth);
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
}

.progress-bar-fill.danger { background: linear-gradient(90deg, #ef4444, #f87171); }
.progress-bar-fill.warning { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

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

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

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

@keyframes heroFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 10px) scale(1.02); }
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

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

.fade-in { animation: fadeIn var(--duration-normal) var(--ease-smooth); }
.fade-in-up { animation: fadeInUp var(--duration-slow) var(--ease-smooth); }

/* Scroll-triggered animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--duration-slow) var(--ease-smooth),
                transform var(--duration-slow) var(--ease-smooth);
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity var(--duration-normal) var(--ease-smooth),
                transform var(--duration-normal) var(--ease-smooth);
}

.stagger-children.is-visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(2) { transition-delay: 80ms; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(3) { transition-delay: 160ms; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(4) { transition-delay: 240ms; opacity: 1; transform: translateY(0); }

/* Pulse dot (status indicators) */
.pulse-dot {
    animation: pulse-dot 2s ease-in-out infinite;
}

/* Loading shimmer */
.shimmer {
    background: linear-gradient(90deg, #f0f0f5 25%, #e5e5eb 50%, #f0f0f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* ---------- Delay helpers (scroll-reveal stagger) ---------- */
.delay-100 { transition-delay: 100ms; }
.delay-150 { transition-delay: 150ms; }
.delay-200 { transition-delay: 200ms; }
.delay-250 { transition-delay: 250ms; }
.delay-300 { transition-delay: 300ms; }
.delay-350 { transition-delay: 350ms; }

/* ---------- Filter pills ---------- */
.filter-pill-active {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 1px 6px 0 rgba(79,70,229,.25);
}

/* ---------- Event card image zoom ---------- */
.event-card-img {
    transition: transform var(--duration-slow) var(--ease-smooth);
}
.group:hover .event-card-img {
    transform: scale(1.06);
}

/* ---------- Gradient placeholder pattern ---------- */
.placeholder-pattern {
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,.12) 0%, transparent 50%);
}

/* ---------- Event detail: sidebar card ---------- */
.sidebar-card {
    box-shadow: 0 1px 3px 0 rgba(0,0,0,.06), 0 4px 16px 0 rgba(79,70,229,.06);
}
.sidebar-card:hover {
    box-shadow: 0 4px 20px 0 rgba(79,70,229,.12);
}

/* ---------- Event detail: banner pattern ---------- */
.banner-pattern {
    background-image:
        radial-gradient(ellipse at 30% 70%, rgba(255,255,255,.10) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(255,255,255,.08) 0%, transparent 50%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 40px,
            rgba(255,255,255,.02) 40px,
            rgba(255,255,255,.02) 80px
        );
}

/* ---------- Event detail: description prose ---------- */
.event-description p {
    margin-bottom: 1.25rem;
    color: #4b5563;
    line-height: 1.8;
    font-size: 1rem;
}
.event-description p:last-child {
    margin-bottom: 0;
}

/* ---------- Meta chip badges ---------- */
.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        min-height: auto;
    }

    .pricing-card.featured {
        transform: none;
    }
}

/* ---------- Focus ring for accessibility ---------- */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

/* ---------- Smooth image loading ---------- */
img {
    opacity: 1;
    transition: opacity var(--duration-normal) var(--ease-smooth);
}

img[loading] {
    opacity: 0;
}

/* ---------- Reduced motion for accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
    }
    .stagger-children > * {
        opacity: 1 !important;
        transform: none !important;
    }
}
