/*
================================================================================
| ROOBUX ADMIN PANEL - PROFESSIONAL CLEAN DESIGN
================================================================================
| Fixed Version: Professional office-style admin interface
| Features: Collapsible sidebar, clean shadows, PURE PITCH BLACK dark mode
================================================================================
*/

/* --- FONT IMPORTS --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/*
================================================================================
| CSS VARIABLES - CLEAN DESIGN SYSTEM
================================================================================
*/
:root {
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    
    /* Light Theme Colors */
    --color-primary: #2563EB;
    --color-primary-hover: #1D4ED8;
    --color-primary-light: #3B82F6;
    
    --color-success: #059669;
    --color-success-light: #10B981;
    --color-warning: #D97706;
    --color-warning-light: #F59E0B;
    --color-danger: #DC2626;
    --color-danger-light: #EF4444;
    --color-info: #0891B2;
    
    /* Backgrounds */
    --color-bg-page: #F9FAFB;
    --color-bg-main: #FFFFFF;
    --color-bg-sidebar: #FFFFFF;
    --color-bg-card: #FFFFFF;
    --color-bg-elevated: #F9FAFB;
    --color-bg-hover: #F3F4F6;
    --color-bg-input: #FFFFFF;
    --color-bg-alt: #F9FAFB;
    
    /* Text Colors */
    --color-text-primary: #111827;
    --color-text-secondary: #4B5563;
    --color-text-muted: #6B7280;
    --color-text-inverse: #FFFFFF;
    
    /* Borders */
    --color-border: #E5E7EB;
    --color-border-hover: #D1D5DB;
    --color-border-focus: #2563EB;
    
    /* Shadows - CLEAN OUTSIDE ONLY */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    /* Updated shadow for a professional feel */
    --shadow-hover: 0 6px 16px -4px rgba(0, 0, 0, 0.15); 
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px; /* Changed to a small visible icon-only bar */
    --header-height: 64px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-sidebar: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme - PURE PITCH BLACK */
[data-theme="dark"] {
    --color-primary: #3B82F6;
    --color-primary-hover: #60A5FA;
    
    /* Pure Pitch Black Backgrounds */
    --color-bg-page: #000000;
    --color-bg-main: #0A0A00; /* Darker main content for contrast */
    --color-bg-sidebar: #000000;
    --color-bg-card: #0A0A0A;
    --color-bg-elevated: #1A1A1A;
    --color-bg-hover: #1A1A1A;
    --color-bg-input: #1A1A1A;
    --color-bg-alt: #0A0A0A;
    
    /* Dark Text */
    --color-text-primary: #FFFFFF;
    --color-text-secondary: #E5E5E5;
    --color-text-muted: #A3A3A3;
    
    /* Dark Borders */
    --color-border: #1F2937;
    --color-border-hover: #374151;
    
    /* Dark Shadows - Less intense to match the pitch black theme */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
    --shadow-hover: 0 6px 16px -4px rgba(59, 130, 246, 0.25);
}

/*
================================================================================
| BASE STYLES
================================================================================
*/
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--color-bg-page);
    color: var(--color-text-secondary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px; /* Crucial for horizontal table scrollbar */
}

::-webkit-scrollbar-track {
    background: var(--color-bg-page);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/*
================================================================================
| TYPOGRAPHY
================================================================================
*/
h1, h2, h3, h4, h5, h6 {
    color: var(--color-text-primary);
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin: 0 0 var(--space-4) 0;
    color: var(--color-text-secondary);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
}

strong {
    font-weight: 600;
    color: var(--color-text-primary);
}

small {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--color-bg-elevated);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    color: var(--color-primary);
}

/*
================================================================================
| LAYOUT
================================================================================
*/
.admin-layout {
    display: flex;
    height: 100vh;
    width: 100%;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-bg-page);
    /* Initial margin = sidebar-width */
    margin-left: var(--sidebar-width); 
    transition: margin-left var(--transition-sidebar);
}

/* Main content shift when sidebar is collapsed */
.admin-layout.is-collapsed .admin-main {
    margin-left: var(--sidebar-collapsed-width);
}

/*
================================================================================
| SIDEBAR - COLLAPSIBLE
================================================================================
*/
.admin-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-sidebar);
    border-right: 1px solid var(--color-border);
    z-index: 200;
    /* Use width transition for desktop collapse/expand */
    transition: width var(--transition-sidebar); 
}

.admin-layout.is-collapsed .admin-sidebar {
    width: var(--sidebar-collapsed-width);
}

/* Hide or adjust elements when sidebar is collapsed */
.admin-layout.is-collapsed .sidebar-logo,
.admin-layout.is-collapsed .admin-user-info,
.admin-layout.is-collapsed .sidebar-footer,
.admin-layout.is-collapsed .sidebar-nav-list a span:not(.nav-icon),
.admin-layout.is-collapsed .sidebar-nav-list a .badge {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
    transition: opacity var(--transition-fast), width var(--transition-fast);
}

.admin-layout.is-collapsed .sidebar-nav-list a {
    justify-content: center;
    padding: var(--space-3) var(--space-2);
}

.admin-layout.is-collapsed .sidebar-header {
    justify-content: center; /* Center logo/badge area */
}

.admin-layout.is-collapsed .sidebar-header .badge {
    opacity: 1; /* Keep the admin badge visible if desired, or hide it */
    width: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--color-border);
    transition: all var(--transition-sidebar);
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.admin-user-info {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all var(--transition-sidebar);
}

.admin-user-info strong {
    display: block;
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: 0;
    margin-top: var(--space-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) 0;
}

.sidebar-nav-list {
    list-style: none;
    padding: 0 var(--space-2);
}

.sidebar-nav-list li {
    margin-bottom: var(--space-1);
}

.sidebar-nav-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    background: transparent;
}

.sidebar-nav-list a:hover {
    /* Remove background glow, apply clean outside shadow */
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-sm); 
}

.sidebar-nav-list a.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    /* Remove background glow, apply clean outside shadow */
    box-shadow: var(--shadow-md); 
}

.sidebar-nav-list a.active:hover {
    background: var(--color-primary-hover);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-hover);
}

.nav-item-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    /* Ensure icon is visible when collapsed */
    min-width: 20px; 
}

.nav-icon {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--color-border);
    transition: all var(--transition-sidebar);
}

.sidebar-footer .btn {
    width: 100%;
}

/*
================================================================================
| HEADER - CLEAN BUTTONS
================================================================================
*/
.admin-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
    background: var(--color-bg-main);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* Hamburger button for sidebar toggle - now mandatory */
.menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    cursor: pointer;
    width: 40px;
    height: 40px;
    transition: all var(--transition-fast);
    color: var(--color-text-primary);
    font-size: 1.25rem;
}

.menu-toggle-btn:hover {
    background: var(--color-bg-hover); /* Use background hover color */
    border-color: var(--color-border-hover);
    box-shadow: var(--shadow-sm); /* Clean outside shadow */
}

#admin-header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Theme Toggle Button - Now consolidated to this styling */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: all var(--transition-fast);
    color: var(--color-text-primary);
    font-size: 1.25rem;
}

.theme-toggle:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-hover);
    box-shadow: var(--shadow-sm);
}

/*
================================================================================
| CONTENT AREA
================================================================================
*/
.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-8);
}

/* Dashboard chart fix (remove bright glow/gradient) */
.dashboard-chart-container {
    padding: var(--space-6);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

#admin-chart-canvas {
    background: var(--color-bg-card); /* Ensure canvas background is correct */
}

/* Tab Isolation */
.admin-tab-content {
    display: none !important;
    opacity: 0;
    visibility: hidden;
}

.admin-tab-content.is-active {
    display: block !important;
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.2s ease;
}

#tab-support.is-active {
    display: flex !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/*
================================================================================
| BUTTONS - PROFESSIONAL
================================================================================
*/
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
    background: transparent;
}

.btn:hover:not(:disabled) {
    /* Ensure only outside shadow is applied */
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg-hover);
    border-color: var(--color-border-hover);
}

.btn-success {
    background: var(--color-success);
    color: var(--color-text-inverse);
    border-color: var(--color-success);
}

.btn-success:hover:not(:disabled) {
    background: var(--color-success-light);
    border-color: var(--color-success-light);
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-text-inverse);
    border-color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
    background: var(--color-danger-light);
    border-color: var(--color-danger-light);
}

.btn-warning {
    background: var(--color-warning);
    color: var(--color-text-inverse);
    border-color: var(--color-warning);
}

.btn-warning:hover:not(:disabled) {
    background: var(--color-warning-light);
    border-color: var(--color-warning-light);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.813rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/*
================================================================================
| FORMS
================================================================================
*/
.form-group {
    margin-bottom: var(--space-6);
}

.form-label,
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text-primary);
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder,
textarea::placeholder {
    color: var(--color-text-muted);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25em;
    padding-right: var(--space-10);
    appearance: none;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-text {
    display: block;
    font-size: 0.813rem;
    color: var(--color-text-muted);
    margin-top: var(--space-2);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border);
}

.search-bar {
    min-width: 280px;
    max-width: 400px;
}

/*
================================================================================
| CARDS - CLEAN HOVER
================================================================================
*/
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md); /* Use outside shadow only */
}

/* Settings card body with gradient fix */
.card-body-gradient-fix {
    /* Remove gradient background */
    background: var(--color-bg-card); 
}

.card-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-alt);
}

.card-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.card-body {
    padding: var(--space-6);
}

/*
================================================================================
| BADGES
================================================================================
*/
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success,
.badge-approved {
    background: rgba(5, 150, 105, 0.1);
    color: var(--color-success);
}

.badge-danger,
.badge-error,
.badge-rejected,
.badge-banned {
    background: rgba(220, 38, 38, 0.1);
    color: var(--color-danger);
}

.badge-warning,
.badge-pending,
.badge-unverified {
    background: rgba(217, 119, 6, 0.1);
    color: var(--color-warning);
}

.badge-primary,
.badge-info,
.badge-read,
.badge-active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-primary);
}

/*
================================================================================
| STAT CARDS - CLEAN SHADOW
================================================================================
*/
.stat-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card[style*="cursor: pointer"] {
    cursor: pointer;
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.stat-card-header h5 {
    margin: 0;
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card-icon {
    font-size: 1.5rem;
    color: var(--color-text-muted);
    opacity: 0.5;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
    line-height: 1;
}

.stat-card-footer {
    font-size: 0.813rem;
    color: var(--color-text-muted);
}

.stat-card-footer .increase {
    color: var(--color-success);
    font-weight: 600;
}

.stat-card-footer .decrease {
    color: var(--color-danger);
    font-weight: 600;
}

/*
================================================================================
| TABLES - ADD HORIZONTAL SCROLL
================================================================================
*/
.table-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.table-container {
    width: 100%;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Ensure the inner content can scroll horizontally */
.table-scroll-wrapper {
    overflow-x: auto;
    /* Adding a smooth scroll behavior for the user experience */
    scroll-behavior: smooth;
}

.admin-table {
    width: 100%;
    min-width: 1200px; /* Increased min-width to ensure scrolling on large tables */
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th {
    padding: var(--space-4) var(--space-5);
    text-align: left;
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    border-bottom: 2px solid var(--color-border);
    background: var(--color-bg-alt);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-table td {
    padding: var(--space-4) var(--space-5);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    white-space: nowrap;
}

.admin-table tbody tr {
    transition: all var(--transition-fast);
}

/* Remove background glow on hover and use clean outside shadow */
.admin-table tbody tr:hover {
    background: var(--color-bg-hover); 
    box-shadow: var(--shadow-sm); 
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table .email {
    font-family: var(--font-mono);
    font-size: 0.813rem;
    color: var(--color-primary);
}

.admin-table .address,
.admin-table .tx-hash {
    font-family: var(--font-mono);
    font-size: 0.813rem;
    color: var(--color-text-muted);
}

.admin-table .message-preview {
    max-width: 300px;
    white-space: normal;
    line-height: 1.4;
}

.admin-table .text-center {
    text-align: center;
    padding: var(--space-8) 0;
    color: var(--color-text-muted);
}

.admin-table .text-error {
    color: var(--color-danger);
    font-weight: 600;
}

.admin-table .text-warning {
    color: var(--color-warning);
    font-weight: 600;
}

.admin-table .text-secondary {
    color: var(--color-text-muted);
    font-size: 0.813rem;
}

.admin-table td:last-child {
    white-space: nowrap;
    display: flex;
    gap: var(--space-2);
    /* Corrected button alignment for table actions */
    justify-content: flex-start; 
    border-bottom: none;
}

/* Fix for Audit Log button alignment */
#audit-log-table td:last-child {
    justify-content: center;
}

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-alt);
}

.pagination-controls span {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/*
================================================================================
| SUPPORT CHAT - FIX CLOSE BUTTON PLACEMENT
================================================================================
*/
#tab-support {
    height: calc(100vh - var(--header-height) - (var(--space-8) * 2));
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chat-list-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    background: var(--color-bg-alt);
}

.chat-list-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-list-item {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

/* Remove background glow, apply clean outside shadow */
.chat-list-item:hover {
    background: var(--color-bg-hover);
    box-shadow: var(--shadow-sm);
}

.chat-list-item.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.chat-list-item.active * {
    color: var(--color-text-inverse) !important;
}

.chat-list-item h6 {
    margin: 0 0 var(--space-2) 0;
    font-size: 0.938rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list-item p {
    margin: 0;
    font-size: 0.813rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list-item small {
    display: block;
    margin-top: var(--space-2);
    font-size: 0.75rem;
}

.chat-unread-badge {
    position: absolute;
    top: var(--space-4);
    right: var(--space-5);
    background: var(--color-danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-2);
}

.chat-conversation-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#support-chat-convo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 100%;
    color: var(--color-text-muted);
}

#support-chat-convo-main {
    display: none;
    height: 100%;
    flex-direction: column;
}

.chat-conversation-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-bg-alt);
}

.chat-conversation-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.chat-conversation-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    background: var(--color-bg-page);
}

.chat-message {
    max-width: 70%;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}

.chat-message.user {
    align-self: flex-start;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
}

.chat-message.admin {
    align-self: flex-end;
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.chat-message-meta {
    font-size: 0.75rem;
    margin-top: var(--space-2);
    opacity: 0.7;
}

.chat-input-area {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-alt);
}

.chat-input-area textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 120px;
}

/*
================================================================================
| SETTINGS
================================================================================
*/
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: var(--space-6);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--color-border);
    transition: var(--transition-base);
    border-radius: 14px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background: white;
    transition: var(--transition-base);
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background: var(--color-primary);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(24px);
}

/*
================================================================================
| MODALS
================================================================================
*/
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
}

.modal.is-visible {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    z-index: 1001;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-lg {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-alt);
}

.modal-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close-btn,
.modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    padding: var(--space-2);
    cursor: pointer;
    transition: color var(--transition-fast);
    border-radius: var(--radius-sm);
}

.modal-close-btn:hover {
    color: var(--color-danger);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-alt);
}

.tx-details {
    display: grid;
    gap: var(--space-4);
}

.tx-details-item {
    display: flex;
    flex-direction: column;
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.tx-details-item:last-child {
    border-bottom: none;
}

.tx-details-item label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.tx-details-item span {
    font-weight: 500;
    color: var(--color-text-primary);
    word-break: break-word;
}

/*
================================================================================
| MOBILE BLOCKER
================================================================================
*/
#mobile-blocker {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--color-bg-page);
    color: var(--color-text-primary);
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-8);
}

#mobile-blocker h1 {
    color: var(--color-primary);
    margin-bottom: var(--space-4);
}

@media (max-width: 992px) {
    #mobile-blocker {
        display: flex;
    }
    
    .admin-layout {
        display: none !important;
    }
}

/*
================================================================================
| ALERTS
================================================================================
*/
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid;
    margin-bottom: var(--space-4);
    font-size: 0.875rem;
}

.alert-error {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.alert-warning {
    background: rgba(217, 119, 6, 0.1);
    border-color: var(--color-warning);
    color: var(--color-warning);
}

.alert-info {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.alert-success {
    background: rgba(5, 150, 105, 0.1);
    border-color: var(--color-success);
    color: var(--color-success);
}

/*
================================================================================
| UTILITIES
================================================================================
*/
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger, .text-error { color: var(--color-danger) !important; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }

/*
================================================================================
| SPINNER
================================================================================
*/
.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-overlay.is-visible {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/*
================================================================================
| TOAST
================================================================================
*/
#toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 400px;
}

.toast {
    padding: var(--space-4) var(--space-5);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-success {
    border-left: 3px solid var(--color-success);
}

.toast.toast-error {
    border-left: 3px solid var(--color-danger);
}

.toast.toast-warning {
    border-left: 3px solid var(--color-warning);
}

.toast.toast-info {
    border-left: 3px solid var(--color-info);
}

/*
================================================================================
| SIDEBAR OVERLAY (MOBILE)
================================================================================
*/
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.is-visible {
    display: block;
    opacity: 1;
}

/*
================================================================================
| RESPONSIVE
================================================================================
*/
@media (max-width: 1400px) {
    .stat-card-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .admin-content {
        padding: var(--space-6);
    }
    
    .chat-list-panel {
        width: 280px;
    }
}

@media (min-width: 993px) and (max-width: 1100px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/*
================================================================================
| SPECIFIC TABLE ALIGNMENTS
================================================================================
*/
#users-table th:nth-child(2),
#users-table td:nth-child(2),
#users-table th:nth-child(3),
#users-table td:nth-child(3),
#users-table th:nth-child(4),
#users-table td:nth-child(4) {
    text-align: right;
    font-family: var(--font-mono);
}

#deposits-table th:nth-child(4),
#deposits-table td:nth-child(4),
#deposits-table th:nth-child(5),
#deposits-table td:nth-child(5) {
    text-align: right;
    font-family: var(--font-mono);
}

#withdrawals-table th:nth-child(4),
#withdrawals-table td:nth-child(4),
#withdrawals-table th:nth-child(5),
#withdrawals-table td:nth-child(5) {
    text-align: right;
    font-family: var(--font-mono);
}

#referrals-table th:nth-child(4),
#referrals-table td:nth-child(4),
#referrals-table th:nth-child(5),
#referrals-table td:nth-child(5),
#referrals-table th:nth-child(6),
#referrals-table td:nth-child(6) {
    text-align: right;
    font-family: var(--font-mono);
}

/*
================================================================================
| FOCUS STATES (ACCESSIBILITY)
================================================================================
*/
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/*
================================================================================
| PRINT STYLES
================================================================================
*/
@media print {
    .admin-sidebar,
    .admin-header,
    .btn,
    .form-actions,
    .pagination-controls,
    .table-controls,
    #mobile-blocker,
    .modal,
    .sidebar-overlay,
    .spinner-overlay,
    #toast-container {
        display: none !important;
    }
    
    .admin-content {
        padding: 0;
    }
    
    body {
        background: white;
    }
}

/*
================================================================================
| MOBILE MENU TOGGLE
================================================================================
*/
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-2);
}

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block;
    }
}

/*
================================================================================
| CLOSE BUTTON FOR SUPPORT CHAT
================================================================================
*/
#support-chat-close-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    padding: var(--space-2);
    cursor: pointer;
    transition: color var(--transition-fast);
    border-radius: var(--radius-sm);
}

#support-chat-close-btn:hover {
    color: var(--color-danger);
}

/*
================================================================================
| SKELETON LOADING
================================================================================
*/
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-card) 0%,
        var(--color-bg-elevated) 50%,
        var(--color-bg-card) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/*
================================================================================
| LOADING STATE
================================================================================
*/
.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

/*
================================================================================
| CHART CANVAS
================================================================================
*/
#admin-chart-canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 350px;
}

/*
================================================================================
| DROPDOWN
================================================================================
*/
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: var(--space-2);
    z-index: 100;
    display: none;
}

.dropdown-menu.is-visible {
    display: block;
}

.dropdown-item {
    display: block;
    padding: var(--space-2) var(--space-3);
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

/* Remove inner glow/shadow on hover */
.dropdown-item:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

/*
================================================================================
| DIVIDER
================================================================================
*/
.divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-6) 0;
}

/*
================================================================================
| EMPTY STATE
================================================================================
*/
.empty-state {
    text-align: center;
    padding: var(--space-10);
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: var(--space-4);
}

/*
================================================================================
| SELECTION STYLING
================================================================================
*/
::selection {
    background: var(--color-primary);
    color: white;
}

/*
================================================================================
| SMOOTH SCROLLING
================================================================================
*/
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/*
================================================================================
| HIGH CONTRAST MODE
================================================================================
*/
@media (prefers-contrast: high) {
    :root {
        --color-border: #9CA3AF;
    }
}

/* End of Professional Admin Panel CSS */