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

:root {
    --primary: #ea580c;
    --primary-hover: #c2410c;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --bg-light: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-hover: 0 25px 30px -5px rgba(0, 0, 0, 0.08), 0 10px 15px -3px rgba(0, 0, 0, 0.02);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-light);
    background-image: 
        radial-gradient(at 0% 0%, hsla(24,90%,50%,0.03) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(35,90%,50%,0.03) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(15,90%,50%,0.03) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

button, a, input, select, textarea, label, .switch, .slider {
    outline: none !important;
}
button:focus, a:focus, input[type="checkbox"]:focus, label:focus, .switch:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ================== LOGIN ================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f8fafc;
    position: relative;
    overflow: hidden;
    padding-left: 0 !important;
}

.mesh-bg {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(234, 88, 12, 0.12), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(217, 119, 6, 0.12), transparent 25%),
                radial-gradient(circle at 50% 80%, rgba(249, 115, 22, 0.12), transparent 25%);
    filter: blur(80px); opacity: 0.8;
}

.login-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 380px;
    color: white;
}
.login-card h2 { margin-top: 0; text-align: center; color: white; font-weight: 800;}
.login-card label { display: block; font-size: 0.85rem; color: #cbd5e1; margin-bottom: 6px; font-weight: 500;}

.premium-input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.premium-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.btn-premium {
    width: 100%; margin-top: 10px; padding: 14px; font-size: 1.05rem; border-radius: var(--radius-md); 
    background: #fff; color: #000; border: none; box-shadow: var(--shadow-md); 
    cursor: pointer; font-weight: 600; transition: all 0.2s ease;
}
.btn-premium:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
    background: #f9fafb;
}

.error-msg { background: #fee2e2; color: #b91c1c; padding: 12px; border-radius: var(--radius-md); font-size: 0.9rem; text-align: center; font-weight: 500;}
.logo-container { text-align: center; margin-bottom: 24px; }
.logo { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; color: white; }
.logo .logo-animated {
    background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6, #60a5fa);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: logoShift 4s linear infinite;
}
@keyframes logoShift {
    0%   { background-position: 0% center; }
    100% { background-position: 300% center; }
}
.reveal { opacity: 0; transform: translateY(30px); transition: all 0.8s cubic-bezier(0.5, 0, 0, 1); }

/* ================== NAV & LAYOUT ================== */
body {
    padding-left: 260px; /* Default desktop padding */
}

/* iOS Bottom Tab Bar (Hidden on Desktop) */
.ios-tab-bar {
    display: none;
}

/* Desktop Sidebar */
.desktop-sidebar {
    background: #ffffff;
    border-right: 1px solid var(--border);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 260px;
    z-index: 50;
    box-shadow: 1px 0 10px rgba(0,0,0,0.02);
    box-sizing: border-box;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}
.desktop-sidebar::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}
.nav-brand { font-weight: 800; font-size: 1.4rem; color: #0f172a; display: flex; align-items: center; gap: 8px; margin-bottom: 30px;}
.nav-brand .logo-animated { font-size: 1.5rem; }

.nav-links { 
    display: flex; 
    flex-direction: column;
    gap: 6px; 
    width: 100%;
    height: 100%;
}
.nav-links a {
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-links a:hover { color: #000; background: #f8fafc; transform: translateX(4px); }
.nav-links a.active { color: #000; background: #f1f5f9; font-weight: 700; box-shadow: inset 3px 0 0 #000;}

@media (max-width: 768px) {
    .form-row { margin-bottom: 12px !important; gap: 12px !important; }
    .form-group { margin-bottom: 12px !important; }
    .form-label { font-size: 0.8rem !important; margin-bottom: 4px !important; }

    body { padding-left: 0; padding-bottom: 140px; } /* Safe area for bottom bar */
    
    .desktop-sidebar {
        display: none;
    }
    
    .ios-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 74px; padding-top: 6px;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(0,0,0,0.08);
        z-index: 9999;
        justify-content: space-around;
        align-items: flex-start;
        padding-top: 10px;
        padding-bottom: env(safe-area-inset-bottom, 20px); /* iPhone notch support */
        box-shadow: 0 -4px 20px rgba(0,0,0,0.04);
    }
    
    .ios-tab-bar .tab-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #64748b; /* Darker default color */
        width: 60px;
        transition: all 0.2s ease;
    }
    
    .ios-tab-bar .tab-item svg {
        width: 24px;
        height: 24px;
        margin-bottom: 4px;
        stroke-width: 2.5; /* Thicker, more striking stroke */
        transition: all 0.2s ease;
    }
    
    .ios-tab-bar .tab-item span {
        font-size: 0.65rem;
        font-weight: 700; /* Bolder text */
        letter-spacing: 0.2px;
    }
    
    .ios-tab-bar .tab-item.active {
        color: var(--primary); /* Use primary color (orange) for active state */
    }
    
    .ios-tab-bar .tab-item.active svg {
        stroke-width: 2.5;
    }
}

.admin-container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

/* ================== FORMS & SPACING ================== */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}
.form-label, label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px; /* Ensure space between label and input */
}
.form-group {
    margin-bottom: 20px;
}

/* ================== BUTTONS ================== */
.btn {
    padding: 10px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}
.btn:hover { 
    background: #f8fafc; 
    border-color: #cbd5e1; 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03); 
    transform: translateY(-1px); 
}
.btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-primary { 
    background: linear-gradient(180deg, #111827 0%, #000000 100%);
    color: white; 
    border: 1px solid #000000;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover { 
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    border-color: #111827; 
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: var(--success-hover); color: white; }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); color: white; }

.btn-small { padding: 6px 12px; font-size: 0.85rem; }

/* ================== INPUTS ================== */
input[type="text"], input[type="number"], input[type="time"], input[type="email"], input[type="password"], select, textarea, .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    color: #0f172a;
    background-color: #f8fafc;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}
input:hover, select:hover, textarea:hover, .form-input:hover {
    border-color: #cbd5e1;
    background-color: #ffffff;
}
input:focus, select:focus, textarea:focus, .form-input:focus {
    outline: none !important;
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.1), inset 0 1px 2px rgba(0,0,0,0.02);
}

/* ================== CARDS & PANELS ================== */
.panel-card, .toggle-card, .config-card, .category-block, .marketing-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.panel-card:hover, .toggle-card:hover, .category-block:hover, .marketing-card:hover { 
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

/* ================== MODERN iOS-STYLE TOGGLE ================== */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { 
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; 
    background-color: #e5e7eb; transition: .3s ease; border-radius: 34px; 
}
.slider:before { 
    position: absolute; content: ""; height: 22px; width: 22px; 
    left: 2px; bottom: 2px; background-color: white; transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1); 
    border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.15); 
}
input:checked + .slider { background-color: #34c759; }
input:checked + .slider:before { transform: translateX(22px); }
input:focus + .slider { box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.2); }



/* ================== DASHBOARD STATS ================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 40px; }
.stat-card {
    background: var(--card-bg); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 24px; text-align: left;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.stat-icon { font-size: 1.6rem; margin-bottom: 12px; background: #f3f4f6; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.stat-value { font-size: 2.2rem; font-weight: 800; color: var(--text-main); line-height: 1; letter-spacing: -0.5px;}
.stat-label { font-size: 0.9rem; color: var(--text-muted); margin-top: 8px; font-weight: 500; }

/* ================== MODALS ================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(17, 24, 39, 0.4); backdrop-filter: blur(8px);
    display: none; justify-content: center; align-items: center;
    z-index: 99999; padding: 20px;
    opacity: 0; transition: opacity 0.3s ease;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal-card {
    background: #ffffff; border-radius: var(--radius-xl);
    padding: 32px; width: 100%; max-width: 480px; position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    max-height: 90vh; overflow-y: auto;
    transform: scale(0.95); opacity: 0; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.active .modal-card { max-height: 90vh; overflow-y: auto;  transform: scale(1); opacity: 1; }

.close-modal {
    position: absolute; top: 20px; right: 20px;
    width: 32px; height: 32px; border-radius: 50%;
    background: #f3f4f6; color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 18px; transition: all 0.2s;
}
.close-modal:hover { background: #e5e7eb; color: #111827; }

/* ================== PRINT ZONE (QR A4) ================== */
.print-area { display: none; }
@media print {
    body { background: white; margin: 0; padding: 0;}
    .no-print, .admin-nav { display: none !important; }
    .print-area { display: flex; width: 100%; height: 100vh; justify-content: center; align-items: center; page-break-after: always; }
}


/* Additional Global Mobile Fixes */
@media (max-width: 768px) {
    .btn { width: 100%; margin-bottom: 8px; padding: 12px; }
    .form-input, input[type="text"], select { padding: 14px; font-size: 1rem; } /* Prevents iOS Zoom */
    
    .panel-card, .toggle-card, .config-card {
        padding: 20px !important;
        margin-bottom: 20px !important;
        border-radius: 16px !important;
    }
    
    .modal-overlay {
        align-items: flex-start !important; 
        padding: 20px !important;
        padding-top: 8vh !important;
    }
    .modal-card { max-height: 90vh; overflow-y: auto; 
        width: 100% !important;
        max-width: 420px !important;
        border-radius: 28px !important; /* Super rounded like iOS alerts */
        padding: 20px 16px !important;
        margin: 0 auto !important;
        max-height: 72vh !important;
        transform: scale(0.95) !important;
        opacity: 0 !important;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3) !important;
    }
    .modal-overlay.active .modal-card { max-height: 90vh; overflow-y: auto; 
        transform: scale(1) !important;
        opacity: 1 !important;
    }
    
    #auto-save-indicator {
        bottom: 90px !important; /* Keep it above the iOS tab bar */
        right: 20px !important;
        left: 20px !important; /* Center it nicely */
        text-align: center;
    }

    .stats-grid {
        gap: 12px !important;
    }
    .stat-card {
        padding: 20px !important;
    }
    
    /* Make typography tighter on mobile */
    h1 { font-size: 1.6rem !important; }
    h2 { font-size: 1.3rem !important; }
}
