/* 
🚀 MODERN PROFESSIONAL DASHBOARD - SpicyBot 2025
Inspired by MEE6, Carl-bot, Dyno design patterns
*/

/* CSS Variables for Dark/Light Mode */
:root {
    /* Dark Mode (Default) */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --bg-card: #1e1e1e;
    --bg-hover: #252525;
    
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #7a7a7a;
    
    --border-primary: #333333;
    --border-secondary: #404040;
    
    --accent-primary: #5865f2;
    --accent-secondary: #4752c4;
    --accent-success: #00d26a;
    --accent-warning: #faa61a;
    --accent-danger: #ed4245;
    
    --shadow-small: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-large: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-medium: 0.25s ease;
    --transition-slow: 0.35s ease;
}

/* Light Mode Variables */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f4;
    --bg-card: #ffffff;
    --bg-hover: #e3f2fd;
    
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    
    --border-primary: #dee2e6;
    --border-secondary: #ced4da;
    
    --shadow-small: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Light mode specific overrides */
[data-theme="light"] body {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-right: 1px solid var(--border-primary);
}

[data-theme="light"] .top-bar {
    background: rgba(248, 249, 250, 0.95);
    backdrop-filter: blur(20px);
}

[data-theme="light"] .stat-card,
[data-theme="light"] .server-card,
[data-theme="light"] .card {
    background: #ffffff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e5e7eb !important;
}

[data-theme="light"] .nav-item:hover {
    background: #e3f2fd;
}

[data-theme="light"] .nav-item.active {
    background: rgba(88, 101, 242, 0.08);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
}

/* Light mode button styles */
[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.2);
}

[data-theme="light"] .btn-secondary {
    background: #f8f9fa;
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Light mode user avatar */
[data-theme="light"] .user-avatar {
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.15);
}

/* Light mode dropdown */
[data-theme="light"] .user-dropdown-menu {
    background: #ffffff;
    border: 1px solid var(--border-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Light mode activity chart */
[data-theme="light"] .activity-chart {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Light mode loading spinner */
[data-theme="light"] .loading-spinner {
    border-color: #f1f3f4;
    border-top-color: var(--accent-primary);
}

/* Light mode scrollbar */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: #f8f9fa;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #dee2e6;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-medium);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Theme Toggle Button - Enhanced */
.theme-toggle {
    position: relative;
    width: 64px;
    height: 32px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-hover));
    border: 1px solid var(--border-secondary);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-medium);
    display: flex;
    align-items: center;
    padding: 3px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 0 0 3px rgba(88, 101, 242, 0.15);
    transform: scale(1.02);
}

.theme-toggle-slider {
    position: absolute;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #4f46e5, var(--accent-primary));
    border-radius: 50%;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 1px 3px rgba(0, 0, 0, 0.1);
    left: 3px;
}

.theme-toggle-slider svg {
    width: 14px;
    height: 14px;
    fill: white;
    transition: all var(--transition-fast);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

[data-theme="light"] .theme-toggle {
    background: linear-gradient(135deg, #fef3c7, #fbbf24);
    border-color: #f59e0b;
}

[data-theme="light"] .theme-toggle-slider {
    transform: translateX(32px);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 
        0 2px 8px rgba(245, 158, 11, 0.4),
        0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Sidebar - Modern Design */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    z-index: 1000;
    transition: all var(--transition-medium);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.2rem;
}

.logo img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

/* Navigation */
.nav-menu {
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-medium);
    text-decoration: none;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width var(--transition-medium);
    border-radius: var(--radius-medium);
    opacity: 0.1;
}

.nav-item:hover::before {
    width: 100%;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    transform: translateX(4px);
}

.nav-item.active {
    color: var(--accent-primary);
    background: rgba(88, 101, 242, 0.1);
    border-left: 3px solid var(--accent-primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    background: var(--bg-primary);
    transition: all var(--transition-medium);
}

/* Top Bar - Professional Design */
.top-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-primary);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-title-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
}

.page-title-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Stats Grid - Modern Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-large);
    padding: 24px;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

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

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

/* Discord Servers Section */
.discord-servers-section {
    padding: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-primary);
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
}

.refresh-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-small);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-small);
}

/* Server Cards - Dyno Style Ultra Premium */
.server-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-primary) !important;
    border-radius: 16px !important;
    padding: 24px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    height: 200px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), #00d26a);
    transform: translateX(-100%);
    transition: transform 0.4s ease;
}

.server-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.03), rgba(71, 82, 196, 0.05));
    opacity: 0;
    transition: opacity var(--transition-medium);
    pointer-events: none;
    border-radius: 16px;
}

.server-card:hover::before {
    transform: translateX(0);
}

.server-card:hover::after {
    opacity: 1;
}

.server-card:hover {
    transform: translateY(-8px) scale(1.02) !important;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(88, 101, 242, 0.2) !important;
    border-color: transparent !important;
}

/* Server Card Header */
.server-card-header {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
}

.server-icon {
    width: 48px !important;
    height: 48px !important;
    border-radius: 16px !important;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: 1.2rem !important;
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.3) !important;
    transition: all var(--transition-fast) !important;
}

.server-card:hover .server-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(88, 101, 242, 0.4) !important;
}

.server-name {
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    color: var(--text-primary) !important;
    margin: 0 !important;
    line-height: 1.3 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.server-id {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    font-family: 'JetBrains Mono', monospace !important;
    opacity: 0.8 !important;
}

/* Server Card Stats */
.server-stats {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin: 16px 0 !important;
}

.stat-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
}

.stat-value {
    font-weight: 700 !important;
    font-size: 1.2rem !important;
    color: var(--text-primary) !important;
    line-height: 1 !important;
}

.stat-label {
    font-size: 0.7rem !important;
    color: var(--text-secondary) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-top: 2px !important;
}

/* Server Card Footer */
.server-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.server-status {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
}

.status-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: var(--accent-success) !important;
    animation: pulse 2s infinite !important;
}

.server-badges {
    display: flex !important;
    gap: 6px !important;
}

.server-badge {
    padding: 4px 8px !important;
    background: rgba(88, 101, 242, 0.1) !important;
    color: var(--accent-primary) !important;
    border-radius: 12px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    border: 1px solid rgba(88, 101, 242, 0.2) !important;
}

.server-badge.owner {
    background: rgba(0, 210, 106, 0.1) !important;
    color: var(--accent-success) !important;
    border-color: rgba(0, 210, 106, 0.2) !important;
}

.server-badge.premium {
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    color: white !important;
    border: none !important;
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Light mode server cards */
[data-theme="light"] .server-card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .server-card:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(88, 101, 242, 0.2) !important;
}

/* Light mode stats cards - CRITICAL FIX */
[data-theme="light"] .stat-card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .stat-card:hover {
    background: #ffffff !important;
    border-color: rgba(88, 101, 242, 0.3) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

/* Light mode activity chart */
[data-theme="light"] .activity-chart {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

/* Light mode card headers */
[data-theme="light"] .card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .bot-card-compact,
[data-theme="light"] .category-item {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .bot-card-compact:hover,
[data-theme="light"] .category-item:hover {
    background: #f8f9fa !important;
    border-color: rgba(88, 101, 242, 0.2) !important;
}

/* Light mode discord servers section */
[data-theme="light"] #discordServersList {
    background: #ffffff !important;
}

/* Activity Chart */
.activity-chart {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-large);
    padding: 24px;
    margin: 24px;
}

/* Buttons - Modern Style */
.btn {
    padding: 12px 24px;
    border-radius: var(--radius-medium);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: var(--shadow-small);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-small);
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-medium);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-medium);
    padding: 8px;
    min-width: 150px;
    box-shadow: var(--shadow-large);
    z-index: 1000;
    display: none;
}

.user-dropdown-menu.show {
    display: block;
    animation: dropdownSlideIn 0.2s ease;
}

@keyframes dropdownSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    color: var(--text-primary);
    text-align: left;
    border-radius: var(--radius-small);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

/* Loading States */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-primary);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-medium);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    
    .top-bar {
        padding: 12px 16px;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Smooth Transitions */
* {
    scroll-behavior: smooth;
}

/* Focus States */
*:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--accent-primary);
    color: white;
}