/* --- Common Base Styles --- */
body { font-family: 'Inter', sans-serif; background-color: #f8f9fa; margin: 0; padding: 20px; color: #343a40; min-height: 100vh; box-sizing: border-box; }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { margin-top: 0; font-size: 1.8em; text-align: center; }

/* --- Landing Page Specific Styles --- */
.landing-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    text-align: center;
    padding-top: 5vh;
}
.landing-page .container { background-color: #ffffff; padding: 30px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); max-width: 500px; width: 90%; display: flex; flex-direction: column; align-items: center; }
.landing-page .logo-image { width: 120px; height: auto; margin-bottom: 20px; }

/* Updated Welcome Text Styles */
.landing-page .welcome-text { margin-bottom: 30px; }
.landing-page .main-greeting {
    font-size: 2.4em;
    font-weight: 700;
    margin: 0 0 20px 0;
    line-height: 1.1;
    color: #333;
}
.landing-page .sub-greeting {
    font-size: 1.5em;
    font-weight: 500;
    color: #495057;
    margin: 0 0 20px 0;
}
.landing-page .description {
    font-size: 1.1em;
    color: #6c757d;
    line-height: 1.5;
    max-width: 350px;
    margin: 0 auto;
}

.landing-page .login-button { display: inline-block; background-color: #1DB954; color: white !important; padding: 15px 40px; border-radius: 30px; text-decoration: none; font-weight: bold; font-size: 1.2em; border: none; cursor: pointer; transition: background-color 0.2s ease; margin-bottom: 25px; }
.landing-page .login-button:hover { background-color: #1aa34a; text-decoration: none; }
.landing-page .disclaimer { font-size: 0.8em; font-style: italic; color: #adb5bd; margin-top: 15px; }

/* --- Results Page Specific Styles --- */
.results-page .results-container { max-width: 950px; margin: 0 auto; padding: 20px; padding-top: 30px; background-color: #ffffff; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); position: relative; }
.results-page .results-page-logo { width: 150px; height: auto; position: absolute; top: 20px; right: 20px; display: block; }
.results-page .results-header { display: flex; justify-content: center; align-items: center; padding-bottom: 10px; margin-bottom: 10px; border-bottom: none; }
.results-page .results-header h1 { font-size: 2.4em; font-weight: 700; margin: 0; text-align: center; color: #333; line-height: 1.2; }
.results-page .results-description { font-size: 0.95em; color: #555; line-height: 1.6; text-align: center; margin-top: 0; margin-bottom: 25px; max-width: 700px; margin-left: auto; margin-right: auto; }
.results-page .region-filter-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 20px; }
.results-page .filter-oval { padding: 8px 15px; border: 1px solid #1DB954; border-radius: 20px; cursor: pointer; font-size: 0.9em; color: #1DB954; background-color: transparent; transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; font-weight: 500; }
.results-page .filter-oval.active { background-color: #1DB954; color: white; border-color: #1DB954; }
.results-page .result-tile.hidden-by-filter { display: none !important; }
.mobile-sort-note { display: none; }
.results-page .sort-headers { display: flex; justify-content: space-between; padding: 10px 0px; margin: 0 auto 15px auto; border-bottom: 2px solid #dee2e6; font-weight: 500; color: #6c757d; font-size: 0.9em; }
.results-page .header-item { padding: 5px; text-align: center; flex-shrink: 1; flex-grow: 1; position: relative; }
.results-page .header-item.sortable-header { cursor: pointer; transition: color 0.2s ease, font-weight 0.2s ease; }
.results-page .header-item.sortable-header:hover { color: #007bff; }
.results-page .festival-header { flex-basis: 30%; flex-grow: 1.5; text-align: center;}
.results-page .artists-songs-header { flex-basis: 35%; flex-grow: 2; text-align: center; }
.results-page .total-artists-header { flex-basis: 17%; }
.results-page .total-songs-header { flex-basis: 18%; }
.results-page .header-item.sorted-by { color: #343a40; font-weight: 700; }
.results-page .header-item.sort-desc::after { content: ' ↓'; font-size: 0.8em; margin-left: 3px; }
.results-page .header-item.sort-asc::after { content: ' ↑'; font-size: 0.8em; margin-left: 3px; }
.results-page .results-list { margin-top: 10px; }
.results-page .result-tile { display: flex; align-items: flex-start; background-color: #f8f9fa; border: 1px solid #e9ecef; border-radius: 10px; padding: 15px; margin-bottom: 15px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; text-align: left; }
.results-page .result-tile:hover { transform: scale(1.01); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

.results-page .poster-image { display: block; width: 60px; height: 60px; object-fit: cover; border-radius: 8px; margin-right: 15px; flex-shrink: 0; margin-top: 5px; }
.results-page .tile-details { display: flex; justify-content: space-between; flex-grow: 1; align-items: center; }
.results-page .detail-item { padding: 0 5px; text-align: center; font-size: 0.95em; overflow-wrap: break-word; word-wrap: break-word; flex-shrink: 1; flex-grow: 1; }
.results-page .festival-name { flex-basis: 30%; text-align: left; font-weight: normal; flex-grow: 1.5; display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.results-page .festival-date { font-size: 0.8em; color: #6c757d; display: block; margin-bottom: 2px; }
.results-page .festival-main-name { font-size: 1em; color: #343a40; display: block; }
.results-page .festival-main-name a { color: inherit; text-decoration: none; font-weight: 500; }
.results-page .festival-main-name a:hover { text-decoration: underline; color: #0056b3; }
.results-page .festival-city { font-size: 0.8em; color: #6c757d; display: block; margin-top: 2px; }
.results-page .matched-artists-songs-cell { flex-basis: 35%; flex-grow: 2; text-align: left; font-size: 0.9em; }

/* --- Expandable Artist List Styles (Restored) --- */
.results-page .matched-artists-songs-cell {
    align-self: auto;
    display: block;
}

.results-page .expandable-list {
    position: relative;
    cursor: pointer;
    line-height: 1.5;
    max-height: 9em; /* ~6-7 lines (6 * 1.5 = 9) */
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    font-size: 0.9em;
}

.results-page .expandable-list.expanded {
    max-height: 300px;
    overflow-y: auto;
    cursor: default;
    padding-bottom: 10px;
}

/* Fade overlay at bottom when collapsed */
.results-page .expandable-list:not(.expanded)::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3em; /* Height of the fade */
    background: linear-gradient(to bottom, transparent, #f8f9fa 90%);
    pointer-events: none;
    z-index: 1;
}

/* Ellipsis indicator at bottom right when collapsed */
.results-page .expandable-list:not(.expanded)::after {
    content: '...';
    position: absolute;
    bottom: 0;
    right: 0;
    font-weight: bold;
    color: #6c757d;
    z-index: 2;
    padding-left: 10px;
    background: linear-gradient(to right, transparent, #f8f9fa 50%);
}

.results-page .artist-count, .results-page .song-count { flex-basis: 17%; font-size: 1.1em; font-weight: 500; display: flex; align-items: center; justify-content: center; }
.results-page .count-value { font-size: 1.1em; font-weight: 500; }
.results-page .count-label { font-size: 0.8em; color: #6c757d; margin-top: 2px; }
.results-page .no-results { margin-top: 30px; color: #6c757d; font-style: italic; }
.results-page .back-link { display: inline-block; margin-top: 30px; }
.loading-page { display: flex; justify-content: center; align-items: center; text-align: center; height: 100vh; }
.loading-page .loading-container { padding: 40px; }
.loading-page .loading-container p { font-size: 1.1em; color: #6c757d; margin-top: 15px; }
.loading-page .loading-spinner { margin: 20px auto; }
.loading-page .spinner { border: 6px solid #e9ecef; border-top: 6px solid #1DB954; border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Mobile Styles */
@media (max-width: 768px) {
    .results-page .results-page-logo { position: static; margin: 0 auto 10px auto; width: 80px; order: 1; }
    .results-page .results-header { flex-direction: column; padding-bottom: 15px; }
    .results-page .results-header h1 { font-size: 2em; order: 2; }
    .results-page .sort-headers { display: none; }
    .results-page .poster-image { display: none; }
    .results-page .result-tile { padding: 0; overflow: hidden; }
    .results-page .tile-details { flex-direction: row; flex-wrap: wrap; width: 100%; align-items: stretch; }
    .results-page .festival-info-cell { flex-basis: 50%; position: relative; display: flex; justify-content: center; align-items: center; padding: 15px 10px; min-height: 80px; box-sizing: border-box; overflow: hidden; }
    .poster-background { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; filter: blur(0.25px) brightness(0.6); transform: scale(1.1); }
    .festival-info-overlay { position: relative; z-index: 2; text-align: center; }
    .festival-info-overlay .festival-main-name, .festival-info-overlay .festival-main-name a { color: white; text-shadow: 1px 1px 3px rgba(0,0,0,0.8); }
    .festival-info-overlay .festival-date, .festival-info-overlay .festival-city { color: #e0e0e0; text-shadow: 1px 1px 3px rgba(0,0,0,0.8); }
    
    .results-page .matched-artists-songs-cell { flex-basis: 50%; padding: 10px; box-sizing: border-box; border-left: 1px solid #ddd; }
    
    /* Ensure expandable styles apply on mobile too */
    .results-page .matched-artists-songs-cell .expandable-list { 
        line-height: 1.2em; 
        font-size: 0.8em; 
        max-height: 7.2em; /* ~6 lines mobile */
        overflow: hidden;
        cursor: pointer;
    }
    
    .results-page .matched-artists-songs-cell .expandable-list.expanded {
        max-height: 200px;
        cursor: default;
    }

    /* Restore fade/ellipsis for mobile */
    .results-page .matched-artists-songs-cell .expandable-list:not(.expanded)::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 2.4em;
        background: linear-gradient(to bottom, transparent, #f8f9fa 90%);
        pointer-events: none;
        z-index: 1;
    }

    .results-page .matched-artists-songs-cell .expandable-list:not(.expanded)::after {
        content: "...";
        position: absolute;
        bottom: 0;
        right: 0;
        font-weight: bold;
        padding-left: 10px;
        background: linear-gradient(to right, transparent, #f8f9fa 50%);
    }

    .results-page .artist-count, .results-page .song-count { flex-basis: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 15px 5px; box-sizing: border-box; border-top: 1px solid #ddd; cursor: pointer; transition: background-color 0.2s ease; position: relative; }
    .results-page .count-value { font-size: 1.2em; font-weight: 700; line-height: 1; }
    .results-page .count-label { font-size: 0.7em; font-weight: 500; color: #495057; margin-top: 4px; }
    .results-page .song-count { border-left: 1px solid #ddd; }
    .results-page .mobile-sort-trigger.active-mobile-sort { background-color: #e9ecef; }
    .results-page .mobile-sort-trigger.active-mobile-sort::before { font-size: 0.7em; font-weight: normal; position: absolute; top: 8px; right: 8px; }
    .results-page .mobile-sort-trigger.sort-desc-mobile::before { content: '↓'; }
    .results-page .mobile-sort-trigger.sort-asc-mobile::before { content: '↑'; }
    .mobile-sort-note { display: block; text-align: center; font-size: 0.8em; color: #6c757d; margin-bottom: 20px; }
}