/* Car Mode - standalone styles. No dependency on main.css. */

:root {
    --car-bg: #0a0a0a;
    --car-surface: #1a1a1a;
    --car-surface-2: #262626;
    --car-text: #ffffff;
    --car-text-dim: #a0a0a0;
    --car-accent: #3ea6ff;
    --car-danger: #ff5252;
    --car-nav-height: 88px;
    --car-tap-min: 72px;
    --car-radius: 16px;
    --car-cols: 2;
}

@media (orientation: landscape) {
    :root { --car-cols: 4; }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
    background: var(--car-bg);
    color: var(--car-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    height: 100%;
    width: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

button, input { font: inherit; color: inherit; }

.hidden { display: none !important; }

#car-root {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
}

/* ===== Views ===== */
.car-view {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px calc(var(--car-nav-height) + 16px);
}

.car-view-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 0 4px;
}

.car-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--car-text-dim);
    font-size: 20px;
}

/* ===== Pinned groups row ===== */
.car-pinned-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 16px;
    margin-bottom: 16px;
    scroll-snap-type: x mandatory;
}
.car-pinned-row:empty { display: none; }

.car-pinned-card {
    flex: 0 0 auto;
    min-width: 200px;
    min-height: var(--car-tap-min);
    padding: 20px 24px;
    background: var(--car-surface-2);
    border: 2px solid var(--car-accent);
    border-radius: var(--car-radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    scroll-snap-align: start;
    cursor: pointer;
}
.car-pinned-card:active { background: var(--car-accent); color: #000; }
.car-pinned-card .pinned-title { font-size: 20px; font-weight: 600; }
.car-pinned-card .pinned-count { font-size: 14px; color: var(--car-text-dim); }

/* ===== Favourites / channel grid ===== */
.car-fav-grid {
    display: grid;
    grid-template-columns: repeat(var(--car-cols), 1fr);
    gap: 14px;
}

.car-channel-card {
    min-height: 140px;
    background: var(--car-surface);
    border-radius: var(--car-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    gap: 12px;
    cursor: pointer;
    transition: background 0.08s ease;
}
.car-channel-card:active { background: var(--car-surface-2); }
.car-channel-card img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.car-channel-card .ch-name {
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.car-channel-card .ch-now {
    font-size: 13px;
    color: var(--car-accent);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Search bar ===== */
.car-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.car-search-input {
    flex: 1;
    height: var(--car-tap-min);
    padding: 0 20px;
    background: var(--car-surface);
    border: 2px solid transparent;
    border-radius: var(--car-radius);
    font-size: 22px;
    color: var(--car-text);
    outline: none;
}
.car-search-input:focus { border-color: var(--car-accent); }
.car-search-input::placeholder { color: var(--car-text-dim); }

.car-mic-btn {
    flex: 0 0 auto;
    width: var(--car-tap-min);
    height: var(--car-tap-min);
    background: var(--car-surface);
    border: none;
    border-radius: var(--car-radius);
    color: var(--car-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.car-mic-btn:active { background: var(--car-surface-2); }
.car-mic-btn.listening {
    background: var(--car-danger);
    color: #fff;
    animation: car-pulse 1s ease-in-out infinite;
}
@keyframes car-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.car-search-results {
    display: grid;
    grid-template-columns: repeat(var(--car-cols), 1fr);
    gap: 14px;
}

/* ===== Bottom nav ===== */
.car-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--car-nav-height);
    background: var(--car-surface);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 12px env(safe-area-inset-bottom);
    border-top: 1px solid var(--car-surface-2);
    z-index: 10;
}

.car-nav-tab {
    flex: 1;
    height: var(--car-tap-min);
    background: transparent;
    border: none;
    color: var(--car-text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    font-size: 13px;
}
.car-nav-tab.active { color: var(--car-accent); }
.car-nav-tab:active { background: var(--car-surface-2); border-radius: 12px; }

.car-nav-voice {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    background: var(--car-accent);
    border: none;
    border-radius: 50%;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0 16px;
    box-shadow: 0 4px 12px rgba(62, 166, 255, 0.4);
}
.car-nav-voice.listening {
    background: var(--car-danger);
    color: #fff;
    animation: car-pulse 1s ease-in-out infinite;
}

.car-nav-settings {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    color: var(--car-text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* ===== Back bar ===== */
.car-back-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--car-surface-2);
}
.car-back-btn {
    width: var(--car-tap-min);
    height: var(--car-tap-min);
    background: transparent;
    border: none;
    color: var(--car-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.car-back-btn:active { background: var(--car-surface-2); border-radius: 12px; }
.car-back-title {
    font-size: 22px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Player ===== */
.car-view-player {
    padding: 0;
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 20;
}
.car-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}
.car-player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity 0.2s ease;
}
.car-player-overlay.faded { opacity: 0; pointer-events: none; }
.car-player-title {
    font-size: 22px;
    font-weight: 600;
    flex: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
