/**
 * Particle Life Simulator Styles
 */

/* ==================== View Toggle ==================== */
.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 8px;
}

.view-toggle-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.view-toggle-btn.active {
    background: var(--accent);
    color: white;
}

/* ==================== Particle View Container ==================== */
#particle-view {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 100;
}

#particle-view.active {
    display: block;
}

.particle-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#particle-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ==================== Timeline ==================== */
#particle-timeline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.5));
    padding: 20px 20px 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
}

#particle-timeline.visible,
.particle-container:hover #particle-timeline {
    opacity: 1;
    transform: translateY(0);
}

.particle-timeline {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Timeline Controls */
.timeline-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.timeline-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

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

/* Play/Pause button */
.timeline-play .pause-icon {
    display: none;
}

.timeline-play.paused .play-icon {
    display: none;
}

.timeline-play.paused .pause-icon {
    display: inline;
}

/* Speed button */
.timeline-speed {
    width: auto;
    padding: 0 12px;
    border-radius: 18px;
    font-size: 12px;
    font-weight: 600;
}

/* Sync button */
.timeline-sync.synced {
    background: rgba(80, 200, 120, 0.5);
}

/* Timeline Track */
.timeline-track-container {
    flex: 1;
    position: relative;
    height: 40px;
}

.timeline-segments {
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.timeline-segment {
    position: absolute;
    top: 0;
    height: 100%;
    opacity: 0.6;
    transition: opacity 0.2s;
    cursor: pointer;
}

.timeline-segment:hover,
.timeline-segment.active {
    opacity: 1;
}

.timeline-hour-marker {
    position: absolute;
    top: -4px;
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.3);
}

.timeline-hour-label {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.timeline-track {
    position: absolute;
    top: 6px;
    left: 0;
    right: 0;
    height: 12px;
    cursor: pointer;
}

.timeline-track.dragging {
    cursor: grabbing;
}

.timeline-progress {
    position: absolute;
    top: 4px;
    left: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    pointer-events: none;
}

.timeline-thumb {
    position: absolute;
    top: 0;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
    pointer-events: none;
}

.timeline-track:hover .timeline-thumb,
.timeline-track.dragging .timeline-thumb {
    transform: scale(1.2);
}

.timeline-labels {
    position: absolute;
    top: 22px;
    left: 0;
    right: 0;
    height: 20px;
}

.timeline-label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
}

.timeline-label:hover {
    transform: translateX(-50%) scale(1.3);
}

/* Timeline Info */
.timeline-info {
    flex-shrink: 0;
    text-align: right;
    min-width: 120px;
}

.timeline-current-activity {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

/* ==================== Tooltip ==================== */
.particle-tooltip {
    position: fixed;
    z-index: 1000;
    max-width: 300px;
    padding: 12px 16px;
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    pointer-events: none;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.15s;
}

.particle-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tooltip-type {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.7);
}

.tooltip-name {
    font-weight: 600;
    color: white;
    font-size: 14px;
}

.tooltip-statement {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.tooltip-meta {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    margin-bottom: 8px;
}

.tooltip-hint {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    font-style: italic;
}

/* ==================== Close Button ==================== */
.particle-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.particle-close:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
}

/* ==================== Focus Mode Overlay ==================== */
.focus-mode-overlay {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.focus-mode-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.focus-mode-overlay button {
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: transparent;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

.focus-mode-overlay button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==================== Loading State ==================== */
.particle-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
    color: white;
    font-size: 16px;
}

.particle-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

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

/* ==================== Mobile Styles ==================== */
@media (max-width: 768px) {
    #particle-timeline {
        padding: 15px 10px 10px;
    }

    .particle-timeline {
        flex-wrap: wrap;
        gap: 10px;
    }

    .timeline-controls {
        order: 1;
        width: 100%;
        justify-content: center;
    }

    .timeline-track-container {
        order: 0;
        width: 100%;
        height: 30px;
    }

    .timeline-info {
        order: 2;
        width: 100%;
        text-align: center;
    }

    .timeline-hour-label {
        display: none;
    }

    .particle-tooltip {
        max-width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px;
        transform: none !important;
    }

    .particle-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
}

/* ==================== Dark/Light Theme Support ==================== */
[data-theme="light"] .particle-tooltip {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .tooltip-type {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .tooltip-name {
    color: #1a1a1a;
}

[data-theme="light"] .tooltip-statement {
    color: #333;
}

[data-theme="light"] .tooltip-meta {
    color: #666;
}

[data-theme="light"] .tooltip-hint {
    color: #999;
}
