/* ============================================
   REENACTMENT TAB STYLES - Theme Compatible
   ============================================ */

   .reenactment-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Top Section: Map + Charts side by side */
.reenactment-top-section {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.reenactment-map-wrapper {
    flex: 1;
    min-width: 300px;
}

.reenactment-map {
    width: 100%;
    height: 400px;
    border-radius: 1.2rem;
    overflow: hidden;
    box-shadow: var(--theme-shadow, 0 8px 24px rgba(0, 0, 0, 0.15));
    border: 1px solid var(--theme-accent, rgba(255, 159, 74, 0.3));
}

#reenactmentMap {
    height: 100%;
    width: 100%;
    background: var(--theme-primaryDark, #1a2a3a);
}

/* Charts Grid (2x2) */
.reenactment-charts-grid {
    flex: 1;
    min-width: 300px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.re-chart-card {
    background: linear-gradient(135deg, var(--theme-bgCard, #ffffff), var(--theme-bgSecondary, #fec2d1));
    border-radius: 1rem;
    padding-top: 1.5rem;
    padding-left: 0.2rem;
    padding-right: 0.7rem;
    border: 1px solid var(--theme-borderMedium, rgba(0, 0, 0, 0.3));
}

.re-chart-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--theme-textPrimary, #333);
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.re-chart-card canvas {
    max-height: 120px;
    width: 100%;
}

/* Controls Panel - 2 Column Compact Layout */
.reenactment-controls {
    background: linear-gradient(135deg, var(--theme-bgPrimary, white), var(--theme-bgSecondary, #f5f5f5));
    border-radius: 1.2rem;
    padding: 0.5rem;
    border: 1px solid var(--theme-borderMedium, rgba(0, 0, 0, 0.2));
}

/* Playback Controls Row */
.playback-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.1rem;
    flex-wrap: wrap;
}

.playback-title {
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--theme-textPrimary, #333);
}

.play-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.play-btn {
    background: linear-gradient(135deg, var(--theme-primary, #2a3a4a), var(--theme-primaryDark, #1f2e3c));
    border: none;
    color: var(--theme-textInverse, white);
    font-weight: 600;
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.play-btn:hover {
    background: linear-gradient(135deg, var(--theme-accent, #ff9f4a), var(--theme-accentDark, #e8802a));
    transform: translateY(-2px);
}

#speedSelect {
    background: var(--theme-primaryDark, #1a2a3a);
    border: 1px solid var(--theme-accent, #ff9f4a);
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    color: var(--theme-textInverse, white);
}

/* Timeline Slider */
.timeline-wrapper {
    margin-bottom: 1rem;
}

#timelineSlider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: linear-gradient(90deg, var(--theme-success, #4aff59), var(--theme-danger, #ff6b6b));
    border-radius: 10px;
    outline: none;
}

#timelineSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--theme-textInverse, white);
    border-radius: 50%;
    border: 2px solid var(--theme-accent, #ff9f4a);
    cursor: pointer;
    box-shadow: 0 0 8px var(--theme-accent, rgba(255, 159, 74, 0.5));
}

/* 3-Column Grid Layout for Controls */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Left Column */
.controls-left {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Center Column */
.controls-center {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Right Column */
.controls-right {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Zone Visualizer - Compact */
.zone-visualizer {
    background: transparent;
    border-radius: 0.8rem;
    min-width: 280px;
    flex: 1;
}

.zone-visualizer .compact-title {
    font-weight: 700;
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: transparent;
}

.zone-bar-container {
    display: flex;
    height: 36px;
    border-radius: 1.5rem;
    overflow: hidden;
    margin: 0.5rem 0;
    position: relative;
    background: var(--theme-primaryDark, #1a2a3a);
}

.zone-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 800;
}

.zone-segment-label {
    white-space: nowrap;
    font-size: 0.55rem;
    font-weight: 800;
}

.zone-marker-rect {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 40px;
    background: transparent;
    border-radius: 2px;
    border: 2px solid var(--theme-borderDark, rgba(0, 0, 0, 0.3));
    box-shadow: 0 0 8px var(--theme-textInverse, rgba(255, 255, 255, 0.8));
    transition: left 0.2s ease;
    pointer-events: none;
    z-index: 20;
}

.zone-current-value {
    font-size: 0.8rem;
    font-weight: bold;
    text-align: right;
    color: transparent;
    margin-top: 0.25rem;
}

/* Frequency Chart - Compact */
.frequency-chart-container {
    background: var(--theme-bgHover, rgba(0, 0, 0, 0.05));
    border-radius: 0.8rem;
    padding: 0.75rem;
}

.frequency-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--theme-textSecondary, rgba(0, 0, 0, 0.6));
}

.frequency-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-toggle {
    display: flex;
    background: var(--theme-borderLight, rgba(0, 0, 0, 0.08));
    border-radius: 16px;
    padding: 2px;
    gap: 2px;
}

.toggle-option {
    padding: 2px 8px;
    font-size: 0.6rem;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--theme-textSecondary, rgba(0, 0, 0, 0.5));
}

.toggle-option.active {
    background: var(--theme-accent, #ff9f4a);
    color: var(--theme-textInverse, white);
    box-shadow: 0 2px 4px var(--theme-accent, rgba(255, 159, 74, 0.3));
}

.frequency-stats {
    display: flex;
    gap: 0.5rem;
    font-size: 0.6rem;
}

.frequency-stats span {
    color: var(--theme-textSecondary, rgba(0, 0, 0, 0.5));
}

.frequency-stats strong {
    color: var(--theme-accent, #ff9f4a);
    font-weight: 700;
}

.frequency-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 70px;
}

#frequencyChart {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Instant Values - Compact 3x2 Grid */
.instant-values-block {
    background: linear-gradient(135deg, var(--theme-bgCard, white), var(--theme-bgSecondary, pink));
    border-radius: 0.8rem;
    padding: 0.75rem;
}

.instant-values-title {
    font-weight: 700;
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--theme-textPrimary, #333);
}

.instant-values-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.instant-card {
    background: var(--theme-bgCard, rgba(255, 255, 255, 0.8));
    border-radius: 0.6rem;
    padding: 0.4rem 0.3rem;
    text-align: center;
    border: 1px solid var(--theme-borderLight, rgba(0, 0, 0, 0.1));
    transition: all 0.2s;
}

.instant-card i {
    font-size: 0.9rem;
    color: var(--theme-accentDark, purple);
    margin-bottom: 0.2rem;
    display: inline-block;
}

.instant-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--theme-textPrimary, #333);
}

.instant-label {
    font-size: 0.55rem;
    opacity: 0.7;
    letter-spacing: 0.3px;
    font-weight: 600;
    color: var(--theme-textSecondary, rgba(0, 0, 0, 0.5));
}

/* Compact Metrics - Compact 3x2 Grid */
.compact-metrics {
    background: linear-gradient(135deg, var(--theme-bgCard, white), var(--theme-primary, purple));
    border-radius: 0.8rem;
    padding: 0.75rem;
}

.compact-title {
    font-weight: 700;
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--theme-textPrimary, #333);
}

.compact-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.compact-metric-card i {
    font-size: 0.9rem;
    color: var(--theme-info, #574aff);
    margin-bottom: 0.2rem;
    display: inline-block;
}

.compact-metric-card {
    background: var(--theme-bgCard, rgba(255, 255, 255, 0.8));
    border-radius: 0.6rem;
    padding: 0.4rem 0.3rem;
    text-align: center;
    border: 1px solid var(--theme-borderLight, rgba(0, 0, 0, 0.1));
    transition: all 0.2s;
}

.compact-metric-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--theme-textPrimary, #333);
}

.compact-metric-label {
    font-size: 0.55rem;
    opacity: 0.7;
    letter-spacing: 0.3px;
    font-weight: 600;
    color: var(--theme-textSecondary, rgba(0, 0, 0, 0.5));
}

/* ============================================
   COMPACT REENACTMENT LAYOUT
   ============================================ */

   .reenactment-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px;
    height: calc(100vh - 120px);
    overflow-y: auto;
    min-height: 500px;
}

/* PART 1: Header */
.reenactment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--theme-bgCard, #1e2436);
    border-radius: 12px;
    border: 1px solid var(--theme-borderLight, #2a3040);
    gap: 20px;
}

.reenactment-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reenactment-title i {
    color: var(--theme-accent, #ff9f4a);
}

.playback-controls {
    display: flex;
    gap: 6px;
}

.playback-controls .play-btn {
    background: var(--theme-bgControl, #151a28);
    border: 1px solid var(--theme-borderMedium, #3a4050);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--theme-textPrimary, #eef2ff);
    transition: all 0.2s;
}

.playback-controls .play-btn:hover {
    background: var(--theme-accent, #ff9f4a);
    color: #1a1f2e;
}

.playback-controls .speed-select {
    font-size: 0.7rem;
    padding: 6px 8px;
}

/* Timeline Container */
.timeline-container {
    margin-bottom: 4px;
    width: -webkit-fill-available;
}

.timeline-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, 
        #44aaff, #44ff44, #ffff44, #ffaa44, #ff4444);
    -webkit-appearance: none;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--theme-accent, #ff9f4a);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0,0,0,0.3);
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--theme-textMuted, #6c7a8e);
    margin-top: 4px;
}

/* PART 2: Two-Column Layout */
.reenactment-two-column {
    display: flex;
    gap: 12px;
    min-height: 280px;
}

.charts-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
}

.re-chart-card {
    background: var(--theme-bgCard, #1e2436);
    border-radius: 12px;
    padding: 8px;
    border: 1px solid var(--theme-borderLight, #2a3040);
}

.re-chart-title {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--theme-textSecondary, #8e9aaf);
}

.re-chart-card canvas {
    height: calc(100% - 24px);
    width: 100%;
}

.map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--theme-bgCard, #1e2436);
    border-radius: 12px;
    border: 1px solid var(--theme-borderLight, #2a3040);
    overflow: hidden;
}

.map-header {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 8px 12px;
    background: var(--theme-bgControl, #151a28);
    border-bottom: 1px solid var(--theme-borderLight, #2a3040);
}

.map-wrapper {
    flex: 1;
    min-height: 200px;
}

#reenactmentMap {
    height: 100%;
    width: 100%;
}

/* PART 3: Slope Full Width */
.slope-full-width {
    margin: 4px 0;
}

.slope-gauge-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: var(--theme-bgCard, #1e2436);
    border-radius: 12px;
    border: 1px solid var(--theme-borderLight, #2a3040);
}

.slope-gauge-card .slope-header {
    margin-bottom: 0;
    flex-shrink: 0;
}

.slope-gauge-card .slope-value-large {
    flex-shrink: 0;
}

.slope-gauge-card .slope-gauge {
    flex: 1;
    margin: 0;
}

.slope-gauge-card .slope-stats-grid {
    flex-shrink: 0;
    margin-top: 0;
    width: auto;
    display: flex;
    gap: 16px;
}

.slope-gauge-card .slope-stat-item {
    border-bottom: none;
    padding: 0;
    gap: 8px;
}

.slope-gauge-card .slope-description {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-shrink: 0;
}

/* PART 4: Zone Visualizer Full Width */
.zone-visualizer-full {
    background: var(--theme-bgCard, #1e2436);
    border-radius: 12px;
    padding: 10px 16px;
    border: 1px solid var(--theme-borderLight, #2a3040);
    display: flex;
    align-items: center;
    gap: 16px;
}

.zone-visualizer-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--theme-textSecondary, #8e9aaf);
    flex-shrink: 0;
}

.zone-visualizer-title i {
    color: #ff6b6b;
}

.zone-bar-container {
    flex: 1;
    height: 32px;
    position: relative;
    display: flex;
    border-radius: 16px;
    overflow: hidden;
}

.zone-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.zone-segment-label {
    font-size: 0.6rem;
    font-weight: 600;
    white-space: nowrap;
}

.zone-marker-rect {
    position: absolute;
    top: -4px;
    width: 4px;
    height: 40px;
    background: transparent;
    border-radius: 2px;
    transition: left 0.2s ease;
}

.zone-current-value {
    font-size: 1rem;
    font-weight: 700;
    color: #ff6b6b;
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
}

/* PART 5: Three-Column Layout */
.reenactment-three-column {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}

/* Frequency Chart */
.frequency-chart-container {
    background: var(--theme-bgCard, #1e2436);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid var(--theme-borderLight, #2a3040);
}

.frequency-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.frequency-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.frequency-header-left i {
    font-size: 0.8rem;
    color: var(--theme-accent, #ff9f4a);
}

.metric-toggle {
    display: flex;
    gap: 4px;
    background: var(--theme-bgControl, #151a28);
    border-radius: 20px;
    padding: 2px;
}

.toggle-option {
    padding: 4px 10px;
    font-size: 0.65rem;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.2s;
}

.toggle-option.active {
    background: var(--theme-accent, #ff9f4a);
    color: #1a1f2e;
}

.frequency-stats {
    display: flex;
    gap: 12px;
    font-size: 0.65rem;
    color: var(--theme-textSecondary, #8e9aaf);
}

.frequency-canvas-wrapper {
    height: 100px;
}

#frequencyChart {
    width: 100%;
    height: 100%;
}

/* Instant Values */
.instant-values-block {
    background: var(--theme-bgCard, #1e2436);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid var(--theme-borderLight, #2a3040);
}

.instant-values-title {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--theme-textSecondary, #8e9aaf);
}

.instant-values-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.instant-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px;
    background: var(--theme-bgControl, #151a28);
    border-radius: 8px;
    text-align: center;
}

.instant-card i {
    font-size: 0.7rem;
    color: var(--theme-accent, #ff9f4a);
    margin-bottom: 2px;
}

.instant-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--theme-textPrimary, #eef2ff);
}

.instant-label {
    font-size: 0.55rem;
    color: var(--theme-textMuted, #6c7a8e);
}

/* Compact Metrics */
.compact-metrics {
    background: var(--theme-bgCard, #1e2436);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid var(--theme-borderLight, #2a3040);
}

.compact-title {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--theme-textSecondary, #8e9aaf);
}

.compact-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.compact-metric-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px;
    background: var(--theme-bgControl, #151a28);
    border-radius: 8px;
    text-align: center;
}

.compact-metric-card i {
    font-size: 0.7rem;
    color: var(--theme-accent, #ff9f4a);
    margin-bottom: 2px;
}

.compact-metric-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--theme-textPrimary, #eef2ff);
}

.compact-metric-label {
    font-size: 0.55rem;
    color: var(--theme-textMuted, #6c7a8e);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .reenactment-container {
        gap: 10px;
        padding: 10px;
    }
    
    .reenactment-two-column {
        flex-direction: column;
    }
    
    .charts-grid {
        min-height: 200px;
    }
    
    .map-container {
        min-height: 250px;
    }
    
    .reenactment-three-column {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .slope-gauge-card {
        flex-wrap: wrap;
    }
    
    .slope-gauge-card .slope-stats-grid {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .reenactment-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .zone-visualizer-full {
        flex-wrap: wrap;
    }
    
    .zone-bar-container {
        min-width: 150px;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .instant-values-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .compact-metrics-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tooltip styles for reenactment map - Transparent version */
.hr-tooltip {
    background: transparent !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    border: 1px solid var(--theme-primary, #0008a7) !important;
    border-radius: 20px !important;
    color: var(--theme-textPrimary, #000000) !important;
    font-weight: bold !important;
    font-size: 11px !important;
    font-family: monospace !important;
    padding: 3px 10px !important;
    box-shadow: var(--theme-shadow, 0 2px 8px rgba(0, 0, 0, 0.2)) !important;
}

.hr-tooltip::before {
    background: transparent !important;
    border-top-color: transparent !important;
}

/* Remove default Leaflet popup backgrounds */
.leaflet-popup-content-wrapper {
    background: transparent !important;
    box-shadow: none !important;
}

.leaflet-popup-tip {
    background: transparent !important;
}

@media (max-width: 768px) {
    .reenactment-top-section {
        flex-direction: column;
    }
    
    .reenactment-map {
        height: 320px;
    }
    
    .instant-values-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .compact-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}