/*
    Catholic Chart Board - Main Stylesheet
    Version: 2.5 (Teaser Shortcode Styles)
*/

/* --- Variables (Mini Design System) -- */
:root {
    --ccb-blue: #007bff;
    --ccb-blue-dark: #0056b3;
    --ccb-red: #dc3545;
    --ccb-yellow: #ffc107;
    --ccb-green: #28a745;
    --ccb-text-dark: #212529;
    --ccb-text-light: #6c757d;
    --ccb-border-color: #dee2e6;
    --ccb-bg-light: #f8f9fa;
    --ccb-font-sans-serif: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --ccb-border-radius: .375rem; /* 6px */
    --ccb-border-radius-lg: .5rem; /* 8px */
    --ccb-border-radius-pill: 50rem;
    --ccb-shadow-sm: 0 .125rem .25rem rgba(0,0,0,.075);
    --ccb-shadow-md: 0 .5rem 1rem rgba(0,0,0,.15);

    /* New variables for modern look */
    --ccb-primary-color: #6a1b9a; /* A vibrant purple */
    --ccb-primary-color-dark: #4a148c;
    --ccb-secondary-color: #e0f2f7; /* Light blue for backgrounds */
    --ccb-accent-color: #ff8a65; /* A soft orange for highlights */
    --ccb-input-border: #ced4da;
    --ccb-input-focus-shadow: 0 0 0 .2rem rgba(106, 27, 154, .25); /* Purple shadow */
}

/* --- Base Modal Styles -- */
.ccb-modal-overlay { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.ccb-modal-content { background-color: #fff; margin: 10% auto; padding: 2rem; border: 0; width: 90%; max-width: 700px; position: relative; border-radius: var(--ccb-border-radius-lg); box-shadow: var(--ccb-shadow-md); }
.ccb-close-button { color: var(--ccb-text-light); float: right; font-size: 1.75rem; font-weight: 700; line-height: 1; opacity: .5; }
.ccb-close-button:hover, .ccb-close-button:focus { color: var(--ccb-text-dark); opacity: .75; text-decoration: none; cursor: pointer; }

/* --- Main Chart Styles -- */
.catholic-hymn-chart-board {
    background-color: #fff;
    border: 1px solid var(--ccb-border-color);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--ccb-border-radius-lg);
    font-family: var(--ccb-font-sans-serif);
    font-size: 14px;
}

.catholic-hymn-chart-board h2 {
    text-align: center;
    margin: 0 0 1.5rem 0;
    color: var(--ccb-text-dark);
    font-size: 1.5em;
    font-weight: 600;
}

.ccb-submit-hymn-button {
    display: block;
    width: fit-content;
    margin: 0 auto 1.5rem auto;
    padding: .6rem 1.25rem;
    background-color: var(--ccb-blue);
    color: #fff;
    border: none;
    border-radius: var(--ccb-border-radius);
    cursor: pointer;
    font-size: .9em;
    font-weight: 600;
    transition: all 0.2s ease;
}
.ccb-submit-hymn-button:hover { background-color: var(--ccb-blue-dark); transform: translateY(-1px); }

/* --- Controls (Search & Sort) -- */
.ccb-controls-container { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.ccb-search-container { flex-grow: 1; }
#ccb-hymn-search, #ccb-hymn-sort { padding: .6rem 1rem; border: 1px solid var(--ccb-border-color); border-radius: var(--ccb-border-radius-pill); font-size: .9em; background-color: #fff; }
#ccb-hymn-search { width: 100%; max-width: 400px; }
#ccb-hymn-sort { cursor: pointer; }
#ccb-hymn-search:focus { outline: none; border-color: var(--ccb-blue); box-shadow: 0 0 0 .25rem rgba(0, 123, 255, .25); }

/* --- Hymn List --- */
.hymn-list { list-style-type: none; padding-left: 0; margin: 0; }
.hymn-grid-container { display: grid; grid-template-columns: 70px 70px minmax(300px, 3fr) 110px 110px 170px; gap: 1rem; align-items: center; padding: .75rem 0; }
.hymn-chart-header { font-weight: 600; color: var(--ccb-text-light); border-bottom: 2px solid var(--ccb-border-color); margin-bottom: .5rem; padding-bottom: .75rem; font-size: .85em; }
.hymn-chart-header > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.hymn-item { border-bottom: 1px solid var(--ccb-border-color); transition: background-color 0.2s ease; }
.hymn-item:last-child { border-bottom: none; }
.hymn-item:hover { background-color: var(--ccb-bg-light); }

.hymn-item-thumbnail { position: relative; text-align: center; }
.hymn-item-thumbnail img { width: 70px; height: 52.5px; object-fit: cover; border-radius: var(--ccb-border-radius); box-shadow: var(--ccb-shadow-sm); }

.hymn-rank-header, .hymn-item-rank { display: flex; align-items: center; justify-content: center; gap: .5rem; color: var(--ccb-text-light); font-size: .9em; }
.hymn-title-artist-header { white-space: nowrap; } /* Ensure this specific header cell doesn't wrap */
.hymn-title-artist-header .header-sub-text { white-space: nowrap; } /* Ensure sub-text doesn't wrap */
.hymn-item-title-artist { display: flex; flex-direction: column; justify-content: center; }
.hymn-item-actions { display: flex; align-items: center; gap: .75rem; justify-content: flex-end; }

.hymn-item h3.hymn-title { font-size: 1em; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hymn-item h3.hymn-title a { text-decoration: none; color: var(--ccb-text-dark); }
.hymn-item h3.hymn-title a:hover { color: var(--ccb-blue); }

.hymn-artist { font-size: 0.85em; color: var(--ccb-text-light); margin: 4px 0 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hymn-item-category { text-align: center; }
.hymn-item-category .hymn-categories { display: inline-block; background-color: #e7f3ff; color: #0056b3; padding: 4px 12px; border-radius: var(--ccb-border-radius-pill); font-size: 0.75em; font-weight: 500; white-space: nowrap; }

.hymn-likes { display: flex; align-items: center; gap: .5rem; }
.hymn-likes span { font-size: 0.9em; font-weight: 600; color: var(--ccb-text-dark); }

/* --- Action Buttons --- */
.ccb-like-button, .ccb-listen-button, .ccb-favorite-button { background: transparent; border: none; cursor: pointer; padding: 0; font-size: 1.3em; transition: transform 0.2s ease; line-height: 1; }
.ccb-like-button { color: #fd79a8; }
.ccb-listen-button { color: var(--ccb-text-light); text-decoration: none; }
.ccb-favorite-button { color: var(--ccb-yellow); }
.ccb-like-button:hover, .ccb-listen-button:hover, .ccb-favorite-button:hover { transform: scale(1.2); }
.ccb-like-button.liked { color: #e84393; transform: scale(1); }
.ccb-favorite-button.favorited { transform: scale(1.1); }

.view-lyrics-button { background-color: var(--ccb-bg-light); border: 1px solid var(--ccb-border-color); padding: 4px 8px; border-radius: var(--ccb-border-radius); font-size: 0.75em; color: var(--ccb-text-light); text-decoration: none; transition: all 0.2s ease; white-space: nowrap; }
.view-lyrics-button:hover { background-color: #e9ecef; border-color: #ced4da; }

.ccb-item-hidden { display: none !important; }

/* --- Rank Fluctuation --- */
.rank-fluctuation-desktop { display: inline-block; font-size: 0.85em; font-weight: 600; width: 35px; text-align: left; }
.rank-fluctuation-mobile { display: none; }
.rank-up { color: var(--ccb-blue); }
.rank-down { color: var(--ccb-red); }
.rank-no-change { color: var(--ccb-text-light); }
.rank-new { color: var(--ccb-green); font-style: italic; font-weight: bold; }

/* --- Player Modal --- */
.ccb-player-modal-content { padding: 1rem; background-color: #000; width: 90%; max-width: 800px; border-radius: var(--ccb-border-radius-lg); }
.ccb-player-modal-content .ccb-close-button { color: #fff; opacity: 0.8; font-size: 2rem; top: 0; right: .5rem; position: absolute; }
.ccb-player-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--ccb-border-radius); }
.ccb-player-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* --- Teaser Shortcode Styles --- */
.ccb-teaser-list {
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--ccb-border-color);
    border-radius: var(--ccb-border-radius-lg);
    background-color: #fff;
}
.ccb-teaser-list h3 {
    font-size: 1.2em;
    color: var(--ccb-text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

.ccb-teaser-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ccb-teaser-item {
    display: flex;
    align-items: center;
    padding: .5rem 0;
    border-bottom: 1px dashed var(--ccb-border-color);
}
.ccb-teaser-item:last-child { border-bottom: none; }

.ccb-teaser-thumbnail {
    flex-shrink: 0;
    margin-right: .75rem;
}
.ccb-teaser-thumbnail img {
    width: 40px;
    height: 30px;
    object-fit: cover;
    border-radius: var(--ccb-border-radius);
}

.ccb-teaser-content {
    display: flex;
    align-items: center;
    flex-grow: 1;
    overflow: hidden; /* For ellipsis */
}

.ccb-teaser-rank {
    font-weight: 600;
    color: var(--ccb-text-dark);
    margin-right: .5rem;
    width: 25px;
    flex-shrink: 0;
}

.ccb-teaser-fluctuation {
    font-size: 0.8em;
    margin-right: .75rem;
    width: 35px;
    flex-shrink: 0;
}

.ccb-teaser-title {
    font-weight: 500;
    color: var(--ccb-blue-dark);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}
.ccb-teaser-title:hover { text-decoration: underline; }

.ccb-teaser-artist {
    font-size: 0.9em;
    color: var(--ccb-text-light);
    margin-left: .5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ccb-teaser-footer {
    text-align: center;
    margin-top: 1rem;
}
.ccb-teaser-view-all-btn {
    display: inline-block;
    padding: .5rem 1rem;
    background-color: var(--ccb-blue);
    color: #fff;
    text-decoration: none;
    border-radius: var(--ccb-border-radius);
    font-size: .9em;
    transition: background-color 0.2s ease;
}
.ccb-teaser-view-all-btn:hover { background-color: var(--ccb-blue-dark); }

/* --- Submission Form Styles --- */
.catholic-hymn-submission-form {
    background-color: var(--ccb-secondary-color); /* Light background */
    border: none;
    padding: 2.5rem; /* More padding */
    margin-bottom: 2rem;
    border-radius: var(--ccb-border-radius-lg);
    font-family: var(--ccb-font-sans-serif);
    box-shadow: var(--ccb-shadow-md); /* More prominent shadow */
    max-width: 700px; /* Constrain width */
    margin-left: auto;
    margin-right: auto;
}

.catholic-hymn-submission-form h2 {
    font-size: 2em; /* Larger title */
    color: var(--ccb-primary-color-dark); /* Darker primary color */
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 700;
}

.catholic-hymn-submission-form .ccb-info-message,
.catholic-hymn-submission-form .ccb-registration-prompt {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.1em;
    color: var(--ccb-text-dark);
}

.catholic-hymn-submission-form .ccb-registration-prompt a {
    color: var(--ccb-primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}
.catholic-hymn-submission-form .ccb-registration-prompt a:hover {
    color: var(--ccb-primary-color-dark);
    text-decoration: underline;
}

.catholic-hymn-submission-form p {
    margin-bottom: 1.2rem;
}

.catholic-hymn-submission-form label {
    display: block;
    margin-bottom: .5rem;
    font-weight: 600;
    color: var(--ccb-text-dark);
    font-size: 1.05em;
}

.catholic-hymn-submission-form input[type="text"],
.catholic-hymn-submission-form input[type="url"],
.catholic-hymn-submission-form textarea {
    width: 100%;
    padding: .8rem 1rem;
    border: 1px solid var(--ccb-input-border);
    border-radius: var(--ccb-border-radius);
    font-family: var(--ccb-font-sans-serif);
    font-size: 1em;
    color: var(--ccb-text-dark);
    background-color: #fff;
    transition: all 0.2s ease;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.catholic-hymn-submission-form input[type="text"]:focus,
.catholic-hymn-submission-form input[type="url"]:focus,
.catholic-hymn-submission-form textarea:focus {
    outline: none;
    border-color: var(--ccb-primary-color);
    box-shadow: var(--ccb-input-focus-shadow);
}

.catholic-hymn-submission-form textarea {
    min-height: 120px;
    resize: vertical;
}

.catholic-hymn-submission-form input[type="checkbox"] {
    margin-right: .5rem;
}

.catholic-hymn-submission-form input[type="submit"] {
    display: block;
    width: auto; /* Adjust width to content */
    min-width: 180px;
    margin: 2rem auto 0 auto; /* Center and add top margin */
    padding: 1rem 2rem;
    background-color: var(--ccb-primary-color); /* Vibrant primary color */
    color: #fff;
    border: none;
    border-radius: var(--ccb-border-radius-pill); /* Pill shape */
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 700;
    transition: all 0.3s ease;
    letter-spacing: .05em;
    text-transform: uppercase;
    box-shadow: var(--ccb-shadow-sm);
}
.catholic-hymn-submission-form input[type="submit"]:hover {
    background-color: var(--ccb-primary-color-dark);
    transform: translateY(-2px);
    box-shadow: var(--ccb-shadow-md);
}

/* Category checkboxes layout */
.catholic-hymn-submission-form .category-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: .5rem;
}

.catholic-hymn-submission-form .category-checkboxes label {
    display: flex;
    align-items: center;
    font-weight: 400; /* Lighter font weight for individual categories */
    color: var(--ccb-text-dark);
    margin-bottom: 0; /* Reset margin */
    cursor: pointer;
}

.catholic-hymn-submission-form .category-checkboxes input[type="checkbox"] {
    /* Custom checkbox styling (optional, more complex) */
    /* For now, just ensure basic alignment */
    flex-shrink: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .catholic-hymn-chart-board { padding: 10px; font-size: 13px; }
    .hymn-chart-header, .hymn-item-lyrics, .hymn-item-category, .hymn-item-rank, .rank-fluctuation-desktop { display: none; }
    .hymn-grid-container { grid-template-columns: 60px 1fr auto; gap: .75rem; padding: .5rem 0; }
    .hymn-item-thumbnail img { width: 60px; height: 45px; }
    .hymn-item-title-artist { justify-content: center; }
    .hymn-item h3.hymn-title, .hymn-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .hymn-item h3.hymn-title { font-size: 1em; }
    .hymn-artist { font-size: 0.9em; }
    .hymn-item-actions { gap: .75rem; }
    .hymn-likes span { font-size: 0.8em; }
    .ccb-modal-content { margin: 5% auto; width: 95%; padding: 1.5rem; }
    .rank-fluctuation-mobile {
        display: block; position: absolute; top: -5px; right: -5px; background-color: rgba(0, 0, 0, 0.7); color: #fff; padding: 2px 6px; border-radius: var(--ccb-border-radius); font-size: 0.7em; font-weight: bold; line-height: 1.2;
    }
    .rank-fluctuation-mobile .rank-up { color: #4cff4c; }
    .rank-fluctuation-mobile .rank-down { color: #ff4c4c; }
    .rank-fluctuation-mobile .rank-no-change { color: #ccc; }
    .rank-fluctuation-mobile .rank-new { color: #4cb6ff; }

    /* Submission Form Responsive */
    .catholic-hymn-submission-form {
        padding: 1.5rem;
    }
    .catholic-hymn-submission-form h2 {
        font-size: 1.5em;
    }
    .catholic-hymn-submission-form input[type="submit"] {
        min-width: unset;
        width: 100%;
        padding: .8rem 1.5rem;
    }
}