:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --debug: #8b5cf6;

    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-hover: #f1f5f9;

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;

    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);

    --sidebar-width: 260px;
    --topbar-height: 70px;
}

/* Dark Mode */
body.dark-mode {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-hover: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #64748b;

    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

body.dark-mode .log-badge.info {
    background: #1e3a5f;
    color: #93c5fd;
}

body.dark-mode .log-badge.warn {
    background: #4a3619;
    color: #fbbf24;
}

body.dark-mode .log-badge.error {
    background: #4a1d1d;
    color: #fca5a5;
}

body.dark-mode .log-badge.debug {
    background: #3b2a5f;
    color: #c4b5fd;
}

body.dark-mode .log-player {
    background: #1e3a2f;
    color: #6ee7b7;
}

body.dark-mode .log-source {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
}

body.dark-mode .select-input,
body.dark-mode .search-bar input {
    color: var(--text-primary);
}

body.dark-mode .select-input option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Desktop only: fixed height and no scroll */
@media (min-width: 768px) {
    body {
        overflow: hidden;
        height: 100vh;
    }
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.logo-text span {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-menu {
    flex: 1;
    padding: 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 4px;
}

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

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

/* Sidebar Stats */
.sidebar-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    overflow-y: hidden;
    flex: 1;
}

.stat-card-sidebar {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.stat-card-sidebar:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.stat-card-sidebar .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-sidebar .stat-icon svg {
    width: 18px;
    height: 18px;
}

.stat-card-sidebar .stat-content {
    flex: 1;
    min-width: 0;
}

.stat-card-sidebar .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card-sidebar .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.server-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.server-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
}

.status-dot.online {
    background: var(--success);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background: var(--error);
}

.server-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
}

.server-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.server-info-item svg {
    color: var(--primary);
    flex-shrink: 0;
}

.server-info-item span {
    font-weight: 500;
    color: var(--text-primary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* Desktop only: fixed height and no scroll */
@media (min-width: 768px) {
    .main-content {
        height: 100vh;
        overflow: hidden;
    }
}

/* Top Bar */
.top-bar {
    flex-shrink: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 50;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 16px;
    width: 400px;
    transition: all 0.2s;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-bar svg {
    color: var(--text-light);
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-light);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.icon-btn.danger:hover {
    background: #fee2e2;
    color: var(--error);
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.auto-refresh-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.username {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.logout-btn {
    background: #fee2e2 !important;
    color: var(--error) !important;
}

.logout-btn:hover {
    background: #fecaca !important;
    transform: translateY(-2px);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 32px;
    flex-shrink: 0;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-icon.bg-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.bg-green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.bg-yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.bg-red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon.bg-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

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

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 16px;
    padding: 0 32px 24px;
    flex-shrink: 0;
}

.filter-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-item label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.select-input {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.select-input:hover {
    border-color: var(--primary);
}

.select-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Logs Section */
.logs-section {
    padding: 0 32px 32px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.logs-count {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.logs-count span {
    color: var(--primary);
    font-weight: 700;
}

.logs-table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-y: auto;
}

/* Custom Scrollbar */
.logs-table-container::-webkit-scrollbar {
    width: 8px;
}

.logs-table-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.logs-table-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.logs-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Log Entry */
.log-entry {
    display: grid;
    grid-template-columns: 80px 120px 150px 1fr 140px;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s;
    animation: slideIn 0.3s ease-out;
}

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

.log-entry:last-child {
    border-bottom: none;
}

.log-entry:hover {
    background: var(--bg-hover);
}

.log-header {
    display: contents;
}

.log-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.log-badge.info {
    background: #dbeafe;
    color: #1e40af;
}

.log-badge.warn {
    background: #fef3c7;
    color: #92400e;
}

.log-badge.error {
    background: #fee2e2;
    color: #991b1b;
}

.log-badge.debug {
    background: #ede9fe;
    color: #5b21b6;
}

.log-script {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log-source {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    font-family: 'Monaco', 'Courier New', monospace;
}

.log-timestamp {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    text-align: right;
}

.log-message {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.log-player {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #d1fae5;
    color: #065f46;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.log-metadata {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.log-metadata pre {
    font-size: 12px;
    font-family: 'Monaco', 'Courier New', monospace;
    color: var(--text-secondary);
    overflow-x: auto;
}

/* Empty State */
.no-logs {
    padding: 80px 40px;
    text-align: center;
    color: var(--text-secondary);
}

.no-logs-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-logs h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.no-logs p {
    font-size: 14px;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .top-bar {
        padding: 0 16px;
        flex-wrap: wrap;
        height: auto;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .search-bar {
        width: 100%;
        order: 3;
        margin-top: 12px;
    }

    .top-actions {
        order: 2;
    }

    .user-profile {
        order: 1;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 16px;
    }

    .filters-bar {
        flex-direction: column;
        padding: 0 16px 16px;
    }

    .logs-section {
        padding: 0 16px 16px;
    }

    .log-entry {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 16px;
    }

    .log-badge,
    .log-script,
    .log-source {
        width: fit-content;
    }

    .log-timestamp {
        text-align: left;
        font-size: 11px;
    }

    .auto-refresh-label {
        display: none;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .top-actions {
        gap: 6px;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
    }

    .icon-btn svg {
        width: 16px;
        height: 16px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .username {
        font-size: 13px;
    }

    .log-entry {
        padding: 10px 12px;
    }

    .log-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .log-script,
    .log-source {
        font-size: 11px;
        padding: 3px 8px;
    }

    .log-message {
        font-size: 13px;
    }
}
