/**
 * EPJG Daily Map Replay - Styles v1.6
 *
 * v1.6 Changes:
 * - NEW: Vertical density bars similar to timeline.js
 * - Green bars (rgba(16, 185, 129)) with height based on aircraft count
 * - Opacity 0.2-1.0 based on density, positioned at bottom of timeline
 *
 * v1.5 Changes:
 * - Removed old .dm-hour-activity styles (replaced by .dm-hour-background gradient)
 */

/* ===== Modal Overlay ===== */
.daily-map-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.daily-map-overlay.visible {
    display: flex !important;
    opacity: 1 !important;
}

.daily-map-content {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 96vw;
    max-width: 1600px;
    height: 94vh;
    max-height: 1000px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}
.daily-map-overlay.visible .daily-map-content {
    transform: scale(1);
}

/* ===== Header ===== */
.daily-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    gap: 16px;
    flex-wrap: wrap;
}
.daily-map-title h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #f8fafc;
    font-weight: 600;
}
.daily-map-title p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #94a3b8;
}
.daily-map-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== Buttons ===== */
.dm-btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.dm-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}
.dm-btn-play {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
}
.dm-btn-play:hover {
    background: rgba(34, 197, 94, 0.5);
}
.dm-btn-close {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}
.dm-btn-close:hover {
    background: rgba(239, 68, 68, 0.4);
}

.dm-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.dm-select option {
    background: #1e293b;
    color: #fff;
}

.dm-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #cbd5e1;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
}
.dm-checkbox input {
    cursor: pointer;
}

/* ===== Body ===== */
.daily-map-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.dm-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    font-size: 1.1rem;
}
.dm-error {
    color: #ef4444;
}
.dm-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: dm-spin 1s linear infinite;
    margin-bottom: 16px;
}
@keyframes dm-spin {
    to { transform: rotate(360deg); }
}

.dm-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ===== Map ===== */
.dm-map {
    flex: 1;
    min-height: 300px;
    background: #0f172a;
}

/* ===== Timeline ===== */
.dm-timeline-container {
    background: rgba(0, 0, 0, 0.5);
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dm-time-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    flex-wrap: wrap;
}
#dm-current-time {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}
.dm-time-separator {
    color: #475569;
}
#dm-aircraft-count {
    font-size: 0.9rem;
    color: #3b82f6;
}

/* Zoom Controls */
.dm-zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dm-zoom-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm-zoom-btn:hover {
    background: rgba(59, 130, 246, 0.4);
    border-color: rgba(59, 130, 246, 0.6);
    color: #bfdbfe;
}

.dm-zoom-btn:active {
    transform: scale(0.95);
}

.dm-zoom-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dm-zoom-level {
    font-size: 0.85rem;
    color: #94a3b8;
    min-width: 28px;
    text-align: center;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.dm-timeline-wrapper {
    position: relative;
}

.dm-timeline-bar {
    height: 40px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.dm-timeline-bar:hover {
    border-color: rgba(59, 130, 246, 0.5);
}

.dm-timeline-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
    pointer-events: none;
    will-change: width;
}

.dm-timeline-cursor {
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
    pointer-events: none;
    /* Use transform for GPU acceleration */
    will-change: transform;
    transform: translateX(0);
}

.dm-hour-marker {
    position: absolute;
    top: 0;
    height: 100%;
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.dm-tx-marker {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 16px;
    background: #ef4444;
    border-radius: 2px;
    pointer-events: none;
    opacity: 0.7;
}

.dm-inactive-zone {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.dm-hour-background {
    position: absolute;
    top: 0;
    height: 100%;
    pointer-events: none;
    transition: background-color 0.2s ease;
}

.dm-density-bar {
    position: absolute;
    bottom: 0;
    pointer-events: none;
    border-radius: 2px 2px 0 0;
    transition: all 0.3s ease;
}

/* v2.13: Continuous ADS-B detection blocks (green) */
.dm-detection-block {
    position: absolute;
    bottom: 0;
    height: 100%;
    background-color: rgba(16, 185, 129, 0.3);
    pointer-events: none;
    border-left: 1px solid rgba(16, 185, 129, 0.5);
    border-right: 1px solid rgba(16, 185, 129, 0.5);
    transition: all 0.3s ease;
}

.dm-detection-block:hover {
    background-color: rgba(16, 185, 129, 0.4);
}

.dm-block-gap {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 14px;
    background: rgba(100, 116, 139, 0.2);
    pointer-events: none;
    z-index: 5;
}

.dm-timeline-labels {
    display: flex;
    justify-content: space-between;
    padding: 6px 0 0;
    font-size: 11px;
    color: #64748b;
    font-family: monospace;
    position: relative;
    height: 20px;
}

/* ===== Info Panel ===== */
.dm-info-panel {
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 80px;
}

.dm-transmission-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dm-tx-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dm-tx-icon {
    font-size: 1.4rem;
}

.dm-tx-time {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: #fbbf24;
}

.dm-tx-speaker {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(139, 92, 246, 0.3);
    border: 1px solid rgba(139, 92, 246, 0.5);
    border-radius: 4px;
    color: #c4b5fd;
    font-size: 0.85rem;
    font-weight: 600;
}

.dm-tx-frequency {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(59, 130, 246, 0.3);
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 4px;
    color: #93c5fd;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.dm-tx-callsign {
    font-size: 1.05rem;
    font-weight: 700;
    color: #22c55e;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    letter-spacing: 0.5px;
}

.dm-tx-text {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.5;
    max-height: 60px;
    overflow-y: auto;
    padding-right: 4px;
}

.dm-tx-text::-webkit-scrollbar {
    width: 4px;
}

.dm-tx-text::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.dm-tx-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.dm-tx-text.playing {
    color: #fbbf24;
    animation: dm-pulse 1.5s ease-in-out infinite;
}

@keyframes dm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ===== Aircraft Icons ===== */
.dm-aircraft-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}

.dm-aircraft-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.dm-aircraft-wrapper.highlighted .dm-aircraft-circle {
    animation: dm-circle-pulse-highlight 1.2s ease-in-out infinite;
}
.dm-aircraft-wrapper.active .dm-aircraft-circle {
    animation: dm-circle-pulse-active 0.8s ease-in-out infinite;
}

@keyframes dm-circle-pulse-highlight {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
@keyframes dm-circle-pulse-active {
    0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(34, 197, 94, 0.8), 0 0 20px rgba(34, 197, 94, 0.4); }
    50% { transform: scale(1.2); box-shadow: 0 0 16px rgba(34, 197, 94, 1), 0 0 30px rgba(34, 197, 94, 0.6); }
}

.dm-aircraft-label {
    margin-top: 2px;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.3px;
}

/* ===== Aircraft Tooltip ===== */
.dm-aircraft-tooltip {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(59, 130, 246, 0.5) !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
    color: #e2e8f0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}
.dm-aircraft-tooltip::before {
    border-top-color: rgba(59, 130, 246, 0.5) !important;
}

/* ===== Airport Marker ===== */
.dm-airport-marker {
    background: rgba(245, 158, 11, 0.85);
    color: #000;
    font-weight: bold;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ===== Runway styling ===== */
.dm-runway {
    stroke: #fbbf24;
    stroke-width: 3;
    fill: none;
    opacity: 0.9;
}

.dm-runway-label {
    background: rgba(30, 41, 59, 0.9);
    color: #fbbf24;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid rgba(251, 191, 36, 0.5);
    white-space: nowrap;
    font-family: monospace;
}

/* ===== CTR Zone ===== */
.dm-ctr-label {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(59, 130, 246, 0.4);
    letter-spacing: 1px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .daily-map-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .daily-map-controls {
        width: 100%;
        justify-content: flex-start;
    }
    #dm-current-time {
        font-size: 1.2rem;
    }
    .dm-aircraft-label {
        font-size: 8px;
    }
}