/* 
   Central stylesheet for the status monitoring portal.
   Contains base layouts, responsive adjustments (desktop & mobile directly together), as well as styles for cards, charts, and status badges.
*/

/* ==========================================================================
   0. Variables & Dark Mode Support
   ========================================================================== */
:root {
    --bg-color: #f4f7f9;
    --container-bg: #ffffff;
    --text-primary: #1c1e21;
    --text-secondary: #4a5568;
    --border-color: #e2e8f0;
    --header-bg-start: #002337;
    --header-bg-end: #003a5c;
    --card-shadow: 0 10px 25px rgba(0,0,0,0.05);
    --input-bg: #ffffff;
    --input-focus: #004a99;
    --table-header-bg: #f8fafc;
    --link-color: #004a99;
    --status-ok: #48bb78;
    --status-error: #f56565;
    --status-warning: #ed8936;
    --msg-error: #d32f2f;
    --msg-success: #2e7d32;
}

.dark-mode {
    --bg-color: #0f172a;
    --container-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --header-bg-start: #1e293b;
    --header-bg-end: #1e293b;
    --card-shadow: 0 10px 25px rgba(0,0,0,0.3);
    --input-bg: #0f172a;
    --input-focus: #3b82f6;
    --table-header-bg: #334155;
    --link-color: #60a5fa;
    --status-ok: #4ade80;
    --status-error: #fb7185;
    --status-warning: #fbbf24;
    --msg-error: #f87171;
    --msg-success: #4ade80;
}

/* ==========================================================================
   1. Global & Base Styles
   ========================================================================== */

* { 
    box-sizing: border-box; 
}

body { 
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif; 
    background: var(--bg-color); 
    margin: 0; 
    color: var(--text-primary); 
    line-height: 1.5; 
    transition: background-color 0.3s, color 0.3s;
}

/* Main Container */
.container { 
    background: var(--container-bg); 
    padding: 30px; 
    border-radius: 12px; 
    box-shadow: var(--card-shadow); 
    max-width: 1400px; 
    margin: 20px auto; 
}

/* ==========================================================================
   Base Form Elements (Inputs, Selects, Buttons)
   ========================================================================== */

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: var(--input-bg);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.2s ease-in-out;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.1), 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Detail Pages Wrapper */
.details-page { 
    padding: 20px; 
}
@media (max-width: 991px) {
    .details-page { padding: 10px; }
}

.details-page .container { 
    margin: 10px auto 0 auto; 
    max-width: 100%; 
}
@media (max-width: 991px) {
    .details-page .container { padding: 15px 10px; margin: 0; max-width: 100%; border-radius: 12px; }
}


/* Dark Mode Toggle Button */
.theme-toggle {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    margin-left: 10px;
    outline: none;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }

.dark-mode .theme-toggle .sun { display: block; }
.dark-mode .theme-toggle .moon { display: none; }

.main-header { 
    background: linear-gradient(135deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%); 
    padding: 20px 40px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    position: relative;
    z-index: 100;
}
@media (max-width: 991px) {
    .main-header { padding: 15px 20px; margin-bottom: 20px; }
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Burger Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.menu-toggle .bar {
    width: 30px;
    height: 3px;
    background-color: #ffffff;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.menu-toggle.active .bar:nth-child(1) {
    transform: rotate(45deg);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.menu-toggle.active .bar:nth-child(3) {
    transform: rotate(-45deg);
}

@media (max-width: 991px) {
    .menu-toggle {
        display: flex;
    }

    .header-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--header-bg-start);
        flex-direction: column;
        padding: 20px;
        gap: 10px;
        box-shadow: 0 10px 15px rgba(0,0,0,0.2);
    }

    .header-nav.active {
        display: flex;
    }

    .main-header .header-button {
        width: 100%;
        justify-content: center;
        margin-left: 0 !important;
    }

    .user-info {
        width: 100%;
        flex-direction: column;
        align-items: center;
        margin-left: 0 !important;
        padding: 15px 0 10px 0;
        cursor: default !important;
    }

    .user-dropdown {
        display: block !important;
        position: static;
        margin-top: 10px;
        background: transparent;
        box-shadow: none;
        border: none;
        width: 100%;
        text-align: center;
        min-width: 0;
    }

    .user-dropdown::before,
    .user-info.has-dropdown::after {
        display: none !important;
    }

    .user-dropdown a {
        color: #ffffff;
        background: rgba(225, 29, 72, 0.1);
        border-radius: 8px;
        text-align: center !important;
        padding: 8px 20px;
        display: inline-block;
        width: auto;
        min-width: 120px;
    }

    .user-dropdown a:hover {
        background: rgba(225, 29, 72, 0.2);
        color: #ffffff;
    }
}

.main-header h1 { 
    margin: 0; 
    font-size: 1.8em; 
    color: #ffffff; 
    letter-spacing: -0.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
@media (max-width: 991px) {
    .main-header h1 { font-size: 1.4em; flex-direction: column; align-items: flex-start; }
}

/* User Info in Header */
.user-info {
    margin-left: 20px;
    display: flex;
    align-items: center;
    padding: 0;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    transition: all 0.2s ease;
}

.user-info.has-dropdown {
    cursor: pointer;
}

/* If header-nav is after h1, push it to the right on desktop */
.main-header h1 + .header-nav {
    margin-left: auto;
}

.user-info .user-icon {
    margin-right: 10px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    opacity: 1;
    filter: brightness(0) invert(1);
}

.user-info .user-name {
    letter-spacing: 0.3px;
}

/* Bridge to reach the dropdown */
.user-info.has-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 12px;
    z-index: 10;
}

/* User Dropdown */
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background-color: #ffffff;
    opacity: 1;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 150px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}

.user-info:hover .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
}

.user-dropdown a:hover {
    background: #f1f5f9;
    color: #e11d48;
}

/* Arrow for dropdown */
.user-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 25px;
    width: 12px;
    height: 12px;
    background-color: #ffffff;
    transform: rotate(45deg);
    border-left: 1px solid rgba(0,0,0,0.05);
    border-top: 1px solid rgba(0,0,0,0.05);
}

@media (max-width: 991px) {
    .user-info .user-name {
        margin-bottom: 5px;
    }
}

.main-header .brand { 
    color: #ffffff; 
}

.main-header .divider { 
    margin: 0 15px; 
    color: rgba(255,255,255,0.3); 
    font-weight: 300; 
}
@media (max-width: 991px) {
    .main-header .divider { display: none; }
}

.main-header .subtitle { 
    color: rgba(255,255,255,0.85); 
    font-weight: 400; 
    font-size: 0.9em; 
}
@media (max-width: 991px) {
    .main-header .subtitle { font-size: 0.8em; }
}

/* Header Button (e.g. for logs) */
.main-header .header-button {
    margin-left: auto;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.main-header .log-button {
    background: #e11d48;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2);
}

.main-header .log-button:hover {
    background: #fb1148;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.main-header .log-button:active,
.main-header .admin-button:active {
    transform: translateY(0);
}

.main-header .admin-button {
    background: #004a99;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0, 74, 153, 0.2);
}

.main-header .admin-button:hover {
    background: #003a7a;
    box-shadow: 0 4px 15px rgba(0, 74, 153, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.main-header .dashboard-button {
    background: #003a5c;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.main-header .dashboard-button:hover {
    background: #002337;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
    color: #fff;
}



/* ==========================================================================
   3. Overall Status Widget
   ========================================================================== */

/* Maintenance Banner */
.maintenance-events-banner {
    margin: 0 40px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    z-index: 1;
}

.event-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-radius: 0;
    background: #fff;
    box-shadow: var(--card-shadow);
    color: #333;
    margin-top: -10px;
    padding-top: 20px;
}

.event-item:first-child {
    margin-top: -15px;
}

.event-item:not(:first-child) {
    margin-top: 0;
    border-radius: 0;
    padding-top: 12px;
}

.event-item:last-child {
    border-radius: 0 0 16px 16px;
}

.event-type-maintenance { background: #fff3e0; }
.event-type-announcement { background: #e3f2fd; }
.event-type-outage { background: #ffebee; }

.event-icon { font-size: 1.2em; margin-right: 15px; }
.event-content { flex-grow: 1; display: flex; align-items: center; flex-wrap: wrap; }
.event-label { font-weight: bold; text-transform: uppercase; font-size: 0.8em; margin-right: 5px; opacity: 0.8; }
.event-title { font-weight: 600; }
.event-date { font-size: 0.85em; color: #666; margin-left: 8px; }
.event-link { text-decoration: none; color: inherit; font-weight: bold; font-size: 0.9em; transition: opacity 0.2s; white-space: nowrap; opacity: 0.8; }
.event-link:hover { opacity: 1; text-decoration: underline; }

.dark-mode .event-item { background: #1e293b; color: #f1f5f9; box-shadow: var(--card-shadow); }
.dark-mode .event-type-maintenance { background: #2d2410; }
.dark-mode .event-type-announcement { background: #101d2d; }
.dark-mode .event-type-outage { background: #2d1010; }
.dark-mode .event-date { color: #999; }

.maintenance-banner {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px 40px;
    margin: 20px 40px 20px 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--card-shadow);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

/* Statisches Banner direkt unter dem Gesamtstatus (wenn keine Events da sind) */
#overall-status + #maintenance-events-container:not(:has(.maintenance-events-banner)) + #maintenance-message-container > .maintenance-banner {
    margin-top: -25px;
    padding-top: 35px;
    border-radius: 0 0 16px 16px;
}

/* Statisches Banner unter dem Event-Banner */
#maintenance-events-container:has(.maintenance-events-banner) + #maintenance-message-container > .maintenance-banner {
    margin-top: -15px;
    padding-top: 25px;
    border-radius: 0 0 16px 16px;
}

.dark-mode .maintenance-banner {
    background: #3e2b00;
    border-color: #5c4200;
    color: #ffcc00;
}

.maintenance-icon {
    font-size: 1.5em;
}

.maintenance-text {
    font-weight: 500;
    line-height: 1.4;
}

@media (max-width: 991px) {
    .maintenance-banner { margin: -15px 10px 20px 10px; padding: 20px 15px 12px 15px; }
    .maintenance-events-banner { margin: 0 10px 20px 10px; }
    .event-item { padding-top: 15px; margin-top: -8px; border-radius: 0; }
    .event-item:first-child { margin-top: -12px; }
    .event-item:last-child { border-radius: 0 0 12px 12px; }
}

/* Dashboard Controls (Filter, etc) */
.dashboard-controls {
    padding: 0 40px;
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
}
@media (max-width: 991px) {
    .dashboard-controls { padding: 0 10px; }
}

.search-wrapper {
    position: relative;
    width: 300px;
}
@media (max-width: 991px) {
    .search-wrapper { width: 100%; }
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

#node-search {
    padding-left: 40px;
    background: var(--container-bg);
}

.overall-status-container {
    padding: 0 40px;
    margin-bottom: 0px;
    margin-top: 0px;
    position: relative;
    z-index: 2;
}
@media (max-width: 991px) {
    .overall-status-container { padding: 0 10px; margin-bottom: 0px; }
}

.overall-card {
    background: var(--container-bg);
    padding: 20px 30px 20px 22px;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    border-left: 8px solid #48bb78;
    transition: all 0.3s ease;
}
@media (max-width: 991px) {
    .overall-card { padding: 12px 17px 12px 17px; border-radius: 12px; }
}

.overall-card.ok { border-left-color: #48bb78; }
.overall-card.warning { border-left-color: #ed8936; }
.overall-card.error { border-left-color: #f56565; }

.overall-icon {
    font-size: 2em;
    margin-right: 20px;
}

.overall-text {
    font-weight: 600;
    font-size: 1.2em;
    color: var(--text-primary);
}

.overall-details {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
}


/* ==========================================================================
   4. Dashboard Grid & Headings
   ========================================================================== */

h2 { 
    margin: 40px 40px 20px 40px; 
    color: var(--text-primary); 
    font-size: 1.4em; 
    font-weight: 600; 
}
@media (max-width: 991px) {
    h2 { margin: 25px 20px 20px 20px; }
}

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); 
    gap: 30px; 
    padding: 0 40px; 
    margin-bottom: 40px; 
}
@media (max-width: 991px) {
    .grid { padding: 0 10px; grid-template-columns: 1fr; gap: 20px; margin-bottom: 25px; }
}


/* ==========================================================================
   5. Service Cards (Node Cards)
   ========================================================================== */

.node-card { 
    background: var(--container-bg); 
    padding: 24px 24px 24px 18px; 
    border-radius: 16px; 
    box-shadow: var(--card-shadow);
    border-left: 6px solid var(--border-color); 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
@media (max-width: 991px) {
    .node-card { padding: 12px 22px 12px 22px; border-radius: 12px; }
}

.node-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.node-card.ok { border-left-color: var(--status-ok); }
.node-card.error, .node-card.critical { border-left-color: var(--status-error); }
.node-card.warning, .node-card.degraded { border-left-color: var(--status-warning); }

.node-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px; 
}

.node-name { 
    font-size: 1.2em; 
    font-weight: bold; 
}

.node-status { 
    font-size: 0.9em; 
    padding: 2px 10px; 
    border-radius: 12px; 
    background: #eee; 
    font-weight: bold; 
}
.node-status.online, .node-status.consistent { background-color: var(--status-ok); color: white; }
.node-status.offline, .node-status.inconsistent, .node-status.critical { background-color: var(--status-error); color: white; }
.node-status.degraded, .node-status.warning, .node-status.error { background-color: var(--status-warning); color: white; }

.node-details { 
    font-size: 0.85em; 
    color: var(--text-secondary); 
    line-height: 1.6; 
    flex: 1; 
}

.node-footer { 
    margin-top: 20px; 
    padding-top: 10px; 
    border-top: 1px solid var(--border-color); 
    text-align: right; 
}


/* ==========================================================================
   6. Measurement Grid (Inner Node Details)
   ========================================================================== */

.node-details-grid {
    display: grid;
    grid-template-columns: min-content auto min-content;
    gap: 2px 15px;
    align-items: baseline;
    font-size: 0.85em;
    color: var(--text-secondary);
}

.db-row {
    display: contents;
}

.db-label {
    white-space: nowrap;
    color: var(--text-secondary);
    font-weight: 500;
}

.db-value {
    color: var(--text-primary);
    font-weight: 600;
    padding-right: 15px;
    word-break: break-all;
}

.db-ms {
    color: var(--text-secondary);
    font-size: 0.9em;
    text-align: right;
    opacity: 0.7;
}

.db-last-update { 
    font-size: 0.75em; 
    color: var(--text-secondary);
    opacity: 0.6;
    margin-bottom: 5px; 
}


/* ==========================================================================
   7. Detail Page Header & Controls (Selectors)
   ========================================================================== */

.header-flex { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 25px; 
    flex-wrap: wrap;
    gap: 20px;
}
@media (max-width: 991px) {
    .header-flex { flex-direction: column; align-items: flex-end; gap: 10px; }
}

.header-flex h1 {
    margin: 0;
    flex: 1;
    word-break: break-all;
}
@media (max-width: 991px) {
    .header-flex h1 { width: 100%; text-align: left; margin-bottom: 10px; flex: none; font-size: 1.3em; }
}

.selector-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
}
@media (max-width: 991px) {
    .selector-container { width: auto; justify-content: flex-end; }
}

.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 10px;
    transition: border-color 0.2s;
}

.select-wrapper:hover {
    border-color: #cbd5e0;
}

.select-wrapper span {
    margin-right: 5px;
    font-size: 1.1em;
}

.select-wrapper select {
    appearance: none;
    background: transparent;
    border: none;
    padding: 10px 25px 10px 5px;
    font-size: 0.95em;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    outline: none;
    width: auto;
    box-shadow: none;
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 12px;
    font-size: 0.7em;
    color: #a0aec0;
    pointer-events: none;
}


/* ==========================================================================
   8. Links & Buttons (Actions)
   ========================================================================== */

.details-link, 
.back-link, 
.back-btn { 
    text-decoration: none; 
    color: #2196F3; 
    font-size: 0.85em; 
    font-weight: bold; 
    transition: color 0.2s;
}

.back-link, 
.back-btn { 
    display: inline-block; 
    color: #1a73e8;
    font-size: 0.9em; 
}
@media (max-width: 991px) {
    .back-link, .back-btn {

    }
}

.back-link:hover, 
.back-btn:hover { 
    color: #1557b0; 
    text-decoration: underline; 
}


/* ==========================================================================
   9. Charts & Tables
   ========================================================================== */

.chart-container { 
    position: relative; 
    height: 350px; 
    width: 100%; 
    margin-bottom: 40px; 
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
    font-size: 0.9em; 
}

th, td { 
    text-align: left; 
    padding: 12px; 
    border-bottom: 1px solid #eee; 
    vertical-align: top; 
}

th { 
    background: #f8f8f8; 
    font-weight: bold; 
    color: #555; 
    position: sticky; 
    top: 0; 
}

.text-nowrap { 
    white-space: nowrap; 
}


/* ==========================================================================
   10. Badges, Icons & Status Indicators
   ========================================================================== */

.status-dot { 
    height: 10px; 
    width: 10px; 
    border-radius: 50%; 
    display: inline-block; 
    margin-right: 5px; 
}
.status-dot.ok, .status-dot.status-ok { background-color: var(--status-ok); }
.status-dot.error, .status-dot.status-error { background-color: var(--status-error); }
.status-dot.warning, .status-dot.status-warning { background-color: var(--status-warning); }

.check { color: var(--status-ok); font-weight: bold; text-align: center; }
.cross { color: var(--status-error); font-weight: bold; text-align: center; }



/* ==========================================================================
   11. Error Messages & Footer
   ========================================================================== */

.error-msg { 
    color: var(--msg-error); 
    font-size: 0.8em; 
    margin-top: 10px; 
    word-break: break-all; 
}

.loader { 
    font-size: 0.8em; 
    color: var(--text-secondary); 
    opacity: 0.6;
    font-style: italic; 
}

.page-footer {
    margin: 20px 40px 20px 20px;
    text-align: right;
    color: var(--text-secondary); 
    font-size: 0.85em;
    position: relative;
}

.refresh-progress-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 9999;
}

.refresh-progress-bar {
    height: 100%;
    background: var(--link-color);
    width: 0%;
    transition: width 1s linear;
}

.dark-mode .refresh-progress-container {
    background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 991px) {
    .page-footer { text-align: right; margin-right: 20px; }
}


/* ==========================================================================
   13. Visibility Settings (Public View Levels)
   ========================================================================== */

.view-errors-only .node-card.ok {
    display: none;
}

/* Overall only: Hide all details and grids for guests */
.view-overall-only .dashboard-controls,
.view-overall-only h2,
.view-overall-only .grid {
    display: none !important;
}

.view-overall-only .overall-status-container {
    margin-top: 40px;
    margin-bottom: 20px;
}

/* If banners follow, reset that margin */
.view-overall-only .overall-status-container:has(+ #maintenance-events-container > .maintenance-events-banner),
.view-overall-only .overall-status-container:has(+ #maintenance-events-container + #maintenance-message-container > .maintenance-banner) {
    margin-bottom: 0px;
}

/* Add margin to the last visible banner in overall-only mode */
.view-overall-only .maintenance-events-banner,
.view-overall-only .maintenance-banner {
    margin-bottom: 20px;
}

/* Reset margin if another banner follows */
.view-overall-only #maintenance-events-container:has(.maintenance-events-banner):has(+ #maintenance-message-container > .maintenance-banner) .maintenance-events-banner {
    margin-bottom: 0;
}

.view-errors-only #overall-status {
    display: block;
}


/* ==========================================================================
   14. Announcements & Maintenance Page
   ========================================================================== */

.announcements-page {
    padding: 20px 40px;
}

@media (max-width: 991px) {
    .announcements-page { padding: 10px 20px; }
}

.announcements-page h1 {
    font-size: 2.2em;
}

.announcement-card { 
    background: var(--container-bg); 
    border-radius: 12px; 
    padding: 25px 30px; 
    margin-bottom: 30px; 
    box-shadow: var(--card-shadow);
    border-left: 6px solid #ccc;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.announcement-card:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 12px 30px rgba(0,0,0,0.1); 
}

.dark-mode .announcement-card:hover {
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}

.announcement-card.type-maintenance { border-left-color: #f57c00; }
.announcement-card.type-announcement { border-left-color: #1976d2; }
.announcement-card.type-outage { border-left-color: #d32f2f; }

.announcement-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 20px; }
.announcement-title { font-size: 1.5em; margin: 0; color: var(--text-primary); line-height: 1.2; }
.announcement-meta { font-size: 0.9em; color: var(--text-secondary); margin-top: 5px; }
.announcement-content { line-height: 1.6; color: var(--text-primary); white-space: pre-wrap; font-size: 1.05em; }

.announcement-status { 
    display: inline-block; 
    padding: 5px 12px; 
    border-radius: 20px; 
    font-size: 0.75em; 
    font-weight: 700; 
    text-transform: uppercase;
    background: #eee;
    color: #444;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-scheduled { background: #f0f0f0; color: #616161; }
.status-in_progress { background: #e8f5e9; color: #2e7d32; }
.status-completed { background: #e8f5e9; color: #2e7d32; }
.status-cancelled, .status-canceled { background: #eeeeee; color: #757575; }

/* Dark Mode for Announcements */
.dark-mode .announcement-status { background: #334155; color: #cbd5e1; }
.dark-mode .status-scheduled { background: #1e293b; color: #94a3b8; }
.dark-mode .status-in_progress { background: #064e3b; color: #34d399; }
.dark-mode .status-completed { background: #064e3b; color: #34d399; }
.dark-mode .status-cancelled, .dark-mode .status-canceled { background: #334155; color: #94a3b8; }

@media (max-width: 600px) {
    .announcement-header { flex-direction: column; align-items: flex-start; }
    .announcement-status { order: -1; margin-bottom: 10px; }
    .announcement-card { padding: 20px; }
}
