/* Minimal, functional CSS for Synchronized Multi-Device Audio Platform */

:root {
    --bg-dark: #121418;
    --card-bg: #1c2026;
    --accent-blue: #2563eb;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: #2e3540;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

*:focus,
*:focus-visible,
*:active {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

body,
html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

/* Landing Split Screen: 25% Top (Host), 75% Bottom (Speaker) */
#split-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.card-25 {
    height: 25vh;
    background: linear-gradient(360deg, #1e293b, #0f172a);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 15px;
    text-align: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.card-25:hover {
    background: linear-gradient(180deg, #334155, #1e293b);
}

.card-75 {
    width: 100%;
    border: none;
    color: inherit;
    font-family: inherit;
    height: 75vh;
    background: linear-gradient(360deg, #111827, #030712);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 20px;
    text-align: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.card-75:hover {
    background: linear-gradient(180deg, #1f2937, #111827);
}

.role-title {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.role-sub {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Password Form Modal/Inline */
.password-box {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.password-box input {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: #0f172a;
    color: #fff;
    font-size: 1rem;
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
    font-size: 0.95rem;
}

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

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

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

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Host Dashboard View */
#host-dashboard {
    margin: 0 auto;
    padding: 20px;
}

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

.host-stats {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.host-stats strong {
    color: var(--text-main);
    font-weight: 700;
}

.stat-divider {
    margin: 0 10px;
    color: var(--border-color);
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-action {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.btn-icon-action:hover {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    background: rgba(37, 99, 235, 0.1);
}

.btn-icon-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon-logout:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

/* Master Player Controls */
.host-controls-panel {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.btn-play-pause {
    background: transparent;
    border: none;
    color: var(--accent-green);
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.1s, opacity 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-play-pause:hover:not(:disabled) {
    transform: scale(1.08);
}

.btn-play-pause.is-paused {
    color: var(--accent-amber);
}

.btn-play-pause:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.player-info-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.song-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.active-song-display {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-duration-display {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    margin-left: 15px;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 220px;
}

.volume-icon {
    color: var(--text-muted);
    font-size: 0.9rem;
    width: 16px;
}

#host-volume-bar {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: var(--border-color);
    outline: none;
    cursor: pointer;
}

#host-volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    transition: transform 0.1s;
}

#host-volume-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Song List, Folders & Files (Carried forward from Project S) */
#song-list {
    padding: 10px 0;
    margin-top: 5px;
}

#folders,
#files {
    margin-bottom: 25px;
}

#folders h3,
#files h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
}

#folders ul,
#files ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#folders li,
#files li {
    margin: 4px;
    display: inline-grid;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

#folders a,
#files a,
.folder-link,
.song-link {
    color: #999999;
    text-decoration: none;
    font-size: 18px;
    cursor: pointer !important;
    transition: color 0.2s ease, text-shadow 0.2s ease;
    user-select: none;
}

#folders a:hover,
#files a:hover,
.folder-link:hover,
.song-link:hover {
    color: #007BFF;
    cursor: pointer !important;
}

#folders a.folder-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer !important;
}

#folders a.folder-link i {
    color: var(--accent-amber);
    font-size: 1rem;
    cursor: pointer !important;
}

#files a.selected,
.folder-contents a.selected {
    color: #007BFF !important;
    font-weight: 700 !important;
    text-shadow: 0 0 8px rgba(0, 123, 255, 0.4);
}

.folder-contents {
    display: none;
    margin-left: 15px;
    margin-top: 8px;
    margin-bottom: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.6);
    padding: 8px 14px;
    border-radius: 6px;
    width: 100%;
}

.folder-contents.open {
    display: block;
}

.folder-contents ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.song-meta {
    font-size: 0.95rem;
    color: var(--text-muted);
    padding: 5px 0;
}

/* Speaker View (100% Fullscreen) */
#speaker-view {
    height: 100vh;
    width: 100vw;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    background: radial-gradient(circle at center, #1f2937 0%, #030712 100%);
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    outline: none;
}

.speaker-folder-title {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #60a5fa;
    margin-bottom: 6px;
    max-width: 90%;
    word-break: break-word;
    text-shadow: 0 0 16px rgba(96, 165, 250, 0.45);
}

.now-playing-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 4px 0 15px 0;
    color: #fff;
    max-width: 90%;
    word-break: break-word;
}

.speaker-state {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 10px;
}

.speaker-status-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.7);
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(4px);
}

/* 10-Minute Auto-Idle Overlay */
.idle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 24px;
}

.idle-card {
    background: var(--card-bg, #111827);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
    border-radius: 16px;
    padding: 36px 28px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.idle-icon {
    font-size: 3.2rem;
    color: var(--accent-amber, #f59e0b);
    margin-bottom: 18px;
}

.idle-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.idle-card p {
    font-size: 0.95rem;
    color: var(--text-muted, #9ca3af);
    line-height: 1.5;
    margin-bottom: 24px;
}

.btn-idle-refresh {
    width: 100%;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 8px;
    background: var(--accent-blue, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s, transform 0.1s;
}

.btn-idle-refresh:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* Host Speaker Drift Widget (Matches Speaker connectivity widget styling) */
.host-drift-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.85);
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99;
    user-select: none;
    transition: border-color 0.2s, background 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    min-width: 150px;
}

.host-drift-widget:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.host-drift-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.host-drift-title {
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.host-drift-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.host-drift-widget.expanded .host-drift-arrow {
    transform: rotate(180deg);
}

.host-drift-content {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.host-drift-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.host-drift-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 0.82rem;
}

.host-drift-item .device-name {
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.host-drift-item .drift-value {
    font-family: monospace;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.host-drift-item .drift-value.in-sync {
    color: var(--accent-green, #10b981);
}

.host-drift-item .drift-value.drifting {
    color: var(--accent-amber, #f59e0b);
}

.host-drift-item .drift-value.calibrating {
    color: #38bdf8;
}

.host-drift-item .drift-value.loading {
    color: var(--accent-amber, #f59e0b);
}

.host-drift-item .drift-value.idle {
    color: var(--text-muted);
}

.host-drift-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}