:root {
    --bg-color: #0d0f14;
    --card-bg: rgba(255, 255, 255, 0.03);
    --accent-primary: #00e90e;
    --accent-secondary: #baea00;
    --text-main: #f1f5f9;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

/* --- Base Mobile Styles --- */

.container {
    width: 100%;
    max-width: 1200px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 15vh;
}

.container.results-active {
    padding-top: 0;
}

.hero-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

/* Sticky Header on Mobile */
.results-active .hero-section {
    position: sticky;
    top: 0;
    padding: 1rem;
    background: rgba(13, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
    gap: 0.5rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.results-active header {
    margin-bottom: 0.5rem;
}

header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem; /* Mobile Size */
    font-weight: 400;
    letter-spacing: -0.04em;
    margin-bottom: 0.5rem;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.results-active header h1 {
    font-size: 1.5rem;
}

header h1 .ichurch {
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header h1 .song {
    font-weight: bold;
    color: var(--accent-primary);
    margin-left: 0.1em;
}

header p {
    color: var(--text-dim);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    transition: all 0.8s ease;
}

.results-active header p {
    display: none;
}

/* Search Section */
.search-section {
    width: 100%;
    max-width: 600px;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.results-active .search-section {
    margin-bottom: 1rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    padding: 0.4rem;
    backdrop-filter: blur(10px);
    transition: all 0.5s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.8rem 1rem;
    font-size: 1rem;
    outline: none;
    min-width: 0;
}

.search-box button {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--bg-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Filters */
.advanced-filters {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    width: 100%;
}

.advanced-filters select {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 0.6rem 1rem;
    border-radius: 100px;
    font-size: 0.85rem;
    outline: none;
    flex: 1;
    max-width: 150px;
    text-align: center;
}

/* Results */
.results-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s ease 0.3s;
    pointer-events: none;
}

.results-active .results-container {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.result-area {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
}

.result-count {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    margin: 1rem 0;
}

/* Song Cards */
.song-card {
    display: flex;
    flex-direction: column; /* Mobile Stack */
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.song-title {
    font-weight: 500;
    font-size: 1.1rem;
    line-height: 1.4;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.song-source {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 100px;
    background: rgba(0, 233, 14, 0.1);
    color: var(--accent-primary);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0.5rem;
    display: flex;
    border-radius: 50%;
}

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

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: rgba(13, 15, 20, 0.98);
    backdrop-filter: blur(20px);
    z-index: 2000;
    transition: right 0.4s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    right: 0;
}

.floating-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    background: rgba(0, 153, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-right: none;
    padding: 1rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    border-radius: 12px 0 0 12px;
    z-index: 1500;
    color: var(--accent-primary);
}

.floating-toggle span {
    writing-mode: vertical-rl;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.sidebar.open ~ .floating-toggle {
    opacity: 0;
    right: -50px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-color);
    z-index: 3000;
    display: flex;
    flex-direction: column;
}

.modal-toolbar {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#modalTitle {
    font-size: 1.1rem;
    word-break: break-word;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-body {
    flex: 1;
    background: white;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Desktop Enhancements (min-width: 601px) --- */

@media (min-width: 601px) {
    .container {
        padding: 2rem;
        padding-top: 25vh;
    }

    header h1 {
        font-size: 4.5rem;
    }

    .results-active header h1 {
        font-size: 1.8rem;
    }

    header p {
        font-size: 1.1rem;
    }

    .results-active .hero-section {
        flex-direction: row;
        justify-content: space-between;
        padding: 1rem 2rem;
        gap: 2rem;
    }

    .results-active .search-section {
        flex-direction: row;
        flex: 1;
        margin-bottom: 0;
    }

    .results-active .search-box {
        max-width: 600px;
    }

    .results-active .advanced-filters {
        width: auto;
    }

    .song-card {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1.25rem 1.5rem;
    }

    .card-actions {
        width: auto;
        gap: 1rem;
    }

    .sidebar {
        width: 350px;
        right: -350px;
        border-left: 1px solid var(--glass-border);
    }

    .floating-toggle {
        padding: 1.5rem 0.5rem;
        transform: translateY(-50%);
    }

    .modal-toolbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 2rem;
    }

    .modal-actions {
        width: auto;
    }
}

/* Utility */
.hidden { display: none !important; }

#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Sidebar Helpers */
.sidebar-header { padding: 1.5rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); }
.sidebar-content { flex: 1; overflow-y: auto; padding: 1.5rem; }
.sidebar-section { margin-bottom: 2rem; }
.sidebar-section h4 { color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 1rem; }

.mini-list { display: flex; flex-direction: column; gap: 0.5rem; }
.mini-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--glass-border); border-radius: 12px; cursor: pointer; transition: all 0.2s; }
.mini-item:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--accent-secondary); }
.mini-item .title { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.mini-info { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.mini-item .source { font-size: 0.7rem; color: var(--accent-secondary); font-weight: 600; }

.empty-msg { color: var(--text-dim); font-size: 0.85rem; text-align: center; padding: 1rem; font-style: italic; }
.remove-btn { background: transparent; border: none; color: var(--text-dim); font-size: 1.2rem; cursor: pointer; margin-left: 0.5rem; opacity: 0.3; transition: opacity 0.2s; }
.mini-item:hover .remove-btn { opacity: 1; }
.remove-btn:hover { color: var(--accent-primary); }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-header h4 { margin-bottom: 0 !important; }
.text-btn { background: transparent; border: none; color: var(--accent-secondary); font-size: 0.75rem; cursor: pointer; font-weight: 600; text-transform: uppercase; }
.text-btn:hover { text-decoration: underline; color: var(--accent-primary); }

.close-btn { background: transparent; border: none; color: var(--text-dim); font-size: 2rem; cursor: pointer; line-height: 1; }

/* Animations */
@keyframes bookmarkBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.4); } }
.bookmark-btn.active svg { fill: var(--accent-primary); color: var(--accent-primary); animation: bookmarkBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.flying-icon { position: fixed; pointer-events: none; z-index: 5000; color: var(--accent-primary); fill: var(--accent-primary); transition: all 0.8s cubic-bezier(0.6, -0.28, 0.735, 0.045); }
@keyframes catchPulse { 0% { transform: translateY(-50%) scale(1); } 50% { transform: translateY(-50%) scale(1.2); background: rgba(255, 77, 0, 0.6); } 100% { transform: translateY(-50%) scale(1); } }
.floating-toggle.catching { animation: catchPulse 0.4s ease-out; }
/* --- Custom Confirm Modal --- */
.confirm-modal {
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(8px);
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.confirm-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.confirm-content {
    background: #1a1d24;
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-modal:not(.hidden) .confirm-content {
    transform: scale(1);
}

.confirm-content h3 {
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.confirm-content p {
    color: var(--text-dim);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    align-items: center;
}

.confirm-btn {
    background: var(--accent-primary);
    color: var(--bg-color);
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 100px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 233, 14, 0.3);
}

/* Pager Styles */
/* --- Sliding Modal Pager --- */
.modal-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #fff;
}

.modal-slider {
    display: flex;
    height: 100%;
    width: 300%; /* 3 slides */
    transform: translateX(-33.333%); /* Center on current */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.song-slide {
    width: 33.333%;
    height: 100%;
    flex-shrink: 0;
    position: relative;
}

.song-slide iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.modal-slider.no-transition {
    transition: none !important;
}

/* Loading state for slides */
.song-slide::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-dim);
    font-size: 0.9rem;
    z-index: -1;
}

/* --- Updated Modal Layout --- */
.modal-info {
    display: flex;
    flex-direction: column; /* Stacked */
    align-items: flex-start;
    gap: 0.25rem;
}

.modal-info .song-source {
    margin-left: 0;
    font-size: 0.65rem;
    padding: 2px 8px;
}

/* Floating Pager Arrows */
.floating-pager {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(13, 15, 20, 0.4);
    backdrop-filter: blur(5px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5000; /* High z-index to stay above iframes */
    transition: all 0.3s;
    opacity: 0.8;
}

.floating-pager:hover {
    opacity: 1;
    background: rgba(13, 15, 20, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.floating-pager.prev { left: 20px; }
.floating-pager.next { right: 20px; }

.floating-pager:disabled {
    display: none; /* Hide if no more songs */
}

@media (max-width: 600px) {
    .floating-pager {
        width: 45px;
        height: 45px;
        opacity: 0.4;
    }
    .floating-pager.prev { left: 10px; }
    .floating-pager.next { right: 10px; }
    
    .modal-toolbar {
        padding: 0.75rem 1.5rem;
    }
}
