/**
 * EchoPaths Module CSS
 *
 * Purpose:
 *   Styling for the immersive route-to-audio-story module.
 *   Dark-themed, premium aesthetic matching the Cockpit design system.
 *
 * How to undo:
 *   - Remove link tag from index.html
 */

/* ── Layout ────────────────────────────── */
.ep-module {
    padding: 0 24px 48px;
    max-width: 960px;
    margin: 0 auto;
}

.ep-header {
    margin-bottom: 32px;
}

.ep-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-display);
    margin: 0 0 6px;
}

.ep-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* ── Form ───────────────────────────────── */
.ep-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .ep-form-grid {
        grid-template-columns: 1fr;
    }
}

.ep-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ep-label {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--text-subtle);
    text-transform: uppercase;
}

.ep-input {
    background: var(--bg-elevated);
    border: 1px solid var(--line-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text-display);
    transition: border-color 0.15s ease;
}

.ep-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: none;
}

.ep-select {
    background: var(--bg-elevated);
    border: 1px solid var(--line-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--text-display);
    cursor: pointer;
}

/* ── Options Row ────────────────────────── */
.ep-options-row {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ep-option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ep-toggle-group {
    display: flex;
    gap: 4px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--line-subtle);
}

.ep-toggle {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.ep-toggle.active {
    background: var(--primary);
    color: #000;
}

/* ── Route Preview ──────────────────────── */
.ep-route-preview {
    background: var(--primary-dim);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.ep-route-stats {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.ep-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ep-stat-label {
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--text-subtle);
    text-transform: uppercase;
}

.ep-stat-value {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

/* ── Actions & Status ───────────────────── */
.ep-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.ep-accent {
    background: var(--primary);
}

.ep-status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.ep-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: ep-spin 0.6s linear infinite;
}

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

/* ── Map ────────────────────────────────── */
.ep-map {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line-subtle);
    margin-bottom: 20px;
    background: #111;
}

/* ── Player ─────────────────────────────── */
.ep-player {
    animation: ep-fadeIn 0.5s ease;
}

@keyframes ep-fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ep-story-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-subtle);
    border-radius: 12px;
    padding: 24px;
}

.ep-now-playing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ep-playing-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--primary);
    text-transform: uppercase;
}

.ep-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: ep-pulse 1.5s ease-in-out infinite;
}

@keyframes ep-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.ep-segment-counter {
    font-size: 0.7rem;
    color: var(--text-subtle);
    font-weight: 600;
}

.ep-segment-text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-display);
    min-height: 120px;
    margin-bottom: 20px;
    white-space: pre-wrap;
}

/* ── Controls ───────────────────────────── */
.ep-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ep-control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #000;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.ep-control-btn:hover {
    transform: scale(1.05);
}

.ep-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
}

.ep-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.ep-time {
    font-size: 0.75rem;
    color: var(--text-subtle);
    font-family: monospace;
    min-width: 40px;
    text-align: right;
}

/* ── History ────────────────────────────── */
.ep-history-section {
    margin-top: 40px;
    border-top: 1px solid var(--line-subtle);
    padding-top: 24px;
}

.ep-section-title {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--text-subtle);
    text-transform: uppercase;
    margin: 0 0 16px;
}

.ep-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.ep-history-card {
    background: var(--bg-surface);
    border: 1px solid var(--line-subtle);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.ep-history-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.ep-history-card h4 {
    margin: 0 0 8px;
    font-weight: 700;
    color: var(--text-display);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ep-history-card .ep-history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    color: var(--text-subtle);
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--line-subtle);
}