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

/* ============================================================ */
/* 0. DESIGN TOKENS */
/* ============================================================ */
:root {
    --bg-base: #09090b;
    --bg-surface: #121214;
    --bg-sidebar: #0e0e11;
    --bg-hover: rgba(255, 255, 255, 0.04);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-light: rgba(255, 255, 255, 0.08);
    --border-lighter: rgba(255, 255, 255, 0.12);
    --chart-grid: rgba(255, 255, 255, 0.05);
    --accent-primary: #7300ff;
    --accent-primary-hover: #5c00cc;
    --accent-primary-alpha: rgba(115, 0, 255, 0.15);
    --accent-success: #10b981;
    --accent-success-alpha: rgba(16, 185, 129, 0.15);
    --accent-warning: #f59e0b;
    --accent-warning-alpha: rgba(245, 158, 11, 0.15);
    --accent-danger: #ef4444;
    --accent-danger-alpha: rgba(239, 68, 68, 0.15);
    --accent-info: #3b82f6;
    --accent-info-alpha: rgba(59, 130, 246, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-base: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-light: rgba(0, 0, 0, 0.08);
    --border-lighter: rgba(0, 0, 0, 0.12);
    --chart-grid: rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* ============================================================ */
/* 1. RESET & BASE */
/* ============================================================ */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Montserrat', sans-serif;
    overflow-x: hidden;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Auth pending — hide everything until JS auth completes */
body.admin-auth-pending .admin-container,
body.admin-auth-pending .sidebar-overlay,
body.admin-auth-pending .modal {
    visibility: hidden;
}

body.admin-ready .admin-container {
    visibility: visible;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-lighter); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================ */
/* 2. LAYOUT */
/* ============================================================ */
.admin-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================ */
/* 3. SIDEBAR */
/* ============================================================ */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 100;
    transition: transform 0.3s ease, background 0.3s ease;
}

.logo {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo h2 {
    margin: 0;
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 1.3rem;
    color: var(--text-primary);
    flex: 1;
}

.logo span {
    color: var(--accent-primary);
}

.menu {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.menu-item i {
    width: 22px;
    margin-right: 10px;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.menu-item.active {
    background: var(--accent-primary-alpha);
    color: var(--accent-primary);
}

.menu-item.active i {
    color: var(--accent-primary);
}

.menu-item.logout {
    margin-top: auto;
    color: var(--accent-danger);
    border-top: 1px solid var(--border-light);
    border-radius: 0 0 0 0;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 26px;
    margin-top: 8px;
}

.menu-item.logout:hover {
    background: var(--accent-danger-alpha);
    color: var(--accent-danger);
}

/* Badges in menu */
.menu-item .badge {
    font-size: 0.7rem;
    padding: 3px 7px;
    border-radius: 20px;
    font-weight: 700;
    margin-left: auto;
    flex-shrink: 0;
}

/* ============================================================ */
/* 4. MAIN CONTENT */
/* ============================================================ */
.content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1;
    padding: 0 28px 32px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ============================================================ */
/* 5. STICKY HEADER */
/* ============================================================ */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-base);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    margin-bottom: 28px;
    transition: background 0.3s ease;
}

.sticky-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* Mobile toggle */
.mobile-sidebar-toggle,
.sidebar-close {
    display: none;
    border: 1px solid var(--border-lighter);
    background: var(--bg-surface);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: border-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.mobile-sidebar-toggle:hover,
.sidebar-close:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Theme toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-lighter);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ============================================================ */
/* 6. STAT CARDS */
/* ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    padding: 24px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    gap: 18px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-lighter);
    box-shadow: var(--shadow-md);
}

.stat-card i {
    font-size: 1.8rem;
    color: var(--accent-success);
    background: var(--accent-success-alpha);
    padding: 14px;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.stat-info h3 {
    margin: 0 0 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

.stat-info p {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-info small {
    display: block;
    margin-top: 4px;
    font-size: 0.73rem;
    color: var(--text-muted);
}

/* Money card */
.money-card {
    border-color: rgba(245, 158, 11, 0.25) !important;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), transparent);
}

.money-card i {
    color: var(--accent-warning) !important;
    background: var(--accent-warning-alpha) !important;
}

.money-card h3 {
    color: var(--accent-warning) !important;
}

/* ============================================================ */
/* 7. CHARTS */
/* ============================================================ */
.chart-container-wrapper {
    margin-top: 24px;
    background: var(--bg-surface);
    padding: 24px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 14px;
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-title h3 {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-title i {
    color: var(--accent-success);
    font-size: 1rem;
}

.chart-canvas-holder {
    height: 300px;
    position: relative;
    width: 100%;
}

.chart-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border: 1px dashed var(--border-lighter);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.chart-controls {
    display: flex;
    gap: 10px;
}

.chart-controls select {
    background-color: var(--bg-base);
    color: var(--text-primary);
    border: 1px solid var(--border-lighter);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.chart-controls select:hover,
.chart-controls select:focus {
    border-color: var(--accent-primary);
}

/* Traffic */
.traffic-details-grid {
    margin-top: 0;
}

.traffic-detail-card {
    align-items: flex-start;
}

.traffic-card-content {
    width: 100%;
}

.traffic-card-content h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.traffic-card-content h3 i {
    font-size: 0.9rem;
    color: var(--accent-info);
}

.traffic-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.traffic-list li {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
}

.traffic-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.traffic-item-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.traffic-item-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
}

.traffic-item-meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
    word-break: break-word;
}

.traffic-item-count {
    color: var(--accent-success);
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
}

.traffic-channel-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--accent-info-alpha);
    color: var(--accent-info);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.traffic-empty {
    color: var(--text-muted);
    padding: 6px 0;
    font-size: 0.85rem;
}

.traffic-recent-list {
    margin: 0;
}

/* ============================================================ */
/* 8. TAB SYSTEM */
/* ============================================================ */
.tab-content {
    display: none;
    animation: fadeIn 0.28s ease;
    flex: 1;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================ */
/* 9. TABLES */
/* ============================================================ */
.table-container {
    background: var(--bg-surface);
    padding: 20px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

th {
    color: var(--accent-primary);
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.5px;
}

th:hover { color: var(--text-primary); }
th i { margin-left: 4px; opacity: 0.5; }

td {
    color: var(--text-secondary);
    font-size: 0.9rem;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-hover);
}

.table-empty,
.table-loading,
.table-error {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 12px;
    font-size: 0.9rem;
}

.table-error {
    color: var(--accent-danger);
}

/* ============================================================ */
/* 10. CONTROLS BAR */
/* ============================================================ */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 14px;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    padding: 11px 15px 11px 42px;
    background: var(--bg-surface);
    border: 1px solid var(--border-lighter);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-alpha);
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.filter-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border-lighter);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-primary-alpha);
}

/* Action buttons (icon-only, 36x36) */
.action-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.action-btn:hover {
    transform: scale(1.08);
}

.action-btn.edit:hover {
    background: var(--accent-primary-alpha);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.action-btn.delete:hover,
.action-btn.danger:hover {
    background: var(--accent-danger-alpha);
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}

.action-btn.wide-btn {
    width: auto;
    min-height: 36px;
    padding: 0 12px;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ============================================================ */
/* 11. BADGES */
/* ============================================================ */
.badge,
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    letter-spacing: 0.4px;
}

.badge-new      { background: var(--accent-info-alpha); color: var(--accent-info); border: 1px solid rgba(59,130,246,0.3); }
.badge-success  { background: var(--accent-success-alpha); color: var(--accent-success); border: 1px solid rgba(16,185,129,0.3); }
.badge-pending  { background: var(--accent-warning-alpha); color: var(--accent-warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-rejected { background: var(--accent-danger-alpha); color: var(--accent-danger); border: 1px solid rgba(239,68,68,0.3); }
.badge-closed   { background: rgba(100,116,139,0.15); color: var(--text-muted); border: 1px solid rgba(100,116,139,0.25); }
.badge-admin    { background: var(--accent-primary-alpha); color: #a855f7; border: 1px solid rgba(115,0,255,0.3); }
.badge-owner    { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #000; box-shadow: 0 0 8px rgba(255,215,0,0.25); }
.badge-user     { background: var(--bg-hover); color: var(--text-muted); }
.badge-banned,
.badge-hidden,
.badge-canceled { background: var(--accent-danger-alpha); color: var(--accent-danger); border: 1px solid rgba(239,68,68,0.3); }
.badge-sold,
.badge-in_progress { background: var(--accent-info-alpha); color: var(--accent-info); border: 1px solid rgba(59,130,246,0.3); }
.badge-premium  { background: var(--accent-warning-alpha); color: var(--accent-warning); border: 1px solid rgba(245,158,11,0.3); font-size: 0.7rem; padding: 2px 7px; }
.badge-work     { background: var(--accent-warning-alpha); color: var(--accent-warning); }

/* ============================================================ */
/* 12. LINKS */
/* ============================================================ */
.admin-link {
    color: var(--accent-info);
    text-decoration: none;
}

.admin-link:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.field-note {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

/* ============================================================ */
/* 13. SIDEBAR OVERLAY */
/* ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1100;
}

/* ============================================================ */
/* 14. MODALS */
/* ============================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-lighter);
    width: 95%;
    max-width: 600px;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-light);
    overflow: hidden;
    animation: zoomIn 0.2s ease-out;
}

.chat-modal-content {
    height: 80vh;
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-base);
    gap: 12px;
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.chat-header small {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 2px;
}

.close-chat {
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
    margin-left: 10px;
    line-height: 1;
    flex-shrink: 0;
}

.close-chat:hover {
    color: var(--text-primary);
}

/* ============================================================ */
/* 15. CHAT */
/* ============================================================ */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.45;
    position: relative;
    word-wrap: break-word;
}

.msg.user {
    align-self: flex-start;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 2px;
}

.msg.admin {
    align-self: flex-end;
    background: var(--accent-primary);
    color: #fff;
    border-bottom-right-radius: 2px;
}

.msg-info {
    font-size: 0.68rem;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
    display: block;
}

.chat-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-base);
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    height: 44px;
    background: var(--bg-surface);
    border: 1px solid var(--border-lighter);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-xl);
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    border-color: var(--accent-primary);
}

.btn-send {
    width: 44px;
    height: 44px;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease;
    font-size: 1rem;
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.08);
    background: var(--accent-primary-hover);
}

.btn-close-ticket-header {
    background: var(--accent-danger-alpha);
    color: var(--accent-danger);
    border: 1px solid var(--accent-danger);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-close-ticket-header:hover {
    background: var(--accent-danger);
    color: #fff;
}

/* ============================================================ */
/* 16. TOAST NOTIFICATIONS */
/* ============================================================ */
#toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastIn 0.3s ease forwards;
    max-width: 340px;
    line-height: 1.4;
}

.toast.success {
    background: var(--bg-surface);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--accent-success);
}

.toast.error {
    background: var(--bg-surface);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--accent-danger);
}

.toast.fadeOut {
    animation: toastOut 0.35s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(30px); }
}

/* ============================================================ */
/* 17. RIPPLE EFFECT */
/* ============================================================ */
.ripple-btn {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-anim 0.6s linear;
    background: rgba(255, 255, 255, 0.18);
    pointer-events: none;
}

@keyframes ripple-anim {
    to { transform: scale(4); opacity: 0; }
}

/* ============================================================ */
/* 18. SKELETON LOADING */
/* ============================================================ */
.skeleton-box {
    display: inline-block;
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-hover) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================ */
/* 19. MOBILE RESPONSIVE */
/* ============================================================ */
@media (max-width: 768px) {
    .admin-container {
        min-height: 100vh;
        height: auto;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(84vw, 300px);
        height: 100vh;
        transform: translateX(-100%);
        z-index: 1200;
        border-right: 1px solid var(--border-lighter);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
        transition: transform 0.25s ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(3px);
    }

    .logo {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 18px 16px;
    }

    .sidebar-close,
    .mobile-sidebar-toggle {
        display: inline-flex;
    }

    .menu {
        flex-direction: column;
        width: 100%;
        justify-content: flex-start;
        padding: 10px 10px 20px;
    }

    .menu-item {
        flex: none;
        justify-content: flex-start;
        min-height: 46px;
        padding: 12px 14px;
        font-size: 0.9rem !important;
    }

    .menu-item i {
        font-size: 1rem !important;
        margin-right: 10px !important;
    }

    .menu-item .badge {
        font-size: 0.62rem;
        padding: 2px 5px;
    }

    .content-wrapper {
        padding: 0 16px 24px;
    }

    .sticky-header {
        padding: 14px 0;
        margin-bottom: 20px;
    }

    .sticky-header h2 {
        font-size: 1.15rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .chart-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .search-box {
        width: 100%;
    }

    .controls-bar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .filter-btns {
        display: flex;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .table-container {
        padding: 14px;
    }

    .filter-btn,
    .action-btn.wide-btn,
    .btn-close-ticket-header {
        min-height: 42px;
    }

    .modal-content {
        width: 95%;
        height: 85vh;
        margin: 0;
    }

    .chat-header {
        align-items: flex-start;
        gap: 10px;
        flex-wrap: wrap;
    }

    .chat-footer {
        align-items: stretch;
    }

    .chat-input {
        min-height: 44px;
    }

    .btn-send {
        width: 46px;
        height: 46px;
    }

    #toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }

    .toast {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 0 12px 20px;
    }

    .table-container {
        padding: 12px;
    }

    th, td {
        padding: 11px 10px;
    }

    .chart-controls {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: calc(100% - 16px);
        max-width: none;
    }

    .chat-modal-content {
        height: 88vh;
    }
}

/* ============================================================ */
/* BULK SELECTION */
/* ============================================================ */

/* Checkbox column — narrow, centered */
th.cb-col,
td.cb-col {
    width: 40px;
    min-width: 40px;
    padding: 0 !important;
    text-align: center;
    vertical-align: middle;
}

/* Custom checkbox */
.row-cb,
th.cb-col input[type="checkbox"],
#selectAll_products,
#selectAll_users,
#selectAll_withdrawals,
#selectAll_mc_orders {
    -webkit-appearance: none;
    appearance: none;
    width: 17px;
    height: 17px;
    border: 2px solid var(--border-lighter);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    transition: border-color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.row-cb:checked,
th.cb-col input[type="checkbox"]:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.row-cb:checked::after,
th.cb-col input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

th.cb-col input[type="checkbox"]:indeterminate {
    background: var(--accent-primary-alpha);
    border-color: var(--accent-primary);
}

th.cb-col input[type="checkbox"]:indeterminate::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 5px;
    width: 9px;
    height: 2px;
    background: var(--accent-primary);
    border: none;
    transform: none;
}

.row-cb:hover,
th.cb-col input[type="checkbox"]:hover {
    border-color: var(--accent-primary);
}

/* Highlight selected rows */
tr:has(.row-cb:checked) {
    background: rgba(115, 0, 255, 0.06) !important;
}

/* ── Bulk action bar ─────────────────────────────────────────── */
.bulk-bar {
    position: fixed;
    bottom: -90px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-xl);
    padding: 12px 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(115, 0, 255, 0.2);
    z-index: 2000;
    transition: bottom 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 320px;
    max-width: calc(100vw - 40px);
    white-space: nowrap;
}

.bulk-bar.visible {
    bottom: 24px;
}

.bulk-count {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent-primary);
    min-width: 80px;
    flex-shrink: 0;
}

.bulk-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bulk-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-lighter);
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.15s;
    font-family: inherit;
}

.bulk-action-btn:hover {
    transform: translateY(-1px);
}

.bulk-action-btn.success {
    background: var(--accent-success-alpha);
    border-color: var(--accent-success);
    color: var(--accent-success);
}

.bulk-action-btn.success:hover {
    background: var(--accent-success);
    color: #fff;
}

.bulk-action-btn.danger {
    background: var(--accent-danger-alpha);
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}

.bulk-action-btn.danger:hover {
    background: var(--accent-danger);
    color: #fff;
}

.bulk-action-btn.warning {
    background: var(--accent-warning-alpha);
    border-color: var(--accent-warning);
    color: var(--accent-warning);
}

.bulk-action-btn.warning:hover {
    background: var(--accent-warning);
    color: #fff;
}

.bulk-close {
    margin-left: auto;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, color 0.18s;
}

.bulk-close:hover {
    background: var(--accent-danger-alpha);
    color: var(--accent-danger);
}

@media (max-width: 600px) {
    .bulk-bar {
        flex-wrap: wrap;
        border-radius: var(--radius-lg);
        bottom: -140px;
    }
    .bulk-bar.visible {
        bottom: 16px;
    }
    .bulk-actions {
        flex: 1 0 100%;
    }
}
