@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap');

:root {
    --bg-dark: #070726;
    --bg-card: #070729;
    --primary: #800080; 
    --secondary: #d946ef; 
    --accent: #6366f1; 
    
    --text-main: #ffffff; 
    --text-muted: #94a3b8;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --header-bg: rgba(4, 3, 67, 0.85);
    --input-bg: rgba(0, 0, 0, 0.3);
    
    --status-bar-gradient-start: #4a006a;
    --status-bar-gradient-end: #800080;
    
    --sidebar-width: 280px;
}

html.light :root {
    --bg-dark: #f3f0ff;
    --bg-card: #ffffff;
    --primary: #9333ea;
    --secondary: #d946ef;
    
    --text-main: #1e1b4b;
    --text-muted: #64748b;
    
    --border-color: rgba(147, 51, 234, 0.15);
    --header-bg: rgba(255, 255, 255, 0.85);
    --input-bg: #f8fafc;
    
    --status-bar-gradient-start: #7c3aed;
    --status-bar-gradient-end: #c026d3;
}

/* Global Transitions */
body, .bg-dark, .bg-card, .text-current, .border-white\/10, header, footer {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.4s ease, 
                box-shadow 0.4s ease;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main) !important;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(128, 0, 128, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(217, 70, 239, 0.03) 0%, transparent 20%);
    background-attachment: fixed;
}

.text-current { color: var(--text-main) !important; }

/* --- Floating Layout Classes --- */
.floating-header {
    position: fixed;
    top: 1.5rem; 
    left: 0; 
    right: 0;
    width: calc(100% - 2rem);
    max-width: 1400px;
    margin: 0 auto;
    border-radius: 2rem; 
    z-index: 50;
    border: 1px solid var(--border-color);
    background-color: var(--header-bg);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.1);
}

.floating-container {
    width: calc(100% - 2rem);
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 1.5rem;
    padding-top: 10rem; 
}

.floating-container-no-status {
    width: calc(100% - 2rem);
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-top: 8rem;
}

.floating-footer {
    width: calc(100% - 2rem);
    max-width: 1400px;
    margin: 2rem auto 2rem auto;
    border-radius: 2.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    box-shadow: 0 -10px 40px -10px rgba(0,0,0,0.05);
}

@media (max-width: 1024px) {
    .floating-header {
        top: 0.75rem;
        width: calc(100% - 1rem);
        border-radius: 1.5rem;
    }
    .floating-container {
        width: calc(100% - 1rem);
        padding-top: 8rem;
    }
    .floating-container-no-status {
        width: calc(100% - 1rem);
        padding-top: 7.5rem;
    }
    .floating-footer {
        width: calc(100% - 1rem);
        margin-bottom: 6rem;
        border-radius: 2rem;
    }
}

/* Custom Scrollbar (Global) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Logo Shine */
.logo-icon-wrapper { position: relative; overflow: hidden; }
.logo-icon-wrapper::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.8), transparent);
    transform: skewX(-25deg);
    animation: shine 3s infinite;
}
@keyframes shine {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

/* Footer Particles (Floating Effect) */
.snow-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 1; overflow: hidden;
}
.particle {
    position: absolute;
    background: var(--secondary);
    border-radius: 50%;
    opacity: 0.3;
    animation: floatParticle linear infinite;
}
@keyframes floatParticle {
    0% { transform: translateY(0) translateX(0); opacity: 0; }
    20% { opacity: 0.4; }
    50% { transform: translateY(-30px) translateX(20px); opacity: 0.2; }
    80% { opacity: 0.4; }
    100% { transform: translateY(-60px) translateX(-20px); opacity: 0; }
}

/* Cart Badge */
.cart-badge-fancy {
    position: absolute; top: -5px; right: -5px;
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--primary); color: white; font-size: 10px; font-weight: 800;
    border-radius: 99px; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-card);
    transform: scale(0); transition: transform 0.3s; z-index: 20;
}
.cart-badge-fancy.show { transform: scale(1); }

/* Scroll To Top */
#scroll-to-top-btn.visible { opacity: 1; transform: translateY(0); }

/* Theme Toggle */
.theme-toggle-active {
    background-color: var(--primary); color: white !important;
    box-shadow: 0 0 15px var(--primary);
}

/* Status Bar & Galaxy */
.status-bar-bg {
    background: linear-gradient(135deg, var(--status-bar-gradient-start), var(--status-bar-gradient-end));
    position: absolute; inset: 0; z-index: 0; overflow: hidden;
}

/* --- REDESIGNED PACKAGE CARD --- */
.package-card-compact {
    position: relative;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex; flex-direction: column; align-items: center; text-align: center;
}
.package-card-compact:hover { border-color: var(--primary); transform: translateY(-2px); }
.package-card-compact.selected {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(128, 0, 128, 0.3);
    background: rgba(128, 0, 128, 0.05);
}
.package-card-compact .img-wrapper { width: 100%; aspect-ratio: 1/1; overflow: hidden; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.package-card-compact img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.package-card-compact:hover img { transform: scale(1.1); }
.package-card-compact .content { padding: 0.75rem 0.5rem; width: 100%; display: flex; flex-direction: column; gap: 0.25rem; }
.package-card-compact .amount { font-weight: 800; font-size: 0.9rem; color: var(--text-main); }
.package-card-compact .price { font-size: 0.8rem; color: var(--text-muted); }
.package-card-compact.selected .amount { color: var(--primary); }
.package-card-compact.selected .price { color: var(--secondary); font-weight: bold; }
.badge-pop { position: absolute; top: 0.5rem; right: 0.5rem; background: #eab308; color: black; font-size: 0.6rem; font-weight: bold; padding: 0.1rem 0.4rem; border-radius: 99px; z-index: 10; }
.badge-special { position: absolute; top: 0.5rem; left: 0.5rem; background: #ef4444; color: white; font-size: 0.6rem; font-weight: bold; padding: 0.1rem 0.4rem; border-radius: 99px; z-index: 10; }

/* =========================================
   ADMIN PANEL STYLES (COMPLETE & FIXED)
   ========================================= */
.admin-fantasy-bg {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(128, 0, 128, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(217, 70, 239, 0.1) 0%, transparent 40%);
    /* Prevent Zooming on Admin Pages */
    touch-action: pan-x pan-y;
}

.admin-sidebar {
    position: fixed; top: 0; right: 0; width: var(--sidebar-width); height: 100vh;
    background: rgba(7, 7, 41, 0.95); backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color); padding: 2rem; 
    z-index: 100; /* Increased Z-Index to stay on top of headers */
    transition: transform 0.3s ease;
    overflow-y: auto;
    touch-action: pan-x pan-y;
}

/* Hide scrollbar for sidebar but allow scrolling */
.admin-sidebar::-webkit-scrollbar { display: none; }
.admin-sidebar { -ms-overflow-style: none; scrollbar-width: none; }

.admin-content {
    margin-right: var(--sidebar-width); width: calc(100% - var(--sidebar-width));
    padding: 2rem; min-height: 100vh;
    touch-action: pan-x pan-y;
}

@media (max-width: 1024px) {
    .admin-sidebar { transform: translateX(100%); width: 260px; }
    .admin-sidebar.mobile-visible { transform: translateX(0); }
    .admin-content { margin-right: 0; width: 100%; padding: 1rem; padding-top: 5rem; }
}

.admin-nav-item {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem;
    border-radius: 0.75rem; color: var(--text-muted); font-weight: 500; transition: all 0.2s;
    white-space: nowrap; /* Fix for mobile text wrapping */
}
.admin-nav-item i { flex-shrink: 0; } /* Fix for icon shrinking */

.admin-nav-item:hover { background: rgba(255, 255, 255, 0.05); color: white; }
.admin-nav-item.active {
    background: linear-gradient(90deg, rgba(128, 0, 128, 0.2), transparent);
    color: var(--secondary); border-right: 3px solid var(--secondary);
}

/* Admin List Item (Games List) */
.admin-list-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: all 0.2s;
}
.admin-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Fantasy Widgets */
.fantasy-widget {
    position: relative; background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 1.5rem; padding: 1.5rem; overflow: hidden; height: 140px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.fantasy-widget-glow {
    position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    opacity: 0.15; pointer-events: none;
}
.fantasy-widget-icon {
    width: 3rem; height: 3rem; border-radius: 1rem; background: rgba(255, 255, 255, 0.05);
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}

/* Tables */
.clean-table-wrapper {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 1.5rem; 
    overflow-x: auto; /* Enable horizontal scroll */
    width: 100%; /* Ensure it takes full width */
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.clean-table-wrapper table { border-collapse: collapse; width: 100%; min-width: 600px; /* Ensure table has min width to trigger scroll */ }
.clean-table-wrapper th {
    text-align: right; padding: 1.25rem; color: var(--text-muted); font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color); background: rgba(0,0,0,0.2);
    white-space: nowrap;
}
.clean-table-wrapper td { padding: 1.25rem; border-bottom: 1px solid var(--border-color); color: var(--text-main); white-space: nowrap; }
.clean-table-wrapper tr:last-child td { border-bottom: none; }
.clean-table-wrapper tr:hover td { background: rgba(255,255,255,0.02); }

/* Buttons & Inputs */
.fantasy-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.75rem 1.5rem; border-radius: 0.75rem; font-weight: bold;
    background: var(--primary); color: white; transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(128, 0, 128, 0.3);
    white-space: nowrap;
}
.fantasy-btn:hover { background: var(--secondary); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(217, 70, 239, 0.4); }
.fantasy-btn.secondary { background: rgba(255, 255, 255, 0.1); box-shadow: none; }
.fantasy-btn.secondary:hover { background: rgba(255, 255, 255, 0.2); }
.fantasy-btn.danger { background: rgba(239, 68, 68, 0.2); color: #f87171; box-shadow: none; }
.fantasy-btn.danger:hover { background: rgba(239, 68, 68, 0.3); }
.fantasy-btn.icon-only { padding: 0.5rem; width: 2.5rem; height: 2.5rem; }

.fantasy-input {
    width: 100%; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-color);
    border-radius: 0.75rem; padding: 0.75rem 1rem; color: white; transition: all 0.2s;
}
.fantasy-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(128, 0, 128, 0.2); }

/* Toggle Switch */
.toggle-switch {
    display: flex; background: rgba(0,0,0,0.3); border-radius: 0.75rem;
    padding: 0.25rem; border: 1px solid var(--border-color);
}
.toggle-option {
    flex: 1; text-align: center; padding: 0.5rem; border-radius: 0.5rem;
    font-size: 0.85rem; cursor: pointer; color: var(--text-muted); transition: all 0.2s;
}
.toggle-option.active {
    background: var(--primary); color: white; font-weight: bold; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Settings Tabs (New Fix) */
.settings-tabs-container {
    display: flex; justify-content: center; margin-bottom: 2rem;
}
.settings-tabs {
    display: flex; background: rgba(0,0,0,0.3); border-radius: 1rem;
    padding: 0.5rem; border: 1px solid var(--border-color); gap: 0.5rem;
}
.settings-tab-btn {
    padding: 0.75rem 2rem; border-radius: 0.75rem; font-weight: bold;
    color: var(--text-muted); cursor: pointer; transition: all 0.3s ease;
}
.settings-tab-btn:hover { color: white; background: rgba(255,255,255,0.05); }
.settings-tab-btn.active {
    background: var(--primary); color: white;
    box-shadow: 0 4px 15px rgba(128, 0, 128, 0.3);
}

/* Modals */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
    z-index: 100; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-content {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 1.5rem; padding: 2rem; width: 90%; max-width: 500px;
    max-height: 85vh; overflow-y: auto;
    transform: scale(0.95); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
}
.modal-overlay.open .modal-content { transform: scale(1); }

/* Modal Scrollbar */
.modal-content::-webkit-scrollbar { width: 5px; }
.modal-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); margin: 10px 0; border-radius: 10px; }
.modal-content::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* Input Field Chips */
.input-chip-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.input-chip {
    position: relative; display: flex; align-items: center; gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color);
    padding: 0.75rem; border-radius: 0.75rem; cursor: pointer; transition: all 0.2s;
}
.input-chip:hover { background: rgba(255, 255, 255, 0.06); }
.input-chip input {
    appearance: none; width: 1.25rem; height: 1.25rem; border: 2px solid var(--text-muted);
    border-radius: 0.35rem; transition: all 0.2s; display: grid; place-content: center;
}
.input-chip input::before {
    content: ""; width: 0.65rem; height: 0.65rem; transform: scale(0);
    transition: 120ms transform ease-in-out; box-shadow: inset 1em 1em white;
    transform-origin: center; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.input-chip input:checked { background: var(--primary); border-color: var(--primary); }
.input-chip input:checked::before { transform: scale(1); }
.input-chip span { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.input-chip input:checked ~ span { color: white; }
.input-chip:has(input:checked) { border-color: var(--primary); background: rgba(128, 0, 128, 0.1); }

/* Full Width Radio Group (Products) */
.radio-group-full {
    display: flex; background: rgba(0,0,0,0.3); border-radius: 0.75rem;
    padding: 0.25rem; border: 1px solid var(--border-color); margin-bottom: 1rem;
}
.radio-option-full { flex: 1; position: relative; }
.radio-option-full input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.radio-option-full label {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.75rem; border-radius: 0.5rem; color: var(--text-muted);
    font-size: 0.9rem; font-weight: bold; transition: all 0.2s; cursor: pointer;
}
.radio-option-full input:checked + label {
    background: var(--primary); color: white; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Loading Overlay for Modal */
.modal-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 7, 41, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    border-radius: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
