/* ==========================================================
   CHAYAM 2026 - ULTRA MODERN MOBILE-FIRST DESIGN SYSTEM
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #e0e7ff;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;

    --bg-main: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.95);
    --card-border: rgba(226, 232, 240, 0.8);

    --gradient-hero: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
    --gradient-card: linear-gradient(145deg, #ffffff, #f8fafc);
    --gradient-button: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    --gradient-badge: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));

    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 10px 25px -5px rgba(99, 102, 241, 0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    --shadow-lg: 0 25px 50px -12px rgba(99, 102, 241, 0.25);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.4);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Mobile spacings */
    --space-section: 1.25rem;
    --space-body: 1rem;
    --header-padding: 1.5rem 1rem;
    --sidebar-width: 260px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: #1e293b;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-size: 15px;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6, .brand-font {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* =====================================================
   UTILITY HELPERS
   ===================================================== */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }

/* =====================================================
   PUBLIC PORTAL — HERO WRAPPER & CARD
   ===================================================== */
.hero-wrapper {
    background: var(--gradient-hero);
    min-height: 100vh;
    padding: 1.25rem 0.75rem;
    position: relative;
}

.hero-wrapper::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 60%),
                radial-gradient(circle at 80% 70%, rgba(236,72,153,0.18) 0%, transparent 60%);
    pointer-events: none;
}

.reg-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 920px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* =====================================================
   REGISTRATION HEADER
   ===================================================== */
.reg-header {
    background: var(--gradient-hero);
    color: white;
    padding: var(--header-padding);
    text-align: center;
    position: relative;
}

.reg-header .title {
    font-size: clamp(1.5rem, 5vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
    line-height: 1.2;
}

.reg-header .subtitle {
    font-size: clamp(0.875rem, 3vw, 1.05rem);
    opacity: 0.92;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.price-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 0.45rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    white-space: nowrap;
}

/* =====================================================
   PROGRESS BAR
   ===================================================== */
.progress-track {
    height: 6px;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-button);
    transition: width 0.4s ease;
}

/* =====================================================
   REGISTRATION BODY
   ===================================================== */
.reg-body {
    padding: var(--space-body) var(--space-body);
}

.section-box {
    background: var(--gradient-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-section);
    margin-bottom: 1.25rem;
    transition: var(--transition);
}

.section-box:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-md);
}

.section-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}

.section-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gradient-hero);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.form-label-custom {
    font-weight: 600;
    font-size: 0.8rem;
    color: #334155;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.form-control-custom, .form-select-custom {
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    background-color: white;
    font-size: 1rem; /* 16px prevents iOS zoom-in on focus */
    color: #1e293b;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-control-custom:focus, .form-select-custom:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.btn-primary-gradient {
    background: var(--gradient-button);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.95rem 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    touch-action: manipulation;
    min-height: 48px; /* accessible touch target */
}

.btn-primary-gradient:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5);
    color: white;
}

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

.btn-primary-gradient:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* =====================================================
   RECEIPT & SUCCESS PAGE
   ===================================================== */
.receipt-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 780px;
    margin: 1rem auto;
    overflow: hidden;
    border: 2px dashed #cbd5e1;
}

.receipt-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1.75rem 1.25rem;
    text-align: center;
}

.receipt-code-badge {
    background: white;
    color: #059669;
    padding: 0.4rem 1.25rem;
    border-radius: 50px;
    font-size: clamp(1rem, 4vw, 1.25rem);
    font-weight: 800;
    display: inline-block;
    margin-top: 0.75rem;
    box-shadow: var(--shadow-md);
    word-break: break-all;
}

.receipt-body {
    padding: 1.25rem;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f5f9;
    gap: 0.5rem;
}

.receipt-row:last-child { border-bottom: none; }

.receipt-label {
    color: #64748b;
    font-weight: 500;
    font-size: 0.85rem;
    flex-shrink: 0;
    max-width: 50%;
}

.receipt-value {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.9rem;
    text-align: right;
    word-break: break-word;
}

/* =====================================================
   ADMIN LAYOUT — MOBILE-FIRST RESPONSIVE SIDEBAR
   ===================================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background-color: #f1f5f9;
    position: relative;
}

/* Mobile overlay backdrop */
.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    backdrop-filter: blur(2px);
}

.admin-sidebar-backdrop.open {
    display: block;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid #1e293b;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-brand {
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid #1e293b;
}

.admin-brand h2 {
    color: white;
    font-size: 1.2rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.admin-nav {
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
    overflow-y: auto;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: #94a3b8;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    min-height: 44px;
}

.admin-nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;
}

.admin-nav-item.active {
    background: var(--gradient-button);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Admin main content area */
.admin-content {
    flex-grow: 1;
    padding: 1.25rem 1rem;
    overflow-y: auto;
    min-width: 0; /* prevent flex overflow */
}

/* Admin topbar */
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

/* Mobile hamburger toggle */
.admin-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 300;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--gradient-button);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

/* =====================================================
   KPI CARDS
   ===================================================== */
.kpi-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
}

.kpi-primary::before { background: var(--primary); }
.kpi-success::before { background: var(--success); }
.kpi-warning::before { background: var(--warning); }
.kpi-danger::before { background: var(--danger); }
.kpi-info::before { background: var(--info); }

.kpi-val {
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    margin: 0.4rem 0 0.2rem;
}

.kpi-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =====================================================
   STATUS BADGES
   ===================================================== */
.badge-status {
    padding: 0.3rem 0.7rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.badge-completed { background-color: var(--success-light); color: #047857; }
.badge-pending   { background-color: var(--warning-light); color: #b45309; }
.badge-failed    { background-color: var(--danger-light);  color: #b91c1c; }
.badge-refunded  { background-color: #f3e8ff; color: #6b21a8; }

/* =====================================================
   TABLES — HORIZONTAL SCROLL ON MOBILE
   ===================================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    min-width: 600px;
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
    body * { visibility: hidden; }
    #printableReceipt, #printableReceipt * { visibility: visible; }
    #printableReceipt {
        position: absolute;
        left: 0; top: 0;
        width: 100%;
        box-shadow: none;
        border: none;
    }
    .no-print { display: none !important; }
}

/* =====================================================
   RESPONSIVE BREAKPOINTS
   ===================================================== */

/* ── Small phones (< 480px) ── */
@media (max-width: 479px) {
    .hero-wrapper {
        padding: 0.75rem 0.5rem;
    }

    .reg-header {
        padding: 1.25rem 0.875rem;
    }

    .reg-header .title {
        font-size: 1.4rem;
    }

    .reg-header .subtitle {
        font-size: 0.82rem;
    }

    .price-pill {
        font-size: 0.8rem;
        padding: 0.35rem 0.75rem;
    }

    .reg-body {
        padding: 0.875rem 0.75rem;
    }

    .section-box {
        padding: 1rem 0.875rem;
        margin-bottom: 1rem;
    }

    .receipt-row {
        flex-direction: column;
        gap: 0.15rem;
    }

    .receipt-label {
        max-width: 100%;
    }

    .receipt-value {
        text-align: left;
    }

    .kpi-val {
        font-size: 1.5rem;
    }
}

/* ── Phones (480px – 767px) ── */
@media (max-width: 767px) {
    :root {
        --space-section: 1rem;
        --space-body: 0.875rem;
        --header-padding: 1.5rem 1rem;
    }

    /* Sidebar hides off-screen on mobile */
    .admin-sidebar {
        position: fixed;
        left: 0; top: 0;
        height: 100vh;
        transform: translateX(-100%);
    }

    .admin-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }

    /* Show floating toggle button */
    .admin-mobile-toggle {
        display: flex;
    }

    /* Content takes full width */
    .admin-content {
        padding: 1rem 0.75rem;
        padding-bottom: 5rem; /* clear floating button */
    }

    .admin-topbar {
        margin-bottom: 1rem;
    }

    /* KPI grid goes 2-up on small screens */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .kpi-val {
        font-size: 1.5rem;
    }

    /* Receipt on mobile */
    .receipt-card {
        margin: 0.5rem;
        border-radius: var(--radius-lg);
    }

    .receipt-body {
        padding: 1rem 0.875rem;
    }

    .receipt-header {
        padding: 1.25rem 1rem;
    }

    /* Buttons full-width on mobile */
    .btn-primary-gradient {
        width: 100%;
        justify-content: center;
    }

    /* Admin topbar stacks vertically */
    .admin-topbar {
        flex-direction: column;
    }
}

/* ── Tablets (768px – 1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        --sidebar-width: 220px;
        --space-body: 1.25rem;
    }

    .reg-header {
        padding: 2rem 1.5rem;
    }

    .reg-body {
        padding: 1.5rem 1.25rem;
    }

    .section-box {
        padding: 1.35rem;
    }

    .admin-content {
        padding: 1.5rem 1.25rem;
    }
}

/* ── Desktop (≥ 1024px) ── */
@media (min-width: 1024px) {
    :root {
        --space-section: 1.75rem;
        --space-body: 2.5rem 2rem;
        --header-padding: 2.75rem 2rem;
    }

    .hero-wrapper {
        padding: 2.5rem 1rem;
    }

    .admin-content {
        padding: 2rem;
    }
}
