:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-surface: #f8fafc;
    --border-color: #e2e8f0;
    --border-highlight: #0284c7;
    
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-red: #e11d48;
    --accent-red-hover: #be123c;
    --accent-blue: #0284c7;
    --accent-cyan: #0284c7;
    --accent-green: #059669;
    --accent-amber: #d97706;
    --chord-color: #be123c;
    
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-chord: 'JetBrains Mono', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* App Header */
.app-header, .header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner, .header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.brand-logo, .logo a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-main);
}

.brand-icon, .logo-icon {
    font-size: 1.25rem;
    color: var(--accent-red);
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #0f172a;
}

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

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: #0f172a;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
}

.nav-btn i {
    font-size: 0.9rem;
}

.text-red { color: #e11d48; }
.text-blue { color: #0284c7; }
.text-green { color: #059669; }
.text-amber { color: #d97706; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}
.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-google {
    background: #4285f4;
    color: #ffffff;
    border: none;
}
.btn-google:hover {
    background: #3367d6;
}

.btn-subtle {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}
.btn-subtle:hover {
    background: #e2e8f0;
}

.btn-save-vocal {
    background: var(--accent-green);
    color: #ffffff;
}
.btn-save-vocal:hover {
    background: #047857;
}

.btn-logout {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
}
.btn-logout:hover {
    background: #dc2626;
    color: #ffffff;
}

/* Main Container */
.app-main {
    max-width: 1050px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 16px 40px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Search Card */
.search-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.search-leading-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 10px 40px 10px 40px;
    color: #0f172a;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
}
.clear-search-btn:hover {
    color: var(--text-main);
}

.btn-search {
    background: #0284c7;
    color: #ffffff;
    padding: 10px 20px;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s ease;
}
.btn-search:hover {
    background: #0369a1;
}

.search-provider-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.provider-pill {
    background-color: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.provider-pill:hover {
    background-color: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
}
.provider-pill.active {
    background-color: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}
.provider-pill.active#pill-ultimate_guitar,
.provider-pill.active[data-provider="ultimate_guitar"] {
    background-color: #7c3aed;
    border-color: #7c3aed;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}
.provider-pill.active#pill-all,
.provider-pill.active[data-provider="all"] {
    background-color: #0d9488;
    border-color: #0d9488;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.35);
}

/* Search Results Header & List */
.results-container {
    margin-top: 14px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.results-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 4px 10px 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.results-header-bar strong {
    color: var(--text-main);
}

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

.result-song-row {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.result-song-row:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.result-left-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    overflow: hidden;
}

.result-music-icon-wrap {
    width: 30px;
    height: 30px;
    background: #f1f5f9;
    color: #0284c7;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.result-title-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.result-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.badge-sheet-icon {
    color: var(--accent-green);
    font-size: 0.8rem;
}

.badge-key {
    background: #fee2e2;
    color: #be123c;
    border: 1px solid #fecdd3;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

.badge-rhythm {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

.result-composer {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.result-snippet {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.result-right-action {
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-yt-watch {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.15s ease;
}
.btn-yt-watch:hover {
    background: #dc2626;
}

/* Selected Song Sheet Viewer */
.song-sheet-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.song-header-area {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
    margin-bottom: 14px;
}

.song-main-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: #be123c;
    margin-bottom: 6px;
    line-height: 1.2;
}

.song-meta-line {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.song-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.song-meta-item i {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Compact Toolbar */
.song-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.toolbar-button-group {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.tool-btn {
    background: transparent;
    border: none;
    border-right: 1px solid #cbd5e1;
    color: #0f172a;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease;
}

.tool-btn:last-child {
    border-right: none;
}

.tool-btn:hover {
    background: #f1f5f9;
}

.tool-btn-key-display {
    color: #be123c;
    font-weight: 800;
    font-family: var(--font-chord);
    padding: 6px 14px;
    background: #fee2e2;
}

.tool-btn.active {
    background: #be123c;
    color: #ffffff;
}

/* Lyrics & Chords Container */
.sheet-content-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 20px;
    min-height: 250px;
}

.sheet-lyrics-pre {
    font-family: var(--font-chord);
    font-size: 1rem;
    line-height: 1.45;
    color: #0f172a;
    white-space: pre-wrap;
    word-break: break-word;
}

.sheet-lyrics-pre .chord {
    color: #dc2626;
    font-weight: 700;
    display: inline;
}

/* Form Inputs */
.input-field {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: #0f172a;
    padding: 6px 10px;
    font-family: inherit;
    outline: none;
}
.input-field:focus {
    border-color: #0284c7;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    color: #0f172a;
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #0f172a;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}
.btn-close-modal:hover {
    color: #0f172a;
}

.modal-body {
    padding: 18px;
}

.user-info-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.profile-avatar-img {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid #0284c7;
}

.profile-name-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.profile-email-text {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.profile-role-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    background: #e0f2fe;
    color: #0284c7;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    margin-top: 3px;
}

.settings-group {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 16px;
}

.settings-title {
    font-size: 0.92rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    color: #0f172a;
}

.settings-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.vocal-selectors-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.vocal-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vocal-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.vocal-select {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: #0284c7;
    font-size: 0.92rem;
    font-weight: 700;
    padding: 7px;
    outline: none;
    cursor: pointer;
}

.vocal-select:focus {
    border-color: #0284c7;
}

.feedback-saved {
    color: var(--accent-green);
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    background: #ffffff;
}

/* Singer Performances List (Matching HopAmViet Image 2) */
.singer-panel-card {
    margin-top: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.singer-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: #0f172a;
}

.singer-list-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.singer-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #f1f5f9;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
}

.singer-item-row:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.singer-item-row.active {
    background: #f0fdf4;
    border-color: #86efac;
}

.singer-item-num {
    font-size: 0.82rem;
    color: #94a3b8;
    width: 20px;
    text-align: right;
    font-weight: 600;
}

.singer-play-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: pointer;
    flex-shrink: 0;
}

.singer-item-row:hover .singer-play-circle {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.singer-item-row.active .singer-play-circle {
    background: #059669;
    color: #ffffff;
    border-color: #059669;
}

.singer-item-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #0f172a;
    flex: 1;
}

.singer-item-key {
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
    font-family: var(--font-chord);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 2px 10px;
    border-radius: 4px;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    .header-inner, .header-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .search-form {
        flex-direction: column;
    }
    .btn-search {
        width: 100%;
    }
    .vocal-selectors-row {
        grid-template-columns: 1fr;
    }
}
