/**
 * Firefighter Tracking Module Styles
 * 
 * Emergency-themed styling with red/orange accents
 * 
 * Author: Building Height Detector Project
 * Date: January 2026
 */

/* ============================================================================
 * Variables
 * ============================================================================ */
:root {
    --ff-primary: #ff4444;
    --ff-primary-dark: #cc3333;
    --ff-secondary: #ff8844;
    --ff-accent: #ffaa00;
    --ff-success: #44ff44;
    --ff-warning: #ffaa00;
    --ff-bg-dark: #1a1a2e;
    --ff-bg-card: #252540;
    --ff-text: #ffffff;
    --ff-text-muted: #888899;
}

/* ============================================================================
 * Panel Header with Toggle
 * ============================================================================ */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.panel-header h2 {
    margin: 0;
    font-size: 16px;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.toggle-btn:hover {
    background: var(--bg-tertiary);
}

#building-panel-content.collapsed,
#firefighter-panel-content.collapsed {
    display: none;
}

/* ============================================================================
 * Firefighter Status
 * ============================================================================ */
.ff-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--ff-bg-card);
    border-radius: 6px;
    margin-bottom: 10px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: background 0.3s;
}

.status-dot.inactive {
    background: #666;
}

.status-dot.active {
    background: var(--ff-success);
    box-shadow: 0 0 8px var(--ff-success);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================================================
 * Playback Controls
 * ============================================================================ */
.ff-playback-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.control-btn {
    width: 40px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: var(--ff-bg-card);
    color: var(--ff-text);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover:not(:disabled) {
    background: var(--ff-primary);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ff-timeline {
    margin-bottom: 10px;
}

.ff-timeline input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

#ff-time-display {
    display: block;
    text-align: center;
    font-family: monospace;
    font-size: 14px;
    color: var(--ff-text-muted);
}

.ff-speed-control {
    margin-bottom: 10px;
}

.ff-speed-control select {
    width: 100%;
}

.ff-path-toggle {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.ff-path-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ff-text);
    cursor: pointer;
}

.ff-path-toggle input[type="checkbox"] {
    accent-color: var(--ff-primary);
}

/* ============================================================================
 * Firefighter Cards
 * ============================================================================ */
#ff-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.ff-card {
    background: var(--ff-bg-card);
    border-radius: 8px;
    padding: 10px;
    border-left: 4px solid var(--ff-primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ff-card:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ff-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ff-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Path toggle on color dot */
.ff-path-toggle-dot {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 2px solid transparent;
}

.ff-path-toggle-dot:hover {
    transform: scale(1.15);
    box-shadow: 0 0 8px currentColor;
}

.ff-path-toggle-dot.path-hidden {
    opacity: 0.4;
    border: 2px dashed rgba(255, 255, 255, 0.5);
}

.ff-path-toggle-dot.path-hidden::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.7);
    transform: rotate(-45deg);
}

/* Path indicator icon */
.ff-path-indicator {
    margin-left: auto;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.8;
    transition: all 0.2s ease;
    user-select: none;
}

.ff-path-indicator:hover {
    opacity: 1;
    transform: scale(1.2);
}

.ff-path-indicator.hidden {
    opacity: 0.4;
}

.ff-name {
    font-weight: 600;
    font-size: 14px;
    flex-grow: 1;
}

.ff-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
}

.ff-stat {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.ff-stat-label {
    color: var(--ff-text-muted);
}

.ff-stat-value {
    font-family: monospace;
    color: var(--ff-text);
}

.ff-detail-btn {
    width: 100%;
    padding: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--ff-text);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.ff-detail-btn:hover {
    background: var(--ff-primary);
    border-color: var(--ff-primary);
}

/* ============================================================================
 * Scenario Info
 * ============================================================================ */
.ff-info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.ff-info-row:last-of-type {
    border-bottom: none;
    margin-bottom: 10px;
}

/* ============================================================================
 * Modal Styles
 * ============================================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.modal-large {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin: 0 0 8px 0;
    color: var(--ff-primary);
    font-size: 20px;
}

.modal-subtitle {
    color: var(--ff-text-muted);
    margin-bottom: 20px;
    font-size: 14px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.close-btn {
    background: none;
    border: none;
    color: var(--ff-text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
}

.close-btn:hover {
    color: var(--ff-primary);
}

/* ============================================================================
 * Form Styles
 * ============================================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--ff-text);
}

.form-group input {
    width: 100%;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--ff-text);
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--ff-primary);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px;
}

/* ============================================================================
 * Detail Modal Grid
 * ============================================================================ */
.ff-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 700px) {
    .ff-detail-grid {
        grid-template-columns: 1fr;
    }
}

.ff-detail-section {
    background: var(--ff-bg-card);
    border-radius: 8px;
    padding: 16px;
}

.ff-detail-section h4 {
    margin: 0 0 12px 0;
    color: var(--ff-accent);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ff-detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ff-detail-stats .stat-item {
    text-align: center;
}

.ff-detail-stats .stat-label {
    display: block;
    font-size: 11px;
    color: var(--ff-text-muted);
    margin-bottom: 4px;
}

.ff-detail-stats .stat-value {
    font-size: 18px;
    font-weight: 600;
    font-family: monospace;
}

/* ============================================================================
 * Graphs
 * ============================================================================ */
.ff-graphs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ff-graphs canvas,
#ff-position-graph {
    width: 100%;
    border-radius: 6px;
    background: var(--ff-bg-dark);
}

/* ============================================================================
 * Command Buttons
 * ============================================================================ */
.ff-command-buttons {
    display: flex;
    gap: 10px;
}

.command-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--ff-text);
    cursor: pointer;
    transition: all 0.2s;
}

.command-btn:hover {
    border-color: var(--ff-primary);
    background: rgba(255, 68, 68, 0.1);
}

.cmd-icon {
    font-size: 24px;
}

.ff-cmd-status {
    margin-top: 12px;
    padding: 10px;
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid var(--ff-warning);
    border-radius: 6px;
    font-size: 13px;
}

.ff-cmd-status.hidden {
    display: none;
}

/* ============================================================================
 * Range Slider Styling
 * ============================================================================ */
#ff-timeline-slider {
    -webkit-appearance: none;
    height: 8px;
    background: var(--ff-bg-card);
    border-radius: 4px;
    outline: none;
}

#ff-timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--ff-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

#ff-timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#ff-timeline-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--ff-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ============================================================================
 * Scrollbar for Firefighter List
 * ============================================================================ */
#ff-list::-webkit-scrollbar {
    width: 6px;
}

#ff-list::-webkit-scrollbar-track {
    background: var(--ff-bg-dark);
    border-radius: 3px;
}

#ff-list::-webkit-scrollbar-thumb {
    background: var(--ff-primary);
    border-radius: 3px;
}

#ff-list::-webkit-scrollbar-thumb:hover {
    background: var(--ff-primary-dark);
}

/* ============================================================================
 * Animations
 * ============================================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content {
    animation: fadeIn 0.2s ease-out;
}

.ff-card {
    animation: fadeIn 0.3s ease-out;
}

