:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #242442;
    --bg-elevated: #2d2d50;
    --accent-primary: #e07c4c;
    --accent-secondary: #f4a574;
    --accent-glow: rgba(224, 124, 76, 0.4);
    --text-primary: #f5f5f7;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b85;
    --success: #4cd97b;
    --error: #e05c5c;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-full: 9999px;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox scrollbar support */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) transparent;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family:
        "DM Sans",
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: calc(16px + env(safe-area-inset-top, 0));
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header .logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(
        135deg,
        var(--accent-primary),
        var(--accent-secondary)
    );
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(224, 124, 76, 0.3);
}

.header .logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.header .logo-text {
    font-family: "Outfit", sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(
        135deg,
        var(--text-primary),
        var(--text-secondary)
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Power Button */
.power-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

/* Power button states */
.power-btn.on {
    background: var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}

.power-btn.connected {
    border-color: var(--success);
}

.power-btn.disconnected {
    border-color: var(--error);
    animation: pulse-error 2s ease-in-out infinite;
}

.power-btn.connecting {
    border-color: rgba(224, 124, 76, 0.5);
    animation: pulse-connecting 1.5s ease-in-out infinite;
}

.power-btn.session-taken {
    border-color: #f4a574;
    animation: pulse-warning 2s ease-in-out infinite;
}

.power-btn.connection-lost {
    border-color: var(--error);
    animation: pulse-error 2s ease-in-out infinite;
}

.power-btn.retry-failed {
    border-color: var(--error);
}

@keyframes pulse-error {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(224, 92, 92, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(224, 92, 92, 0);
    }
}

@keyframes pulse-connecting {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(224, 124, 76, 0.5);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(224, 124, 76, 0);
    }
}

@keyframes pulse-warning {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(244, 165, 116, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(244, 165, 116, 0);
    }
}

.power-btn svg {
    width: 24px;
    height: 24px;
}

/* Main Content */
.main {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
}

/* Connection Status - Hidden, integrated into power button */
.status-bar {
    display: none;
}

.retry-btn svg {
    width: 20px;
    height: 20px;
}

/* Now Playing Card */
.now-playing {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.now-playing .glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at center,
        var(--accent-glow) 0%,
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.now-playing.playing .glow {
    opacity: 0.3;
}

.album-art {
    width: 140px;
    height: 140px;
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: box-shadow 0.3s ease;
    position: relative;
}

.now-playing.playing .album-art {
    box-shadow: 0 0 40px var(--accent-glow);
}

.album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-art svg {
    width: 60px;
    height: 60px;
    color: var(--accent-primary);
}

.station-name {
    font-family: "Outfit", sans-serif;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.station-text {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    min-height: 42px;
}

/* EQ Status */
.eq-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.eq-status svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* Equalizer */
.equalizer {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 20px;
    margin-top: 20px;
}

.equalizer .bar {
    width: 3px;
    background: var(--accent-primary);
    border-radius: 2px;
    height: 4px;
    transition: height 0.1s ease;
}

.equalizer.playing .bar {
    animation: equalizer 0.5s ease-in-out infinite;
}

.equalizer .bar:nth-child(1) {
    animation-delay: 0s;
}
.equalizer .bar:nth-child(2) {
    animation-delay: 0.1s;
}
.equalizer .bar:nth-child(3) {
    animation-delay: 0.2s;
}
.equalizer .bar:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes equalizer {
    0%,
    100% {
        height: 4px;
    }
    50% {
        height: 16px;
    }
}

.play-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.play-status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    width: 100%;
    position: relative;
}

.play-status-row .play-status {
    margin-top: 0;
}

.action-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.2s ease;
    visibility: hidden;
    z-index: 1;
}

.action-circle#favorite-btn {
    left: 0;
}

.action-circle#catalog-btn {
    right: 0;
}

.action-circle:active {
    transform: translateY(-50%) scale(0.95);
    opacity: 0.9;
}

.action-circle svg {
    width: 22px;
    height: 22px;
    stroke: #ffffff;
    stroke-width: 1.5;
    fill: none;
}

/* Favorite button: outlined star by default, filled when is-favorite */
.action-circle#favorite-btn .star-icon {
    width: 20px;
    height: 20px;
}

.action-circle#favorite-btn .star-path {
    fill: none;
    stroke: #ffffff;
    stroke-width: 1.5;
    stroke-linejoin: round;
}

.action-circle#favorite-btn.is-favorite .star-path {
    fill: #ffffff;
    stroke: #ffffff;
}

/* Transport Controls */
.transport {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
}

.transport-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.transport-btn svg {
    width: 24px;
    height: 24px;
}

.play-btn {
    width: 80px;
    height: 80px;
    background: var(--accent-primary);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.play-btn.playing {
    animation: pulse-glow 2s ease-in-out infinite;
}

.play-btn svg {
    width: 32px;
    height: 32px;
    fill: white;
}

@keyframes pulse-glow {
    0%,
    100% {
        box-shadow: 0 0 20px var(--accent-glow);
    }
    50% {
        box-shadow:
            0 0 40px var(--accent-glow),
            0 0 60px rgba(224, 124, 76, 0.2);
    }
}

/* Volume Slider */
.volume-control {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
}

.volume-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.volume-btn.muted {
    color: var(--error);
}

.volume-btn svg {
    width: 24px;
    height: 24px;
}

.volume-slider {
    flex: 1;
    height: 48px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
}

.volume-track {
    width: 100%;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    position: relative;
    overflow: visible;
}

.volume-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    transition: width 0.1s ease;
}

.volume-fill.muted {
    background: var(--text-muted);
}

.volume-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 2px 10px var(--accent-glow);
    transition: left 0.1s ease;
}

.volume-thumb.muted {
    background: var(--text-secondary);
    box-shadow: none;
}

.volume-value {
    min-width: 36px;
    text-align: right;
    font-family: "Outfit", sans-serif;
    font-weight: 600;
    font-size: 18px;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.tab-btn.active {
    color: var(--accent-primary);
}

.tab-btn svg {
    width: 24px;
    height: 24px;
}

.tab-btn span {
    font-size: 11px;
    font-weight: 500;
}

/* Modes Grid */
.modes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 8px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    aspect-ratio: 1;
    padding: 20px 12px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

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

.mode-btn svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.mode-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.mode-btn.active svg {
    transform: scale(1.1);
}

/* Presets */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.preset-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    position: relative;
    width: 100%;
}

.preset-btn:active {
    transform: scale(0.98);
}

.preset-btn.active {
    background: var(--bg-elevated);
    border: 1px solid var(--accent-primary);
}

.preset-check {
    margin-left: auto;
    color: var(--accent-primary);
    font-size: 18px;
    font-weight: bold;
}

/* EQ Presets List */
.eq-presets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preset-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Outfit", sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-primary);
}

.preset-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Section Title */
.section-title {
    font-family: "Outfit", sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Hidden tabs */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Power Off State */
.power-off-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.power-off-message p:last-child {
    margin-top: 8px;
}

/* Connection Status Banner */
.connection-banner {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 16px;
    border-left: 4px solid var(--accent-primary);
}

.connection-banner.show {
    display: flex;
}

.connection-banner.error {
    border-left-color: var(--error);
}

.connection-banner.warning {
    border-left-color: #f4a574;
}

.connection-banner .message {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
}

.connection-banner .message small {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

.reconnect-btn {
    padding: 8px 16px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.reconnect-btn:hover {
    background: var(--accent-secondary);
}

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

.reconnect-btn.takeover {
    background: var(--error);
}

.reconnect-btn.takeover:hover {
    background: #e87070;
}

/* Update Banner (PWA) */
.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    padding: 12px 20px;
    display: none;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.update-banner.show {
    display: flex;
}

.update-banner .message {
    flex: 1;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.update-banner .message small {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 400;
    margin-top: 2px;
}

.update-btn {
    padding: 8px 16px;
    background: white;
    color: #357abd;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.update-btn:hover {
    background: rgba(255, 255, 255, 0.9);
}

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

/* Adjust body when update banner is shown */
body.update-available .app {
    padding-top: 60px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}

/* EQ Button */
.eq-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

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

.eq-btn svg {
    width: 22px;
    height: 22px;
}

/* Settings Button */
.settings-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

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

.settings-btn svg {
    width: 24px;
    height: 24px;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: "Outfit", sans-serif;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close svg {
    width: 24px;
    height: 24px;
}

.modal-body {
    padding: 20px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
}

.setting-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.setting-row {
    display: flex;
    gap: 12px;
}

.setting-row .setting-group {
    flex: 1;
}

.setting-row-3 {
    gap: 8px;
}

.setting-group-host {
    flex: 2;
}

.setting-group-small {
    flex: 0 0 70px;
}

.setting-group-eq {
    flex: 1.5;
}

.setting-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.setting-info-row {
    display: flex;
    gap: 8px;
}

.setting-info-compact {
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 12px;
    font-size: 12px;
}

.setting-info-compact .setting-info-value {
    font-size: 11px;
}

.setting-info-label {
    color: var(--text-secondary);
}

.setting-info-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: "Courier New", monospace;
}

/* Compact settings modal */
.settings-modal .modal-header {
    padding: 14px 16px;
}

.settings-modal .modal-title {
    font-size: 18px;
}

.settings-modal .modal-body {
    padding: 12px 16px;
}

.settings-modal .setting-group {
    margin-bottom: 12px;
}

.settings-modal .setting-label {
    font-size: 11px;
    margin-bottom: 4px;
}

.settings-modal .setting-input {
    padding: 8px 10px;
    font-size: 14px;
}

.settings-modal .modal-footer {
    padding: 12px 16px;
}

.settings-modal .btn {
    padding: 10px 12px;
    font-size: 12px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 28px;
    background: var(--bg-elevated);
    border-radius: 14px;
    position: relative;
    transition: background 0.3s ease;
}

.toggle-slider::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    background: var(--text-secondary);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::after {
    left: 23px;
    background: white;
}

/* Dialog Component */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.dialog-overlay.show {
    display: flex;
}

.dialog {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dialog-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.dialog-title {
    font-family: "Outfit", sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.dialog-body {
    padding: 24px 20px;
}

.dialog-message {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.dialog-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.dialog-footer .btn {
    min-width: 100px;
}

/* =====================================================
   CATALOG BROWSING
   ===================================================== */

/* Floating Action Button */
.catalog-fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(224, 124, 76, 0.4);
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.catalog-fab:active {
    transform: scale(0.95);
}

.catalog-fab svg {
    width: 24px;
    height: 24px;
}

/* Catalog Modal */
.catalog-modal {
    max-height: 85vh;
}

.catalog-modal .modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.catalog-back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.catalog-back-btn:active {
    transform: scale(0.95);
    background: var(--bg-card);
}

.catalog-back-btn svg {
    width: 20px;
    height: 20px;
}

.catalog-modal .modal-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-refresh-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.catalog-refresh-btn:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.catalog-refresh-btn:active {
    transform: scale(0.9) rotate(-45deg);
}

.catalog-refresh-btn svg {
    width: 18px;
    height: 18px;
}

/* Catalog List */
.catalog-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.catalog-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}

.catalog-item:active {
    transform: scale(0.98);
    background: var(--bg-elevated);
}

.catalog-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.catalog-item.folder .catalog-item-icon {
    background: rgba(224, 124, 76, 0.15);
    color: var(--accent-primary);
}

.catalog-item.station .catalog-item-icon {
    background: rgba(76, 217, 123, 0.15);
    color: var(--success);
}

.catalog-item-icon svg {
    width: 18px;
    height: 18px;
}

.catalog-item-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-item-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
}

.catalog-item-arrow svg {
    width: 16px;
    height: 16px;
}

/* Catalog Loading State */
.catalog-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.catalog-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.catalog-loading-text {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}

.catalog-loading-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    animation: pulse 2s ease-in-out infinite;
}

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

@keyframes pulse {
    0%,
    100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* =====================================================
   FAVORITE/PRESET FAB & MODAL
   ===================================================== */

/* Favorite FAB - Left side */
.favorite-fab {
    position: fixed;
    bottom: 100px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 2px solid var(--border-subtle);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.favorite-fab:active {
    transform: scale(0.95);
}

.favorite-fab svg {
    width: 24px;
    height: 24px;
    transition: all 0.2s ease;
}

/* When station is a favorite */
.favorite-fab.is-favorite {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 16px rgba(224, 124, 76, 0.4);
}

.favorite-fab.is-favorite svg {
    fill: white;
}

/* Favorite number badge */
.favorite-number {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Outfit", sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: white;
    pointer-events: none;
}

.favorite-fab.is-favorite .favorite-number {
    display: block;
}

.favorite-fab.is-favorite svg {
    opacity: 0.3;
}

/* Favorite Modal */
.favorite-modal {
    max-width: 400px;
}

.favorite-station-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    text-align: center;
}

.favorite-station-info strong {
    color: var(--text-primary);
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.favorite-slots-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.favorite-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}

.favorite-slot:active {
    transform: scale(0.98);
    background: var(--bg-elevated);
}

.favorite-slot.current {
    border: 2px solid var(--accent-primary);
    background: rgba(224, 124, 76, 0.1);
}

.favorite-slot-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Outfit", sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.favorite-slot.empty .favorite-slot-num {
    color: var(--text-muted);
    background: var(--bg-card);
    border: 2px dashed var(--border-subtle);
}

.favorite-slot-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.favorite-slot.empty .favorite-slot-name {
    color: var(--text-muted);
    font-style: italic;
}

.favorite-slot-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.favorite-slot.current .favorite-slot-badge {
    background: var(--accent-primary);
    color: white;
}
