/* CSS variables for theming */
:root {
    --background-color: #f0f4f8;
    --text-color: #1a202c;
    --primary-color: #0769ad;
    --primary-color-dark: #276092;
    --accent-color: #7f390e;
    --card-background: #ffffff;
    --card-border-color: #ddd;
    --link-color: #1c4971;
    --link-visited-color: #303030;
    --header-gradient-start: #000000;
    --header-gradient-end: #276092;
    --header-text-color: #e7ecf5;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

/* Basic reset and body styling */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 100%; /* 16px */
    background-color: var(--background-color);
    color: var(--text-color);
}

body {
    margin: 0;
    font-family: var(--font-family);
    line-height: 1.6;
}

a {
    color: var(--link-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
a:visited {
    color: var(--link-visited-color);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Main layout container */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.main-header {
    background: linear-gradient(355deg, var(--header-gradient-start) 0, var(--header-gradient-end) 97%);
    color: var(--header-text-color);
    padding: 2rem 1rem;
    text-align: center;
}

.main-header .logo {
    max-width: 300px;
    margin: 0 auto 1rem;
}

.main-header h1 {
    font-size: 1.5rem;
    margin: 0 0 1rem 0;
    color: #769dbe;
}

/* Search Form */
.search-form {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
}

.search-form input {
    flex-grow: 1;
    font-size: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--accent-color);
    border-radius: 6px 0 0 6px;
    border-right: none;
}

.search-form button {
    padding: 0 1.5rem;
    font-size: 1rem;
    background-color: var(--accent-color);
    color: var(--header-text-color);
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-weight: bold;
}

/* Alphabetical Navigation */
.alpha-nav {
    background-color: #fff;
    padding: 0.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--card-border-color);
    overflow-x: auto;
    white-space: nowrap;
}

.alpha-nav a {
    display: inline-block;
    padding: 0.5rem;
    font-weight: bold;
}

/* Main content area */
main {
    flex-grow: 1;
    padding: 1rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* Grid for content sections */
.content-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Content cards */
.card {
    background-color: var(--card-background);
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    min-width: 0; /* Prevents oversized content from breaking grid */
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--card-border-color);
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
}

.card-body {
    padding: 1.25rem;
    flex-grow: 1;
    overflow-wrap: break-word; /* Prevents long text from breaking layout */
}

.card-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-body ul li {
    margin-bottom: 0.75rem;
}

.card-body ul li a {
    display: block;
}

.card-body p {
    margin-top: 0;
}

.card-image-strip {
    display: flex;
    line-height: 0;
}

.card-image-strip a {
    width: 20%; /* 5 images */
    flex-shrink: 0;
}

.card-image-strip img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    width: 100%;
}

/* Footer */
.main-footer {
    background-color: var(--primary-color-dark);
    color: #fff;
    padding: 1rem;
    text-align: center;
    margin-top: 2rem;
}

.main-footer a {
    color: #fff;
    margin: 0 0.5rem;
}

/* Media Queries for responsiveness */
@media (min-width: 768px) {
    .main-header h1 {
        font-size: 2rem;
    }
    main {
        padding: 2rem;
    }
}



/* === Search Page Specific Styles === */

/* Specific grid settings for the search results page for smaller cards */
.search-results {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.info-card {
    background-color: var(--background-color);
    border-style: dashed;
    text-align: center;
    justify-content: center;
    align-items: center;
    font-weight: 500;
}

/* Results */
.results-section {
    margin-bottom: 2rem;
}
.results-header {
    font-size: 1.8rem;
    color: var(--accent-color);
    border-bottom: 2px solid var(--card-border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}
.artist-card .card-body {
    text-align: center;
}
.artist-name-link {
    font-weight: bold;
    font-size: 1.1rem;
}
.card-image-top {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: top;
}

/* Song cards */
.song-card .song-title {
    font-size: 1.2rem;
    margin: 0 0 0.25rem 0;
}
.song-card .song-artist {
    margin: 0 0 1rem 0;
    font-style: italic;
    color: #555;
}
.song-type-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.song-type-list li {
    margin-bottom: 0.5rem;
}

/* Styles for grouped search results list */
.results-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.results-list-item-info {
    flex-grow: 1;
}

.results-list-item .song-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0 0 0.5rem 0;
}

.song-artist-inline {
    color: #555;
    font-style: italic;
    font-weight: normal;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.song-version-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.song-version-link {
    display: inline-block;
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background-color 0.2s;
    border: 1px solid var(--card-border-color);
}

.song-version-link:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.song-version-link .stars {
    color: #f39c12;
    margin-left: 0.25rem;
}

/* Make song title and artist appear on one line on desktop */
@media (min-width: 768px) {
    .results-list-item .song-title,
    .results-list-item .song-artist {
        display: inline;
        vertical-align: baseline;
    }
    .results-list-item .song-title {
        margin-right: 0.5rem;
    }
    .results-list-item .song-artist {
        margin: 0;
    }
}

/* Make song title and artist appear on one line on desktop */
@media (min-width: 768px) {
    .results-list-item .song-title,
    .results-list-item .song-artist {
        display: inline;
        vertical-align: baseline;
    }
    .results-list-item .song-title {
        margin-right: 0.5rem;
    }
    .results-list-item .song-artist {
        margin: 0;
    }
}
