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

:root {
    --bg-dark: #070913;
    --bg-card: rgba(17, 24, 39, 0.6);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    position: relative;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 25%);
    background-attachment: fixed;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-panel:hover {
    border-color: var(--border-hover);
}

/* Typography */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; }
.gradient-text {
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(10, 15, 30, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-item i { font-size: 1.1rem; width: 20px; text-align: center; }

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: white;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), transparent);
    border-left: 3px solid var(--primary);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 2rem 3rem;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    background: var(--bg-card);
    padding: 1rem 2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

/* Stat Cards */
.stat-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.7));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Forms & Inputs */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

select.form-control option { background: var(--bg-dark); color: white; }

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    box-shadow: 0 4px 15px -3px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px var(--primary-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #334155;
    box-shadow: none;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

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

th {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

td {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: #e2e8f0;
}

tr:hover td { background: rgba(255,255,255,0.02); }

/* Mobile Table Cards */
@media (max-width: 768px) {
    .table-mobile-cards table, 
    .table-mobile-cards thead, 
    .table-mobile-cards tbody, 
    .table-mobile-cards th, 
    .table-mobile-cards td, 
    .table-mobile-cards tr {
        display: block;
    }
    
    .table-mobile-cards thead tr {
        display: none;
    }
    
    .table-mobile-cards tr {
        margin-bottom: 1rem;
        background: rgba(255,255,255,0.02);
        border: 1px solid rgba(255,255,255,0.05);
        border-radius: 12px;
        padding: 0.5rem;
    }
    
    .table-mobile-cards td {
        border: none;
        border-bottom: 1px dashed rgba(255,255,255,0.05);
        position: relative;
        padding-left: 50%;
        text-align: right;
        min-height: 50px;
    }
    
    .table-mobile-cards td:last-child {
        border-bottom: none;
    }
    
    .table-mobile-cards td::before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 45%;
        text-align: left;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
    }

    .table-mobile-cards td.empty-row::before {
        content: none;
    }
    .table-mobile-cards td.empty-row {
        padding-left: 1rem;
        text-align: center;
    }
}

/* Badges */
.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-active { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-inactive { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-pending { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }

/* Layout Utilities */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.link { color: var(--primary); text-decoration: none; transition: color 0.2s; }
.link:hover { color: #60a5fa; }
.error-msg { color: #ef4444; font-size: 0.85rem; margin-top: 0.5rem; }

/* Auth Layout for login/register pages */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 600;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

/* Loss Alert for Inputs */
.loss-alert {
    background: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid #ef4444 !important;
    color: #fca5a5 !important;
}
.loss-alert:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

/* Sidebar Sub-Menu */
.has-submenu {
    position: relative;
    margin-bottom: 0.2rem;
}
.has-submenu > a::after {
    content: '\f107'; /* FontAwesome down arrow */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    margin-left: auto;
}
.has-submenu.open > a::after {
    transform: rotate(180deg);
}
.has-submenu.open > a {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}
.submenu {
    display: none;
    flex-direction: column;
    padding-left: 2.2rem;
    background: transparent;
    margin-top: 0.2rem;
    gap: 0.2rem;
}
.has-submenu.open .submenu {
    display: flex;
}
.submenu .nav-item {
    border-radius: 6px;
}
.submenu .nav-item.active {
    border-left: none;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Mobile Responsiveness & Hamburger Menu */
.mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(10, 15, 30, 0.9);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.hamburger-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
}

.overlay.active { display: block; }

/* Floating Admin Return Button */
.admin-return-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 200;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
    }
    
    .sidebar .sidebar-brand {
        display: none !important;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem 1rem !important;
        width: 100%;
    }
    
    .topbar {
        display: none;
    }
    
    .glass-panel {
        padding: 1.5rem !important;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table th, table td {
        padding: 1rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* Telegram Support Button */
.telegram-support-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #0088cc;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    box-shadow: 0 4px 15px rgba(0, 136, 204, 0.4);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    text-decoration: none;
}
.telegram-support-btn:hover {
    transform: scale(1.15) rotate(-10deg);
    box-shadow: 0 8px 25px rgba(0, 136, 204, 0.6);
    color: white;
}
