/* ── Layout: sidebar + content ────────────────────────────────────────── */
#sidebar-wrapper {
    width: 250px;
    position: fixed;
    height: 100%;
    top: 0;
    z-index: 1000;
    background-color: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

#page-content-wrapper {
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Mobile: hide sidebar, show bottom nav, add bottom padding for it */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        display: none !important;
    }

    #page-content-wrapper {
        margin-left: 0 !important;
        /* space for the fixed bottom nav */
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }
}

/* Desktop: fixed sidebar with content pushed right */
@media (min-width: 992px) {
    #sidebar-wrapper {
        left: 0;
    }

    #page-content-wrapper {
        margin-left: 250px;
    }
}

/* ── Mobile bottom navigation ────────────────────────────────────────── */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: #fff;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    text-decoration: none;
    color: #6c757d;
    font-size: 0.7rem;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i {
    font-size: 1.25rem;
}

.bottom-nav-item.active {
    color: #0d6efd;
}

.bottom-nav-item:hover {
    color: #0d6efd;
    text-decoration: none;
}

.bottom-nav-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background: #dc3545;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    line-height: 1.1;
    min-width: 16px;
    text-align: center;
}

/* Floating action button (device settings cog) */
.fab-settings {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

@media (max-width: 991.98px) {
    .fab-settings {
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }
}

/* Custom styles for the cards */
.card {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); /* Increased shadow for a more pronounced effect */
    border: 1px solid #ddd; /* Light gray border for better definition */
    border-radius: 10px; /* Smooth, rounded corners */
    background-color: #f8f9fa; /* Slightly darker background color */
    transition: transform 0.2s, box-shadow 0.2s; /* Smooth transitions */
}

.card:hover {
    transform: translateY(-5px); /* Slight lift effect on hover */
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3); /* Darker shadow on hover */
}

/* Center text in card titles */
.card-title {
    font-weight: bold; /* Bold text for the title */
    font-size: 1.25rem; /* Slightly larger font size */
    color: #343a40; /* Darker text color */
}

/* Adjust card text color and spacing */
.card-text {
    color: #6c757d; /* Gray color for the card text */
    margin-top: 0.5rem; /* Spacing between the title and text */
}

/* Center cards in the row */
.row.justify-content-center {
    margin-top: 2rem; /* Add some space at the top */
    margin-bottom: 2rem; /* Add some space at the bottom */
}

@media (max-width: 768px) { /* Adjust this breakpoint as needed */
    .wide-mobile-tile {
        --bs-gutter-x: 10px;
    }
}

.content-tile {
    padding-left: 5px;
    padding-right: 5px;
}


/* Ensure the links have no text decoration and inherit the default color */
a.text-decoration-none {
    text-decoration: none;
    color: inherit;
}

.clickable-row {
    cursor: pointer;
}

/* ── Clickable nav cards (link to sub-pages) ─────────────────────── */

.clickable-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.clickable-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.clickable-card .card-body {
    position: relative;
}

.clickable-card .card-chevron {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--bs-secondary);
    font-size: 1.1rem;
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.clickable-card:hover .card-chevron {
    opacity: 1;
}

@media (max-width: 768px) {
    .btn-group-vertical {
        display: flex;
        flex-direction: column;
        align-items: center; /* Center buttons horizontally */
        width: 100%;
    }
    .btn-group-vertical .btn {
        margin-bottom: 20px;
        width: calc(100% - 20px); /* Ensure there's some space around the buttons, 10px on each side */
    }
    .btn-group-vertical .btn:last-child {
        margin-bottom: 0;
    }
}

.stream-container {
    position: relative;
    max-width: 100%;
    width: 100%;
    padding-bottom: 75%; /* 4:3 Aspect Ratio */
    background-color: black; /* Fallback for loading times */
    overflow: hidden;
}

.stream-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Contain ensures the entire image fits within the container */
    background-color: black; /* Optional: Set a background color for the container */
}

.loading-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Higher than the sidebar and content */
}

.loading-content {
    display: flex;
    flex-direction: column; /* Stack spinner and text vertically */
    justify-content: center;
    align-items: center; /* Ensure the spinner and text are centered */
    text-align: center;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 8px solid rgba(0, 0, 0, 0.1);
    border-top: 8px solid #007bff; /* Change color as needed */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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


footer {
    text-align: center;
    padding: 1rem 0;
    background: #f8f9fa;
}

/* Active nav state highlighting */
.list-group-item.active {
    background-color: #0d6efd !important;
    color: white !important;
    border-color: #0d6efd !important;
}

.list-group-item.active:hover {
    background-color: #0b5ed7 !important;
}

/* Password visibility toggle */
.password-wrapper {
    position: relative;
    display: block;
}

.password-wrapper input {
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    padding: 5px;
    font-size: 1.1rem;
    z-index: 10;
    line-height: 1;
}

.password-toggle:hover {
    color: #343a40;
}

.password-toggle:focus {
    outline: none;
}

/* Card title icons */
.card-title i {
    color: #0d6efd;
}

h2 i.fa-video {
    color: #0d6efd;
}

/* Status badges */
.status-badge {
    font-weight: 600;
    padding: 0.25em 0.6em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    display: inline-block;
}

.status-online {
    background-color: #d4edda;
    color: #155724;
}

.status-offline {
    background-color: #f8d7da;
    color: #721c24;
}

/* Alert card states */
.alert-card-active {
    border: 2px solid #dc3545;
    background-color: #fff5f5;
}

.alert-card-clear {
    border: 2px solid #28a745;
    background-color: #f6fff6;
}

.alert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0;
}

.alert-row-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.alert-dot-danger {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background-color: #dc3545;
    flex-shrink: 0;
}

.alert-dot-clear {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background-color: #28a745;
    flex-shrink: 0;
}

.alert-row-value {
    color: #6c757d;
    font-size: 0.85em;
}

/* ── Notification bell & dropdown ────────────────────────────────────────── */

#notification-bell {
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
}

#notification-bell:focus-visible {
    outline: 2px solid var(--bs-focus-ring-color, rgba(13, 110, 253, 0.25));
    outline-offset: 2px;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    line-height: 1;
    min-width: 16px;
    text-align: center;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-height: 420px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1050;
    overflow: hidden;
}

.notification-dropdown-body {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    transition: background 0.15s;
}

.notification-item:hover {
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
}

.notification-unread {
    background-color: #f0f7ff;
}

.notification-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.notification-severity-info {
    background-color: #17a2b8;
}

.notification-severity-warning {
    background-color: #ffc107;
}

.notification-severity-critical {
    background-color: #dc3545;
}

/* Notification history page */
.notification-history-item.notification-unread {
    background-color: #f0f7ff;
    border-left: 3px solid #0d6efd;
}

/* Card list items — inherit card background instead of Bootstrap white */
.card .list-group-item {
    background-color: transparent;
}

/* ── Onboarding wizard ───────────────────────────────────────────────── */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.onboarding-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 480px;
    width: 100%;
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.onboarding-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
    transition: background 0.2s;
}

.onboarding-dot.active {
    background: #0d6efd;
}

.onboarding-icon {
    margin-bottom: 1rem;
}

.onboarding-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.onboarding-tour-items {
    margin: 1rem 0;
}

.onboarding-tour-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: flex-start;
}

.onboarding-tour-item:last-child {
    border-bottom: none;
}

.onboarding-tour-item i {
    margin-top: 3px;
    flex-shrink: 0;
}

.onboarding-inline-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.onboarding-skip {
    display: block;
    margin: 0.75rem auto 0;
}

.onboarding-close {
    z-index: 1;
}

/* ── Observatory Calendar ─────────────────────────────────────────── */

.obs-calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--bs-secondary);
    margin-bottom: 0.25rem;
}

.obs-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.obs-calendar-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 6px 0;
    border: 2px solid transparent;
    transition: border-color 0.15s, background-color 0.15s;
}

.obs-calendar-cell:hover {
    background-color: rgba(0,0,0,0.05);
}

.obs-calendar-empty {
    cursor: default;
}

.obs-calendar-today {
    font-weight: 700;
    border-color: var(--bs-primary) !important;
}

.obs-calendar-selected {
    border-color: var(--bs-dark) !important;
    background-color: rgba(0,0,0,0.08);
}

/* Efficiency color coding */
.obs-calendar-eff-high {
    background-color: rgba(40, 167, 69, 0.2);
}

.obs-calendar-eff-mid {
    background-color: rgba(255, 193, 7, 0.2);
}

.obs-calendar-eff-low {
    background-color: rgba(220, 53, 69, 0.2);
}

.obs-calendar-eff-none.obs-calendar-has-data {
    background-color: rgba(108, 117, 125, 0.15);
}

.obs-calendar-num {
    font-size: 0.85rem;
}

.obs-calendar-badge {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    background-color: var(--bs-primary);
    color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Night chart container */
#chart-wrapper {
    max-height: 400px;
}

.chart-toggle.active {
    background-color: var(--bs-secondary);
    color: #fff;
}

/* Responsive: smaller calendar cells on mobile */
@media (max-width: 576px) {
    .obs-calendar-cell {
        font-size: 0.75rem;
        padding: 4px 0;
    }
    .obs-calendar-grid {
        gap: 2px;
    }
    .obs-calendar-badge {
        width: 14px;
        height: 14px;
        font-size: 0.55rem;
    }
    .obs-calendar-day-name {
        font-size: 0.7rem;
    }
}

/* ── Dome Health Page ──────────────────────────────────────────────── */

.dome-health-chart-wrapper {
    position: relative;
    height: 300px;
}

.dome-health-anomaly-alert {
    border-left: 4px solid var(--bs-danger);
}

.dome-health-anomaly-clear {
    border-left: 4px solid var(--bs-success);
}

/* P1 Meter — Hero Power Display */
.power-hero {
    text-align: center;
    padding: 1rem 1rem 0.5rem;
}

.power-hero-value {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.power-hero-label {
    font-size: 0.95rem;
    color: var(--bs-secondary);
    margin-top: 0.25rem;
}

.power-hero-consuming .power-hero-value {
    color: var(--bs-body-color);
}

.power-hero-returning .power-hero-value {
    color: var(--bs-success);
}

/* Compact metadata row below hero */
.power-hero-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    color: var(--bs-secondary);
}

/* P1 Meter — Inline Power Chart */
.power-chart-wrapper {
    position: relative;
    height: 200px;
}

/* P1 Meter — Technical Section Toggle */
.technical-toggle {
    cursor: pointer;
    user-select: none;
}

.technical-toggle-icon {
    transition: transform 0.25s ease;
    display: inline-block;
}

.technical-toggle[aria-expanded="true"] .technical-toggle-icon {
    transform: rotate(90deg);
}

