:root {
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #3b82f6;
    --accent: #f43f5e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.15), transparent 25%);
    z-index: -1;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2.5rem;
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.player-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
    box-shadow: var(--glass-shadow);
    position: sticky;
    top: 1rem;
    z-index: 100;
}

.player-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    width: 100%;
}

.audio-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

.play-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.play-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary));
    color: white;
}

.progress-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.current-passage-info {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.progress-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width 0.1s linear;
}

.action-controls {
    display: flex;
    gap: 1rem;
}

.btn-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-action.primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-action.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* Passages Grid */
.passages-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.passage-row {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    transition: all 0.3s ease;
}

.passage-row:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

.passage-row.active {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.passage-info {
    min-width: 100px;
}

.passage-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

.versions-carousel-container {
    flex: 1;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    /* for scrollbar */
}

/* Custom Scrollbar */
.versions-carousel-container::-webkit-scrollbar {
    height: 6px;
}

.versions-carousel-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.versions-carousel-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.versions-cards-list {
    display: flex;
    gap: 1rem;
    width: max-content;
    padding-bottom: 0.5rem;
}

.version-card {
    width: 220px;
    height: 140px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.version-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.version-card.selected {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.15);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.card-header {
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.version-card.selected .card-header {
    color: var(--text-main);
}

.card-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
}

.version-card.selected .card-body {
    color: var(--text-main);
}

/* Lyrics Panel */
.lyrics-panel {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.current-lyrics {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-main);
    color: var(--bg-dark);
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Modal & Favorites */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

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

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
}

#favorites-list-container {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.favorite-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.favorite-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.favorite-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.favorite-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1.1rem;
}

.favorite-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.favorite-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-favorites {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .player-panel {
        padding: 1.2rem;
        border-radius: 16px;
    }

    .player-controls-row {
        flex-direction: column;
        gap: 1.5rem;
    }

    .progress-container {
        width: 100%;
    }

    .action-controls {
        width: 100%;
        justify-content: center;
    }

    .action-controls .btn-action {
        flex: 1;
        justify-content: center;
    }

    .passage-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.2rem;
    }

    .versions-carousel-container {
        width: 100%;
    }
}