/* ============================================
   COMPACT DASHBOARD - NO SCROLL LAYOUT
   70% Functional Area / 30% Ads
   ============================================ */

/* Reset and Layout Foundation */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* NO SCROLLING */
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
}

/* Main Layout: 70% Dashboard + 30% Ads */
.dashboard {
    flex: 0 0 70vh; /* Fixed 70% of viewport height */
    overflow: hidden;
    background: white;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.ad-placeholder {
    flex: 0 0 30vh; /* Fixed 30% of viewport height */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    text-align: center;
    border-top: 3px solid #667eea;
    color: #666;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.05);
}

/* ============================================
   COMPACT HEADER - 60px MAX
   ============================================ */
.header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    min-height: 60px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(to right, #ffffff 0%, #f8f9fa 100%);
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.title-section {
    flex: 0 1 auto;
    min-width: 0; /* Allow shrinking */
    max-width: 50%; /* Don't take more than half on mobile */
}

.title {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.controls-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
}

/* Desktop: hide the subsegment wrappers, show direct children */
.controls-left,
.controls-center,
.controls-right {
    display: contents; /* Makes wrapper invisible, children render as if wrapper doesn't exist */
}

.button-group {
    display: contents; /* Same for button group */
}

.time-display, .last-updated {
    font-size: 10px;
    color: #6c757d;
    background-color: #f1f3f5;
    padding: 4px 8px;
    border-radius: 12px;
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    font-weight: 600;
    white-space: nowrap;
}

.feedback-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    background: #f1f3f5;
    border-radius: 8px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
}

.feedback-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.feedback-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.feedback-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.feedback-btn.disabled:hover {
    background: white;
    transform: none;
}

/* ============================================
   CAMERA STATUS DOT ANIMATION
   ============================================ */
@keyframes camera-pulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
    }
    50% {
        box-shadow: 0 0 0 2px rgba(255,255,255,0.3), 0 0 0 6px rgba(0,200,83,0.2);
    }
}

.camera-fullscreen-btn:hover {
    background: rgba(0,0,0,0.8) !important;
    transform: scale(1.05);
}

/* ============================================
   CONNECTION STATUS - COMPACT
   ============================================ */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f8f9fa;
    border-radius: 16px;
    font-size: 9px;
    font-weight: 700;
    color: #666;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #dc3545;
    position: relative;
    transition: background-color 0.3s ease;
}

.status-dot::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0;
}

.connection-status.connected .status-dot {
    background: #00C853;
    box-shadow: 0 0 0 2px rgba(0, 200, 83, 0.2);
}

.connection-status.connected .status-dot::before {
    border-color: #00C853;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.connection-status.updating .status-dot {
    background: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
    animation: pulse-dot 1s ease-in-out infinite;
}

.connection-status.updating .status-dot::before {
    border-color: #667eea;
    animation: pulse-ring 1s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.connection-status.disconnected .status-dot {
    background: #dc3545;
}

.connection-status.connected { color: #00C853; }
.connection-status.updating { color: #667eea; }
.connection-status.disconnected { color: #dc3545; }

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ============================================
   BOOTSTRAP BADGE UTILITIES (LOCAL)
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.rounded-pill {
    border-radius: 50rem !important;
}

.d-inline-flex {
    display: inline-flex !important;
}

.align-items-center {
    align-items: center !important;
}

.gap-1 {
    gap: 0.25rem !important;
}

.text-white {
    color: #fff !important;
}

.text-dark {
    color: #212529 !important;
}

.bg-secondary {
    background-color: #6c757d !important;
}

.bg-primary {
    background-color: #1e7ff0 !important;
}

.bg-success {
    background-color: #28a745 !important;
}

.bg-danger {
    background-color: #dc3545 !important;
}

.bg-warning {
    background-color: #ffc107 !important;
}

/* ============================================
   TIME RANGE CHIPS - COMPACT INLINE
   ============================================ */
.time-range-chips-wrapper {
    flex: 0 0 auto;
    padding: 8px 16px;
    border-bottom: 1px solid #e9ecef;
    background: #ffffff;
    position: relative;
    z-index: 1;
    display: none; /* Hidden by default */
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.time-range-chips-wrapper.visible {
    display: block;
    opacity: 1;
    max-height: 60px;
}

.time-range-chips {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.time-chip {
    cursor: pointer;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 50rem;
    white-space: nowrap;
}

.time-chip i {
    font-size: 11px;
}

.time-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.time-chip.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
    transform: translateY(-1px);
}

/* ============================================
   COMPACT METRICS - SINGLE ROW
   ============================================ */
.widgets-container {
    flex: 0 0 auto;
    padding: 8px 16px;
}

.metrics-row {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.metric {
    flex: 1;
    text-align: left;
}

/* Three-column layout for metrics row */
.metric-section-left {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.metric-section-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.metric-section-center #crossingTimeInfo {
    color: white !important;
    margin-top: 0;
    font-size: 13px;
}

.metric-section-center #crossingTimeValue,
.metric-section-center #crossingTimeValue * {
    color: white !important;
}

.metric-section-right {
    width: 65px;
    flex-shrink: 0;
}

.metric-label {
    font-size: 10px;
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    font-weight: 700;
}

.metric-value-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.metric-value {
    font-size: 36px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#trendIndicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

#trendIndicator svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.metric-subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.9);
    margin-top: 2px;
    font-weight: 500;
}

/* ============================================
   DYNAMIC CHART AREA - FILLS REMAINING SPACE
   ============================================ */
.content {
    flex: 1; /* Takes all remaining space */
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow flexbox shrinking */
    overflow: hidden;
}

.chart-container {
    flex: 1;
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

/* Smart Chart with Time-Based Positioning */
.chart {
    flex: 1 1 auto; /* Allow grow and shrink */
    display: flex;
    align-items: flex-end;
    gap: 0; /* No gap - bars position by time */
    position: relative;
    min-height: 200px; /* Increased minimum height */
    max-height: 100%; /* Don't exceed container */
    padding: 0 20px;
    z-index: 1; /* Establish stacking context */
}

/* Dynamic Bar Styling */
.chart-bar {
    position: absolute; /* Position based on time */
    bottom: 0;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    min-height: 8px;
    width: 12px; /* Fixed width for clarity */
    border-radius: 4px 4px 0 0;
    box-shadow: 0 -2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    animation: barGrow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10; /* Above grid lines */
}

@keyframes barGrow {
    0% {
        transform: scaleY(0);
        opacity: 0;
    }
    100% {
        transform: scaleY(1);
        opacity: 1;
    }
}

.chart-bar:hover {
    background: linear-gradient(180deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 -4px 16px rgba(102, 126, 234, 0.5);
    z-index: 10;
}

.chart-bar.active-bar {
    background: linear-gradient(180deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 -4px 16px rgba(245, 87, 108, 0.5);
    transform: translateY(-2px);
}

/* Predicted data styling */
.chart-bar.predicted-data {
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.5) 0%, rgba(118, 75, 162, 0.5) 100%);
    border: 2px dashed rgba(102, 126, 234, 0.7);
    border-bottom: none;
}

/* New data indicator */
.chart-bar--new::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: #00C853;
    border-radius: 50%;
    border: 1.5px solid white;
    box-shadow: 0 0 8px #00C853;
    animation: newDataPulse 2s ease-in-out infinite;
}

@keyframes newDataPulse {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.6; transform: translateX(-50%) scale(1.3); }
}

/* Grid and Axes */
.grid-lines {
    position: absolute;
    top: 0;
    left: 20px;
    right: 60px;
    bottom: 30px;
    pointer-events: none;
    z-index: 0; /* Behind bars */
}

.grid-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e9ecef 20%, #e9ecef 80%, transparent 100%);
}

.y-axis {
    position: absolute;
    right: 20px;
    top: 0;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 11px;
    color: #6c757d;
    font-weight: 600;
    z-index: 5; /* Above grid, below bars */
    pointer-events: none;
}

.x-axis {
    display: flex;
    justify-content: space-between;
    padding: 8px 20px 0;
    font-size: 10px;
    color: #6c757d;
    white-space: nowrap;
    font-weight: 600;
    position: relative;
    z-index: 5; /* Above grid */
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
}

.loading::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid #e9ecef;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

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

/* ============================================
   MODAL & FEEDBACK STYLES
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    background: white;
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-overlay.visible .modal-content {
    transform: translateY(0) scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: #f1f3f5;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #667eea;
    color: white;
    transform: rotate(90deg);
}

/* Bottom Sheet Modal */
.modal-content.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-overlay.visible .modal-content.bottom-sheet {
    transform: translateY(0);
}

.report-icon-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.report-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    border: none;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    transition: all 0.2s ease;
    font-weight: 600;
}

.report-icon-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.report-icon-btn i {
    font-size: 32px;
    margin-bottom: 8px;
    color: #667eea;
    transition: color 0.2s ease;
}

.report-icon-btn:hover i {
    color: white;
}

/* Form Styles */
#feedbackForm label,
#generalFeedbackForm label {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

#feedbackForm input,
#feedbackForm textarea,
#generalFeedbackForm textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

#feedbackForm input:focus,
#feedbackForm textarea:focus,
#generalFeedbackForm textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions button {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.modal-actions button[type="submit"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modal-actions button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.modal-actions button[type="button"] {
    background: #e9ecef;
    color: #495057;
}

.modal-actions button[type="button"]:hover {
    background: #dee2e6;
}

/* ============================================
   MOBILE RESPONSIVE - COMPACT
   ============================================ */
/* Tablet breakpoint */
@media (max-width: 900px) {
    .dashboard {
        max-width: 768px;
        margin: 0 auto;
    }

    .header {
        padding: 10px 12px;
        min-height: auto;
        gap: 8px;
    }

    .title-section {
        max-width: 45%;
    }

    .title {
        font-size: 16px;
    }

    .controls-section {
        gap: 6px;
    }

    .time-display,
    .last-updated {
        font-size: 9px;
        padding: 3px 6px;
    }

    .connection-status {
        font-size: 8px;
        padding: 3px 8px;
    }

    .feedback-btn {
        width: 48px;
        height: 48px;
    }

    .feedback-btn i {
        font-size: 24px !important;
    }

    .time-range-chips-wrapper {
        padding: 6px 12px;
    }

    .time-range-chips {
        gap: 6px;
    }

    .time-chip {
        padding: 5px 10px;
        font-size: 11px;
        gap: 4px;
    }

    .time-chip i {
        font-size: 10px;
    }

    .metrics-row {
        padding: 10px 12px;
    }

    .metric-value {
        font-size: 28px;
    }

    .metric-label {
        font-size: 9px;
    }

    .metric-subtitle {
        font-size: 10px;
    }

    .chart {
        min-height: 100px;
    }

    .chart-bar {
        width: 10px;
    }

    .y-axis,
    .x-axis {
        font-size: 9px;
    }

    .report-icon-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .report-icon-btn {
        padding: 12px 6px;
        font-size: 11px;
    }

    .report-icon-btn i {
        font-size: 24px;
    }
}

/* Mobile phone breakpoint */
@media (max-width: 600px) {
    .dashboard {
        max-width: 100%;
        width: 100%;
    }

    .header {
        padding: 8px 10px;
        gap: 6px;
        min-height: auto;
    }

    .title-section {
        flex: 1 1 100%;
        max-width: 100%;
        order: 1;
        margin-bottom: 4px;
    }

    .title {
        font-size: 14px;
        text-align: left;
    }

    .controls-section {
        flex: 1 1 100%;
        order: 2;
        gap: 8px;
        justify-content: space-between;
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    /* Three subsegments layout for mobile */
    .controls-left {
        flex: 0 0 auto;
        display: flex;
        justify-content: flex-start;
        align-items: center;
    }

    .controls-center {
        flex: 1 1 auto;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .controls-right {
        flex: 0 0 auto;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 4px;
    }

    /* Hide less important elements on very small screens */
    .last-updated-container {
        display: none;
    }

    .button-group {
        display: flex;
        gap: 4px;
        align-items: center;
    }

    .time-display {
        font-size: 11px;
        padding: 3px 6px;
        font-weight: 600;
    }

    .connection-status {
        font-size: 11px;
        padding: 3px 8px;
    }

    .connection-status .status-text {
        display: inline; /* Keep status text visible on mobile */
        font-size: 11px; /* Smaller font for mobile */
    }

    .feedback-btn {
        width: 44px;
        height: 44px;
        padding: 0;
    }

    .feedback-btn i {
        font-size: 20px !important;
    }

    /* Make time chips more compact */
    .time-range-chips-wrapper {
        padding: 4px 8px;
    }

    .time-chip {
        padding: 4px 8px;
        font-size: 10px;
        gap: 3px;
    }

    .time-chip i {
        font-size: 9px;
    }

    /* Adjust metrics row */
    .metrics-row {
        padding: 8px 10px;
    }

    .metric-label {
        font-size: 9px;
    }

    .metric-value {
        font-size: 24px;
    }

    #trendIndicator {
        margin-left: 4px;
        padding: 2px;
    }

    #trendIndicator svg {
        width: 20px;
        height: 20px;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    .header {
        padding: 6px 8px;
    }

    .title {
        font-size: 13px;
    }

    .time-display {
        display: none; /* Hide clock on very small screens */
    }

    .feedback-btn {
        width: 40px;
        height: 40px;
    }

    .feedback-btn i {
        font-size: 18px !important;
    }

    .time-chip {
        padding: 3px 6px;
        font-size: 9px;
    }

    .metric-value {
        font-size: 20px;
    }
}

/* Landscape orientation warning */
.orientation-message {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #667eea;
    color: #fff;
    text-align: center;
    padding-top: 40%;
    font-size: 20px;
    font-weight: 600;
    z-index: 10001;
}

@media (orientation: landscape) and (max-height: 500px) {
    .dashboard,
    .ad-placeholder,
    .radial-menu {
        display: none;
    }
    .orientation-message {
        display: block;
    }
}

/* ============================================
   DARK MODE
   ============================================ */
.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.dark-mode .dashboard {
    background: #1e1e1e;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}

.dark-mode .header {
    background: linear-gradient(to right, #1e1e1e 0%, #252525 100%);
    border-bottom-color: #333;
}

.dark-mode .title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dark-mode .time-display,
.dark-mode .last-updated {
    background-color: #333;
    color: #e0e0e0;
}

.dark-mode .feedback-btn {
    background: #333;
    color: #e0e0e0;
}

.dark-mode .feedback-btn:hover {
    background: #667eea;
}

.dark-mode .metrics-row {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.dark-mode .chart-container {
    background: #1e1e1e;
    border-color: #333;
}

.dark-mode .grid-line {
    background: linear-gradient(90deg, transparent 0%, #333 20%, #333 80%, transparent 100%);
}

.dark-mode .y-axis,
.dark-mode .x-axis {
    color: #aaa;
}

.dark-mode .modal-content {
    background: #1e1e1e;
    color: #e0e0e0;
}

.dark-mode .modal-close-btn {
    background: #333;
    color: #e0e0e0;
}

.dark-mode .modal-close-btn:hover {
    background: #667eea;
}

.dark-mode .report-icon-btn {
    background: linear-gradient(135deg, #252525 0%, #2a2a2a 100%);
    color: #e0e0e0;
}

.dark-mode .report-icon-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.dark-mode input,
.dark-mode textarea {
    background-color: #333;
    color: #e0e0e0;
    border-color: #444;
}

.dark-mode .ad-placeholder {
    background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
    border-top-color: #667eea;
    color: #aaa;
}

.dark-mode .time-range-chips-wrapper {
    background: #1e1e1e;
    border-bottom-color: #333;
}

.dark-mode .time-chip {
    background-color: #333 !important;
    color: #e0e0e0 !important;
}

.dark-mode .time-chip.bg-secondary {
    background-color: #444 !important;
}

.dark-mode .time-chip.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

/* ═══════════════════════════════════════════════════════════════
   INACTIVE NOTIFICATION MODAL (Right-Side Bookmark Style)
   ═══════════════════════════════════════════════════════════════ */

.inactive-notification-modal {
    position: fixed;
    top: 50%;
    right: -400px; /* Hidden by default */
    transform: translateY(-50%);
    z-index: 10002; /* Above all modals */
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                opacity 0.3s ease,
                visibility 0.3s ease;
    pointer-events: none;
    opacity: 0; /* Hidden before JavaScript loads */
    visibility: hidden; /* Hidden before JavaScript loads */
}

.inactive-notification-modal.show {
    right: 20px;
    pointer-events: all;
    opacity: 1;
    visibility: visible;
}

.inactive-notification-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 24px;
    width: 320px;
    position: relative;
    animation: slideInBounce 0.6s ease-out;
}

@keyframes slideInBounce {
    0% {
        transform: translateX(100px);
        opacity: 0;
    }
    60% {
        transform: translateX(-10px);
        opacity: 1;
    }
    100% {
        transform: translateX(0);
    }
}

.inactive-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.inactive-close-btn:hover,
.inactive-close-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.inactive-icon {
    background: rgba(255, 255, 255, 0.2);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.inactive-icon i {
    font-size: 32px;
    color: white;
}

.inactive-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px 0;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.inactive-message {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 20px 0;
    text-align: center;
    opacity: 0.95;
}

.inactive-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Temporarily hide refresh data button, keep only reload page button */
#inactiveRefreshBtn {
    display: none;
}

.inactive-btn {
    flex: 1;
    padding: 14px 20px;
    min-height: 48px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inactive-btn-primary {
    background: white;
    color: #667eea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.inactive-btn-primary:hover,
.inactive-btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.inactive-btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.inactive-btn-secondary:hover,
.inactive-btn-secondary:active {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .inactive-notification-modal.show {
        right: 10px;
    }
    
    .inactive-notification-content {
        width: 280px;
        padding: 20px;
    }
    
    .inactive-icon {
        width: 56px;
        height: 56px;
    }
    
    .inactive-icon i {
        font-size: 28px;
    }
    
    .inactive-title {
        font-size: 18px;
    }
    
    .inactive-message {
        font-size: 13px;
    }
}

/* Small mobile */
@media (max-width: 400px) {
    .inactive-notification-modal {
        right: auto !important;
        left: 50%;
        top: 50%;
        bottom: auto;
        transform: translate(-50%, -50%) !important;
        width: 90%;
        max-width: 320px;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        opacity: 0;
        visibility: hidden;
    }

    .inactive-notification-modal::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        z-index: -1;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .inactive-notification-modal.show {
        right: auto !important;
        left: 50%;
        opacity: 1;
        visibility: visible;
    }

    .inactive-notification-modal.show::before {
        opacity: 1;
    }

    .inactive-notification-content {
        width: 100%;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }
}

/* Dark mode support */
.dark-mode .inactive-notification-content {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

.dark-mode .inactive-btn-primary {
    background: #1a202c;
    color: #90cdf4;
}

/* Voice Selection Modal */
.voice-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.voice-selection-modal.show {
    display: flex;
}

.voice-selection-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    padding: 32px;
    width: 90%;
    max-width: 400px;
    position: relative;
    animation: voiceModalSlide 0.3s ease-out;
}

@keyframes voiceModalSlide {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.voice-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.voice-close-btn:hover,
.voice-close-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.voice-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
    opacity: 0.9;
}

.voice-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px 0;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.voice-message {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 24px 0;
    text-align: center;
    opacity: 0.95;
}

.voice-options {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.voice-option-btn {
    flex: 1;
    padding: 20px 16px;
    min-height: 48px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.voice-option-btn i {
    font-size: 32px;
}

.voice-option-btn:hover,
.voice-option-btn:active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.voice-option-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Checkpoint list - override white text from modal */
#checkpointsList {
    color: #212529 !important;
}

#checkpointsList label {
    color: #212529 !important;
}

#checkpointsList label > span {
    color: #212529 !important;
}

/* Dark mode support for voice modal */
.dark-mode .voice-selection-content {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

/* Mobile adjustments */
@media (max-width: 400px) {
    .voice-selection-content {
        padding: 24px;
        max-width: 90%;
    }

    .voice-options {
        flex-direction: column;
    }

    .voice-option-btn {
        flex-direction: row;
        justify-content: center;
        padding: 16px;
    }

    .voice-option-btn i {
        font-size: 24px;
    }
}
