/* Google Fonts - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Premium Dark Theme Palette - Slate/Violet */
    --background: #0f172a;
    /* Slate 900 */
    --surface: #1e293b;
    /* Slate 800 */
    --surface-hover: #334155;
    /* Slate 700 */
    --border: rgba(255, 255, 255, 0.08);

    /* Text Colors */
    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --text-tertiary: #64748b;
    /* Slate 500 */

    /* Brand Colors - Violet/Purple Gradient */
    --primary: #8b5cf6;
    /* Violet 500 */
    --primary-hover: #7c3aed;
    /* Violet 600 */
    --primary-glow: rgba(139, 92, 246, 0.3);
    --secondary: #ec4899;
    /* Pink 500 */

    /* Status Colors */
    --success: #10b981;
    /* Emerald 500 */
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    /* Amber 500 */
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    /* Red 500 */
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    /* Blue 500 */
    --info-bg: rgba(59, 130, 246, 0.15);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 15px rgba(139, 92, 246, 0.15);

    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent body scroll, use container scroll */
}

/* Layout Structure */
.container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.header {
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
}

.layout-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    /* Important for independent scrolling */
}

/* Header Styling */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.025em;
}

.logo i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.server-time {
    font-family: 'Inter', monospace;
    color: var(--text-secondary);
    font-size: 0.875rem;
    background: var(--surface);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.user-profile:hover {
    background: var(--surface);
}

.avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Sidebar Navigation */
.navigation {
    width: var(--sidebar-width);
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9375rem;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

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

.nav-link.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05));
    color: var(--primary);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.nav-link.active i {
    color: var(--primary);
}

.nav-link.external {
    margin-top: auto;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding-top: 1.5rem;
}

.status-indicator-mini {
    margin-top: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.status-dot.status-up {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Main Content Area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 40%);
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Cards & Widgets */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(139, 92, 246, 0.3);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    opacity: 0;
    transition: var(--transition);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.metric-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-feature-settings: "tnum";
}

.metric-detail {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Specific Status Colors for Text */
.status-up {
    color: var(--success) !important;
}

.status-down {
    color: var(--danger) !important;
}

.status-warning {
    color: var(--warning) !important;
}

/* Chart Containers */
.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
    margin-top: 1rem;
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
    font-size: 0.875rem;
    align-items: center;
}

.activity-time {
    color: var(--text-tertiary);
    font-feature-settings: "tnum";
    min-width: 80px;
}

.activity-message {
    color: var(--text-secondary);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

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

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

/* Tags/Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

/* Footer */
.footer {
    padding: 2rem;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(139, 92, 246, 0.5);
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .layout-wrapper {
        flex-direction: column;
        overflow: auto;
    }

    .navigation {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        flex-direction: row;
        overflow-x: auto;
    }

    .nav-links {
        flex-direction: row;
        width: max-content;
    }

    .main-content {
        padding: 1rem;
    }

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

    .status-indicator-mini {
        display: none;
    }
}