:root {
    --bg-dark: #0a0b10;
    --bg-card: #151821;
    --accent-blue: #007bff;
    --accent-purple: #6f42c1;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Gradients & Images */
body.login-page {
    background: url('bg-monitoring.png') no-repeat center center fixed;
    background-size: cover;
}

body.login-page::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 16, 0.8); /* Overlay to make text readable */
    z-index: -1;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: rgba(21, 24, 33, 0.85);
    padding: 2.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    z-index: 1;
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container img {
    max-width: 180px;
    height: auto;
}

h1, h2, h3 {
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.auth-card h2 {
    text-align: center;
    background: linear-gradient(to right, #fff, #a0a0a0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    background: #1a1d26; /* Hard solid dark background */
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    transition: all 0.3s;
}

select option {
    background: #1a1d26; /* Ensure options are readable */
    color: white;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: #212530;
}

button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1rem;
    position: fixed;
    height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

/* Sidebar Menu */
.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
}

.menu-item:hover, .menu-item.active {
    background: var(--glass-bg);
    color: white;
}

.menu-item i {
    margin-right: 12px;
}

/* Cards & Components */
.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 15px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.95rem;
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-low { background: rgba(40, 167, 69, 0.2); color: #28a745; }
.badge-medium { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.badge-high { background: rgba(220, 53, 69, 0.2); color: #dc3545; }
.badge-urgent { background: #dc3545; color: white; }

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* =============================================
   MAX-ROBUST RESPONSIVE DESIGN
   ============================================= */
@media (max-width: 992px) {
    /* Main Layout */
    .dashboard-layout {
        display: block;
        width: 100%;
        overflow-x: hidden;
    }

    /* Sidebar Reset */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        background: #151821; /* Solid background */
        visibility: hidden;
    }

    .sidebar.active {
        transform: translateX(0);
        visibility: visible;
        box-shadow: 20px 0 50px rgba(0,0,0,0.8);
    }

    /* Content Area */
    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
        padding-top: 5rem; /* Space for the floating button */
        width: 100%;
        min-height: 100vh;
        position: relative;
        z-index: 1;
    }

    /* Floating Menu Button */
    .mobile-toggle {
        display: flex;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 10000;
        background: var(--accent-blue);
        width: 50px;
        height: 50px;
        border-radius: 12px;
        box-shadow: 0 5px 15px rgba(0,75,255,0.4);
        border: none;
        color: white;
        font-size: 1.4rem;
    }

    /* Grid Resets */
    [style*="display: grid"], 
    .stats-container, 
    .info-grid {
        grid-template-columns: 1fr !important;
        gap: 1.2rem !important;
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .header-actions .btn-sm {
        width: 100%;
        text-align: center;
        padding: 12px;
    }

    /* Dashboard Stats (Overview) */
    .stat-card {
        padding: 1.5rem;
    }

    /* Table Fixes */
    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: rgba(0,0,0,0.2);
        border-radius: 10px;
        padding: 5px;
    }

    table {
        min-width: 600px; /* Force scroll instead of squishing */
    }

    /* Forms on Mobile */
    .card form {
        display: flex;
        flex-direction: column !important;
    }

    .form-group {
        margin-bottom: 1.2rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    h1 {
        font-size: 1.4rem !important;
    }
    
    .main-content {
        padding: 10px;
        padding-top: 4.5rem;
    }

    .card {
        padding: 1rem;
    }

    .badge {
        font-size: 0.6rem;
    }
}
