@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   1. CORE VARIABLES & RESETS
   ========================================================================== */
:root {
    /* DUK Premium Tech Palette */
    --bg-main: #09090b; /* Zinc 950 */
    --surface: #18181b; /* Zinc 900 */
    --surface-hover: #27272a;
    --border-light: rgba(255, 255, 255, 0.08);
    --border-focus: #06b6d4; /* Cyan 500 */
    
    /* Gradients */
    --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    --brand-gradient-hover: linear-gradient(135deg, #4338ca 0%, #0891b2 100%);
    --brand-accent: #06b6d4;
    
    /* Text */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Status Colors */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", sans-serif; }

/* Global Scrollbar Hiding */
html, body { max-width: 100%; overflow-x: hidden; scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.015em;
    min-height: 100vh;
    display: flex; flex-direction: column;
}

/* Dynamic Body Padding based on Header */
body.public-layout { padding-top: 80px; }
body.admin-layout { padding-top: 85px; }
@media (max-width: 768px) { body.admin-layout { padding-top: 115px; } }


/* ==========================================================================
   2. GLOBAL LAYOUT CONTAINERS
   ========================================================================== */
.app-container {
    width: 100%; max-width: 480px; margin: 0 auto; padding: 0 20px;
    flex-grow: 1; display: flex; flex-direction: column; justify-content: center;
}

.dashboard-container {
    width: 100%; max-width: 1200px; margin: 30px auto; padding: 0 20px;
    animation: fadeIn 0.4s ease;
}


/* ==========================================================================
   3. NAVIGATION (PUBLIC & ADMIN)
   ========================================================================== */
.premium-nav, .staff-nav {
    position: fixed; top: 0; left: 0; width: 100%;
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border-light); z-index: 1000;
}

.premium-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 5%; background: rgba(9, 9, 11, 0.75);
}

.staff-nav {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    padding: 12px 5%; background: rgba(9, 9, 11, 0.85); 
}

/* Nav Brands & Items */
.nav-brand { display: flex; align-items: center; gap: 12px; color: #f8fafc; font-size: 16px; font-weight: 700; text-decoration: none; }
.nav-brand img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.nav-brand .brand-text { display: flex; flex-direction: column; }
.nav-brand .brand-sub { font-size: 10px; color: var(--border-focus); font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }

.nav-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; order: 1; }
.nav-exit { flex-shrink: 0; order: 3; }
.nav-menu-wrapper {
    display: flex; align-items: center; gap: 16px; flex-grow: 1; 
    justify-content: flex-end; overflow-x: auto; padding-right: 20px; order: 2;
}

/* Nav Buttons & Links */
.nav-official-btn {
    display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.05); color: #f8fafc; text-decoration: none;
    padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; border: 1px solid rgba(255, 255, 255, 0.1); transition: all 0.3s ease;
}
.nav-official-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); transform: translateY(-1px); }

.nav-link { color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 600; transition: all 0.2s; white-space: nowrap; padding: 4px 2px; }
.nav-link:hover { color: #fff; }
.nav-link.active { color: #fff; position: relative; }
.nav-link.active::after {
    content: ''; position: absolute; bottom: -6px; left: 0; width: 100%; height: 2px;
    background: var(--brand-gradient); border-radius: 2px; box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
}

.logout-btn { 
    color: var(--error); font-weight: 600; text-decoration: none; font-size: 13px; 
    display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; 
    background: rgba(239, 68, 68, 0.1); transition: all 0.2s;
}
.logout-btn:hover { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

@media (max-width: 768px) {
    .staff-nav { padding: 12px 20px 0; }
    .hide-mobile-name { display: none; }
    .nav-exit { order: 2; margin-bottom: 12px; }
    .nav-menu-wrapper { 
        width: 100%; order: 3; justify-content: flex-start; 
        padding-right: 0; padding-bottom: 12px; border-top: 1px solid var(--border-light); padding-top: 12px;
    }
}


/* ==========================================================================
   4. FORMS, INPUTS & BUTTONS
   ========================================================================== */
.form-wrapper { background: var(--surface); border: 1px solid var(--border-light); border-radius: 20px; padding: 32px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.form-group { margin-bottom: 20px; text-align: left; }
.form-label { display: block; color: var(--text-muted); font-size: 13px; font-weight: 500; margin-bottom: 8px; }

.premium-input, .premium-select {
    width: 100%; padding: 14px 16px; background: rgba(0,0,0,0.3); border: 1px solid var(--border-light);
    border-radius: 12px; color: var(--text-main); font-size: 15px; outline: none; transition: all 0.3s ease;
}
.premium-input:focus, .premium-select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15); background: rgba(0,0,0,0.5); }
.premium-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
.premium-select option { background: var(--surface); color: var(--text-main); }

/* Email Domain Wrapper */

/* Buttons */
.btn-premium {
    width: 100%; background: var(--brand-gradient); color: #fff; border: none; padding: 16px; border-radius: 14px;
    font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; display: flex; justify-content: center; align-items: center; gap: 8px;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.2);
}
.btn-premium:hover { transform: translateY(-2px); box-shadow: 0 15px 25px rgba(79, 70, 229, 0.3); background: var(--brand-gradient-hover); }
.btn-premium:active { transform: translateY(0); }
.btn-premium:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary { background: rgba(255,255,255,0.05); color: var(--text-main); box-shadow: none; border: 1px solid var(--border-light); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); box-shadow: none; }

.btn-action { background: transparent; border: 1px solid var(--border-light); color: #f4f4f5; padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; margin-right: 6px; }
.btn-action:hover { background: #27272a; }
.btn-suspend:hover { background: rgba(239, 68, 68, 0.1); color: var(--error); border-color: var(--error); }
.btn-restore:hover { background: rgba(16, 185, 129, 0.1); color: var(--success); border-color: var(--success); }


/* ==========================================================================
   5. MODALS & TOAST NOTIFICATIONS
   ========================================================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.duk-toast {
    background: var(--surface); border-left: 4px solid var(--brand-accent); color: #fff; padding: 16px 20px; border-radius: 12px; font-size: 14px; font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 1px solid var(--border-light); display: flex; align-items: center; gap: 12px;
    transform: translateX(120%); opacity: 0; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.duk-toast.show { transform: translateX(0); opacity: 1; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--error); }


/* ==========================================================================
   6. PUBLIC UI (HERO, LOGIN, COUPON)
   ========================================================================== */
.hero-container { text-align: center; padding: 50px 0; position: relative; z-index: 1; }
.hero-bg-grid {
    position: absolute; top: -50px; left: 50%; transform: translateX(-50%); width: 100vw; height: 100%; z-index: -1; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 30px 30px; mask-image: radial-gradient(circle, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 70%); -webkit-mask-image: radial-gradient(circle, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 70%);
}
.logo-wrapper { display: inline-block; padding: 20px; border-radius: 50%; position: relative; animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.logo-wrapper img { width: 110px; }
.pre-title { color: var(--border-focus); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 12px; animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.hero-title { font-size: 42px; font-weight: 800; letter-spacing: -1px; margin-bottom: 16px; line-height: 1.1; animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.hero-title span { background: var(--brand-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-subtitle { color: var(--text-muted); font-size: 15px; max-width: 340px; margin: 0 auto 36px; line-height: 1.6; animation: fadeUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.btn-hero { animation: pulseGlow 3s infinite, fadeUp 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; font-size: 16px; padding: 18px 32px; opacity: 0; box-shadow: 0 10px 30px rgba(6, 182, 212, 0.3); }

.event-card {
    margin: 40px auto 0; max-width: 360px; text-align: left; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-light);
    border-radius: 20px; padding: 16px; display: flex; align-items: center; gap: 16px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    animation: fadeUp 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; transition: transform 0.3s ease, border-color 0.3s ease;
}
.event-card:hover { transform: translateY(-3px); border-color: rgba(6, 182, 212, 0.3); }
.event-icon { width: 50px; height: 50px; flex-shrink: 0; background: var(--brand-gradient); border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; }
.event-info { display: flex; align-items: center; height: 100%; }
.event-info p { color: var(--text-muted); font-size: 13px; line-height: 1.5; font-weight: 500; margin: 0; }

.login-wrapper { background: #18181b; border: 1px solid #27272a; border-radius: 20px; padding: 44px 32px; width: 100%; max-width: 420px; text-align: center; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7); margin: 80px auto 20px auto; }
.gateway-badge { background: rgba(228, 228, 231, 0.05); color: #a1a1aa; border: 1px solid #27272a; padding: 6px 14px; border-radius: 9999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; display: inline-block; margin-bottom: 24px; }

.coupon-wrapper { background: #18181b; border: 1px solid var(--border-light); border-radius: 24px; padding: 32px; text-align: center; position: relative; overflow: hidden; margin-bottom: 24px; }
.coupon-header h2 { font-weight: 800; font-size: 20px; letter-spacing: -0.5px; background: var(--brand-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 4px; }

.pwa-install-btn {
    display: none; align-items: center; justify-content: center; gap: 8px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-light);
    color: #fff; font-size: 13px; font-weight: 600; padding: 10px 20px; border-radius: 20px; margin: 0 auto 24px; cursor: pointer; transition: all 0.3s ease; max-width: 200px;
}
.pwa-install-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--border-focus); box-shadow: 0 0 15px rgba(6, 182, 212, 0.2); transform: translateY(-2px); }


/* ==========================================================================
   7. ADMIN DASHBOARDS & DATA TABLES
   ========================================================================== */
.header-flex { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 15px; margin-bottom: 24px; }
.action-group { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Filter Bars */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 16px; background: var(--surface); padding: 16px; border-radius: 16px; border: 1px solid var(--border-light); }
@media (max-width: 768px) { .filter-bar { grid-template-columns: 1fr; } }

/* Universal Data Table */
.data-table-wrapper { background: var(--surface); border-radius: 20px; border: 1px solid var(--border-light); overflow-x: auto; }
.data-table { width: 100%; min-width: 800px; border-collapse: collapse; text-align: left; }
.data-table th { background: rgba(0,0,0,0.3); color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; padding: 16px 20px; border-bottom: 1px solid var(--border-light); }
.data-table td { padding: 16px 20px; border-bottom: 1px solid var(--border-light); color: var(--text-main); font-size: 14px; }
.record-count { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 10px; text-align: right; }

/* System Badges */
.staff-badge, .role-badge { padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; border: 1px solid transparent; display: inline-block; }
.role-super { background: rgba(6, 182, 212, 0.15); color: #06b6d4; border-color: rgba(6, 182, 212, 0.3); }
.role-admin { background: rgba(255, 149, 0, 0.15); color: #FF9500; border-color: rgba(255, 149, 0, 0.3); }
.role-official { background: rgba(16, 185, 129, 0.15); color: var(--success); border-color: rgba(16, 185, 129, 0.3); }

.status-badge { font-size: 11px; font-weight: 800; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; }
.status-active { color: var(--success); background: rgba(16, 185, 129, 0.1); }
.status-suspended { color: var(--error); background: rgba(239, 68, 68, 0.1); }
.row-suspended { opacity: 0.6; }

.diet-badge { display: inline-block; padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; margin-top: 12px; }
.diet-veg { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.diet-nonveg { background: rgba(239, 68, 68, 0.1); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }

/* Dashboard Metrics Grid */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px; }
.metric-card { background: var(--surface); padding: 24px; border-radius: 16px; border: 1px solid var(--border-light); position: relative; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.2); transition: border-color 0.3s; }
.metric-card:hover { border-color: rgba(255,255,255,0.2); }
.metric-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.metric-title { color: var(--text-muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.metric-icon { color: var(--border-focus); opacity: 0.8; }
.metric-value { font-size: 36px; font-weight: 800; color: #fff; line-height: 1; margin-bottom: 8px; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.metric-subtext { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.highlight-green { color: var(--success); }
.highlight-red { color: var(--error); }

.progress-track { width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--success); border-radius: 4px; transition: width 1s ease-out; }

.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 768px) { .details-grid { grid-template-columns: 1fr; } }
.list-card { background: var(--surface); border: 1px solid var(--border-light); border-radius: 16px; padding: 24px; }
.list-card h3 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 16px; border-bottom: 1px solid var(--border-light); padding-bottom: 12px; }
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.list-label { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.list-value { font-size: 15px; color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }


/* ==========================================================================
   8. SCANNER UI (OFFICIAL PORTAL)
   ========================================================================== */
.scanner-page-container { max-width: 500px; margin: 20px auto 40px; padding: 0 20px; animation: fadeIn 0.4s ease; text-align: center; }
.scanner-wrapper { width: 100%; background: var(--surface); border-radius: 32px; padding: 16px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); border: 1px solid var(--border-light); margin-top: 20px; position: relative; overflow: hidden; }
#reader { border: none !important; border-radius: 24px; overflow: hidden; background: #000; width: 100%; }
#reader video { object-fit: cover !important; border-radius: 24px !important; width: 100% !important; }
#reader__dashboard_section_csr span { display: none !important; }
#reader__dashboard_section_swaplink { text-decoration: none !important; color: var(--border-focus) !important; font-weight: 600; margin-top: 10px; display: inline-block; }
#reader__dashboard_section_csr button { background: var(--brand-gradient) !important; color: #fff !important; border: none !important; padding: 14px 24px !important; border-radius: 14px !important; margin: 10px 0 !important; font-weight: 600 !important; cursor: pointer; }

.result-card { display: none; width: 100%; margin: 20px auto 0; background: var(--surface); border-radius: 32px; padding: 40px 30px; text-align: center; border: 1px solid var(--border-light); box-shadow: 0 20px 40px rgba(0,0,0,0.4); animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.status-icon { width: 80px; height: 80px; margin: 0 auto 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; animation: popIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.status-success { background: rgba(16, 185, 129, 0.15); color: var(--success); box-shadow: 0 0 30px rgba(16, 185, 129, 0.2); }
.status-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); box-shadow: 0 0 30px rgba(245, 158, 11, 0.2); }
.status-error { background: rgba(239, 68, 68, 0.15); color: var(--error); box-shadow: 0 0 30px rgba(239, 68, 68, 0.2); }
.result-title { font-size: 24px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.5px; }
.scan-counter-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(6, 182, 212, 0.15); border: 1px solid rgba(6, 182, 212, 0.3); color: var(--border-focus); padding: 8px 16px; border-radius: 20px; font-size: 14px; font-weight: 700; margin-top: 10px; margin-bottom: 15px; }


/* ==========================================================================
   9. ANIMATIONS
   ========================================================================== */
.spinner { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff; animation: spin 1s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); } 70% { box-shadow: 0 0 0 20px rgba(6, 182, 212, 0); } 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); } 70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Footer Link Styles */
.footer-brand { color: #ffffff; text-decoration: none; font-weight: 700; transition: all 0.2s ease; }
.footer-brand:hover { color: #fff; text-shadow: 0 0 8px rgba(6, 182, 212, 0.6); }
.footer-support { color: var(--text-muted); text-decoration: none; border-bottom: 1px dashed rgba(255,255,255,0.2); transition: all 0.2s ease; }
.footer-support:hover { color: #fff; border-bottom-color: #fff; }