/* ─── Google Material Design 3 — Light Theme ───────────────── */
/* Primary: #6750A4 (purple)  Secondary: #625B71  Tertiary: #7D5260 */
/* Surface: #FFFBFE  On-Surface: #1C1B1F  Outline: #79747E */
/* Error: #B3261E  Container variants for elevation */

/* ─── Reset & Base ──────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #F6F2FA;
    color: #1C1B1F;
    min-height: 100vh;
}

/* ─── Header ────────────────────────────────────────────────── */
.header {
    background: #6750A4;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.header h1 {
    font-size: 1.3rem;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: #E8DEF8;
}

.btn-logout {
    background: transparent;
    border: 1px solid #E8DEF8;
    color: #E8DEF8;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-logout:hover { background: rgba(232,222,248,0.2); }

/* ─── Login Page ────────────────────────────────────────────── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #F6F2FA 0%, #E8DEF8 100%);
}

.login-box {
    background: #FFFBFE;
    padding: 40px;
    border-radius: 28px;
    box-shadow: 0 4px 20px rgba(103,80,164,0.12);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    color: #6750A4;
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.login-box .subtitle {
    color: #79747E;
    margin-bottom: 30px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.login-box input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #CAC4D0;
    background: #FFFBFE;
    color: #1C1B1F;
    font-size: 1rem;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-box input:focus { border-color: #6750A4; box-shadow: 0 0 0 2px rgba(103,80,164,0.15); }
.login-box input::placeholder { color: #9E99A5; }

.btn-primary {
    width: 100%;
    padding: 14px;
    background: #6750A4;
    color: #FFFFFF;
    border: none;
    border-radius: 100px;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    letter-spacing: 0.02em;
}
.btn-primary:hover { background: #7E67C1; box-shadow: 0 2px 8px rgba(103,80,164,0.25); }
.btn-primary:disabled { background: #E0DCE4; color: #9E99A5; cursor: not-allowed; }

.name-warning {
    color: #B3261E;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 16px;
    margin-bottom: 4px;
    line-height: 1.4;
}

.error-msg {
    color: #B3261E;
    font-size: 0.85rem;
    margin-top: 10px;
    min-height: 20px;
}

/* ─── Search Bar ────────────────────────────────────────────── */
.search-container {
    padding: 16px 20px;
    background: #FFFBFE;
    position: sticky;
    top: 52px;
    z-index: 50;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.search-box {
    display: flex;
    gap: 10px;
    max-width: 700px;
    margin: 0 auto;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 28px;
    border: 1px solid #CAC4D0;
    background: #F6F2FA;
    color: #1C1B1F;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input:focus { border-color: #6750A4; box-shadow: 0 0 0 2px rgba(103,80,164,0.12); background: #FFFBFE; }
.search-box input::placeholder { color: #9E99A5; }

/* ─── Search Tabs ──────────────────────────────────────────── */
.search-tabs {
    display: flex;
    gap: 8px;
    max-width: 700px;
    margin: 10px auto 0;
}

.tab-btn {
    padding: 8px 20px;
    background: #F6F2FA;
    color: #625B71;
    border: 1px solid #CAC4D0;
    border-radius: 100px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.tab-btn:hover { border-color: #6750A4; color: #6750A4; background: #E8DEF8; }
.tab-btn.active { background: #6750A4; color: #FFFFFF; border-color: #6750A4; }

/* ─── Time Display (Host) ──────────────────────────────────── */
.qi-times {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 4px;
    font-size: 0.8rem;
}

.qi-submitted-time {
    color: #79747E;
}

.qi-playtime-wrap {
    color: #006D3B;
    display: flex;
    align-items: center;
    gap: 4px;
}

.playtime-input {
    background: #F6F2FA;
    border: 1px solid #CAC4D0;
    border-radius: 8px;
    color: #006D3B;
    padding: 4px 8px;
    font-size: 0.8rem;
    width: 100px;
    outline: none;
}
.playtime-input:focus { border-color: #006D3B; }

.qi-playtime-display {
    color: #006D3B;
    font-weight: 600;
}

.btn-search {
    padding: 12px 28px;
    background: #6750A4;
    color: #FFFFFF;
    border: none;
    border-radius: 100px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, box-shadow 0.2s;
    letter-spacing: 0.02em;
}
.btn-search:hover { background: #7E67C1; box-shadow: 0 2px 6px rgba(103,80,164,0.2); }

/* ─── Song List ─────────────────────────────────────────────── */
.content {
    padding: 16px 20px;
    max-width: 900px;
    margin: 0 auto;
}

.results-info {
    color: #79747E;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.song-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.song-item {
    background: #FFFBFE;
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #E7E0EC;
}
.song-item:hover {
    border-color: #6750A4;
    background: #F3EDF7;
    box-shadow: 0 2px 6px rgba(103,80,164,0.08);
}

.song-item .song-info h3 {
    font-size: 1rem;
    color: #1C1B1F;
    margin-bottom: 3px;
    font-weight: 500;
}
.song-item .song-info p {
    font-size: 0.95rem;
    color: #625B71;
}
.song-item .track-num {
    color: #6750A4;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    margin-left: 12px;
}

/* ─── Pagination ────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
    margin-top: 10px;
}

.btn-page {
    padding: 8px 18px;
    background: #FFFBFE;
    color: #6750A4;
    border: 1px solid #CAC4D0;
    border-radius: 100px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-page:hover { border-color: #6750A4; background: #F3EDF7; }
.btn-page:disabled { opacity: 0.35; cursor: not-allowed; }

.page-info { color: #79747E; font-size: 0.9rem; }

/* ─── Song Detail Modal ─────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
    background: #FFFBFE;
    border-radius: 28px;
    padding: 30px;
    max-width: 450px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal h2 {
    color: #1C1B1F;
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 6px;
}
.modal .modal-artist {
    color: #6750A4;
    font-size: 1.1rem;
    margin-bottom: 16px;
}
.modal .modal-track {
    color: #79747E;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* ─── Modal Fields ─────────────────────────────────────────── */
.modal-fields {
    text-align: left;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-field label {
    display: block;
    font-size: 0.85rem;
    color: #625B71;
    margin-bottom: 4px;
    font-weight: 500;
}

.modal-field select,
.modal-field input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #CAC4D0;
    background: #FFFBFE;
    color: #1C1B1F;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-field select:focus,
.modal-field input:focus { border-color: #6750A4; box-shadow: 0 0 0 2px rgba(103,80,164,0.12); }

.modal-field input::placeholder { color: #9E99A5; }

/* ─── Special Request Display ──────────────────────────────── */
.qi-special {
    color: #7D5260;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 2px;
}

.btn-sing {
    padding: 14px 32px;
    background: #006D3B;
    color: #FFFFFF;
    border: none;
    border-radius: 100px;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    margin-right: 10px;
    letter-spacing: 0.02em;
}
.btn-sing:hover { background: #008A4B; box-shadow: 0 2px 8px rgba(0,109,59,0.25); }

.btn-cancel {
    padding: 14px 24px;
    background: transparent;
    color: #625B71;
    border: 1px solid #CAC4D0;
    border-radius: 100px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-cancel:hover { border-color: #6750A4; color: #6750A4; background: #F3EDF7; }

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #322F35;
    color: #F4EFF4;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 500;
    z-index: 300;
    display: none;
    animation: fadeIn 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.toast.error { background: #B3261E; color: #fff; }
.toast.show { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ─── Host Queue Table ──────────────────────────────────────── */
.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.queue-header h2 { color: #6750A4; font-weight: 500; }

.btn-refresh {
    padding: 8px 18px;
    background: #FFFBFE;
    color: #6750A4;
    border: 1px solid #CAC4D0;
    border-radius: 100px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-refresh:hover { border-color: #6750A4; background: #F3EDF7; }

.btn-clear-night {
    padding: 8px 18px;
    background: #B3261E;
    color: #FFFFFF;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-clear-night:hover { background: #CC3A32; box-shadow: 0 2px 6px rgba(179,38,30,0.25); }

.queue-count {
    color: #79747E;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.queue-item {
    background: #FFFBFE;
    padding: 16px 18px;
    border-radius: 12px;
    border-left: 4px solid #6750A4;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.queue-item .qi-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.queue-item .qi-singer {
    font-weight: 500;
    font-size: 1.05rem;
    color: #1C1B1F;
}
.queue-item .qi-song {
    color: #49454F;
    font-size: 0.95rem;
}
.queue-item .qi-artist {
    color: #79747E;
    font-size: 0.85rem;
}
.queue-item .qi-track {
    color: #6750A4;
    font-size: 0.85rem;
    font-weight: 600;
}
.queue-item .qi-tag {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.qi-tag.submitted { background: #FFD8E4; color: #7D5260; }
.qi-tag.in-queue { background: #D0E8FF; color: #0061A4; }

.queue-item .qi-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-status {
    padding: 7px 16px;
    border: none;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}
.btn-status:hover { opacity: 0.88; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.btn-status.queue { background: #0061A4; color: #fff; }
.btn-status.completed { background: #006D3B; color: #fff; }
.btn-status.left { background: #7D5800; color: #fff; }
.btn-status.deleted { background: #B3261E; color: #fff; }

.empty-queue {
    text-align: center;
    padding: 60px 20px;
    color: #9E99A5;
    font-size: 1.1rem;
}

/* ─── Host Two-Column Layout ───────────────────────────────── */
.host-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 16px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.host-col {
    min-width: 0;
}

.host-search-results {
    max-width: 1400px;
    border-bottom: 1px solid #E7E0EC;
    padding-bottom: 16px;
    margin-bottom: 0;
}

/* Processed item status highlights */
.processed-item.highlight-inqueue {
    background: #E6F4EA;
    border-left-color: #006D3B;
}
.processed-item.highlight-completed {
    background: #E3F0FF;
    border-left-color: #0061A4;
}
.processed-item.highlight-left {
    background: #FFF3E0;
    border-left-color: #7D5800;
}
.processed-item.highlight-deleted {
    background: #FCE4EC;
    border-left-color: #B3261E;
}

.qi-tag.status-completed { background: #D0E8FF; color: #0061A4; }
.qi-tag.status-left { background: #FFE0B2; color: #7D5800; }
.qi-tag.status-deleted { background: #FECDD2; color: #B3261E; }

/* Requeue button */
.btn-status.requeue {
    background: #6750A4;
    color: #fff;
}

/* Add to queue button in search */
.btn-add-queue {
    white-space: nowrap;
    font-size: 0.8rem;
}

/* ─── Singer Groups (Collapsible) ──────────────────────────── */
.singer-group {
    margin-bottom: 10px;
    border: 1px solid #E7E0EC;
    border-radius: 12px;
    overflow: hidden;
}

.singer-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #F3EDF7;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.singer-group-header:hover { background: #E8DEF8; }

.group-arrow {
    font-size: 0.7rem;
    color: #6750A4;
    transition: transform 0.2s;
    display: inline-block;
}
.group-arrow.collapsed { transform: rotate(-90deg); }

.group-name {
    font-weight: 500;
    color: #1C1B1F;
    font-size: 1rem;
}

.group-count {
    color: #79747E;
    font-size: 0.8rem;
    margin-left: auto;
}

.singer-group-body {
    display: none;
    padding: 6px;
    background: #FFFBFE;
}
.singer-group-body.open { display: block; }

.singer-group-body .queue-item {
    margin-bottom: 4px;
}

/* ─── Special Request Highlight ────────────────────────────── */
.queue-item.has-special {
    border-left: 4px solid #7D5260;
    background: #FFF8F8;
}

/* ─── History ──────────────────────────────────────────────── */
.history-group {
    margin-bottom: 12px;
}

.history-artist {
    font-weight: 500;
    color: #6750A4;
    font-size: 0.95rem;
    padding: 8px 0 4px;
    border-bottom: 1px solid #E7E0EC;
    margin-bottom: 4px;
}

.history-count {
    color: #79747E;
    font-weight: 400;
    font-size: 0.8rem;
}

.history-item {
    padding: 6px 12px;
    color: #49454F;
    font-size: 0.9rem;
    cursor: pointer;
}
.history-item:hover {
    border-color: #6750A4;
    background: #F3EDF7;
}

.history-notes {
    display: block;
    color: #7D5260;
    font-size: 0.8rem;
    font-style: italic;
}

/* ─── Favorites ────────────────────────────────────────────── */
.btn-fav {
    padding: 14px 24px;
    background: #7D5260;
    color: #FFFFFF;
    border: none;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    margin-right: 10px;
    letter-spacing: 0.02em;
}
.btn-fav:hover { background: #9A6A79; box-shadow: 0 2px 8px rgba(125,82,96,0.25); }

.btn-fav-delete {
    padding: 5px 14px;
    background: #B3261E;
    color: #fff;
    border: none;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-fav-delete:hover { opacity: 0.85; }

/* ─── Play Times Badge ─────────────────────────────────────── */
.playtime-item {
    cursor: default;
}

.playtime-item .qi-singer {
    font-weight: 500;
    color: #1C1B1F;
    margin-bottom: 2px;
}

.playtime-badge {
    background: #006D3B;
    color: #fff;
    padding: 6px 14px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* ─── Mobile Optimizations ─────────────────────────────────── */

/* Prevent iOS zoom on input focus (font must be >= 16px) */
input, select, textarea {
    font-size: 16px !important;
}

/* Smooth scrolling on iOS */
html { -webkit-overflow-scrolling: touch; }

/* Tabs scroll horizontally on mobile */
.search-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
}
.search-tabs::-webkit-scrollbar { display: none; }
.tab-btn { flex-shrink: 0; }

/* ─── Responsive (Tablets & Small Screens) ─────────────────── */
@media (max-width: 900px) {
    .host-columns { grid-template-columns: 1fr; }
}

/* ─── Responsive (Mobile Phones) ───────────────────────────── */
@media (max-width: 600px) {
    /* Header */
    .header { padding: 10px 14px; }
    .header h1 { font-size: 1.1rem; }
    .header .user-info { gap: 8px; font-size: 0.8rem; }

    /* Search */
    .search-container { padding: 12px 14px; top: 46px; }
    .search-box { flex-direction: column; gap: 8px; }
    .search-box input { padding: 14px 16px; }
    .btn-search { width: 100%; padding: 14px; }

    /* Tabs - bigger touch targets */
    .search-tabs { gap: 6px; margin-top: 8px; padding-bottom: 4px; }
    .tab-btn { padding: 10px 16px; font-size: 0.85rem; min-height: 44px; }

    /* Content area */
    .content { padding: 12px 10px; }

    /* Song items */
    .song-item {
        padding: 14px 12px;
        gap: 8px;
    }
    .song-item .song-info h3 { font-size: 0.95rem; }
    .song-item .song-info p { font-size: 0.85rem; }
    .song-item .track-num { font-size: 0.85rem; margin-left: 8px; }

    /* Host song items with + Queue button */
    .host-song-item {
        flex-wrap: wrap;
    }
    .host-song-item > div:last-child {
        width: 100%;
        justify-content: space-between;
        margin-top: 6px;
    }

    /* Queue items */
    .queue-item { padding: 14px 12px; }
    .queue-item .qi-top { flex-direction: column; gap: 8px; }
    .queue-item .qi-tag { align-self: flex-start; }
    .queue-item .qi-actions {
        margin-top: 10px;
        gap: 8px;
    }

    /* Bigger touch targets for status buttons */
    .btn-status {
        padding: 10px 14px;
        font-size: 0.85rem;
        min-height: 44px;
    }
    .btn-add-queue {
        padding: 10px 16px;
        min-height: 44px;
    }

    /* Time inputs */
    .qi-times { flex-direction: column; gap: 6px; align-items: flex-start; }
    .playtime-input { width: 130px; padding: 6px 8px; }

    /* Modal full-screen on mobile */
    .modal-overlay { padding: 10px; align-items: flex-end; }
    .modal {
        padding: 24px 16px;
        border-radius: 28px 28px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        max-width: 100%;
    }
    .modal h2 { font-size: 1.2rem; }
    .modal .modal-artist { font-size: 1rem; }
    .modal-field select,
    .modal-field input { padding: 12px; }

    /* Modal buttons stacked */
    .modal > div:last-child {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .btn-sing { margin-right: 0; width: 100%; min-height: 48px; }
    .btn-fav { margin-right: 0; width: 100%; min-height: 48px; }
    .btn-cancel { width: 100%; min-height: 48px; }

    /* Host columns stack */
    .host-columns {
        grid-template-columns: 1fr;
        padding: 12px 10px;
        gap: 16px;
    }

    /* Queue header */
    .queue-header { flex-wrap: wrap; gap: 8px; }
    .btn-refresh, .btn-clear-night { min-height: 44px; }

    /* Singer groups */
    .singer-group-header { padding: 12px 14px; min-height: 48px; }
    .group-name { font-size: 0.95rem; }

    /* History items */
    .history-item { padding: 10px 12px; min-height: 44px; }
    .history-artist { font-size: 0.9rem; padding: 10px 0 6px; }

    /* Pagination bigger touch targets */
    .btn-page { padding: 12px 20px; min-height: 44px; }

    /* Toast */
    .toast { bottom: 20px; padding: 12px 20px; font-size: 0.9rem; max-width: 90vw; }

    /* Login */
    .login-box { padding: 30px 20px; border-radius: 20px; }
    .login-box h1 { font-size: 1.6rem; }
    .login-box .subtitle { font-size: 0.85rem; margin-bottom: 20px; }
    .login-box input { padding: 16px; }
    .btn-primary { padding: 16px; min-height: 50px; }
    .name-warning { font-size: 0.75rem; }

    /* Favorites delete button */
    .btn-fav-delete { padding: 8px 14px; min-height: 38px; }

    /* Play times */
    .playtime-badge { padding: 8px 14px; font-size: 0.9rem; }
}
