/* ===== GENERAL BODY & NAVIGATION ===== */
body {
    margin: 0;
    padding: 0;
    background-image: url("../style/images/background.jpg");
    background-size: cover;
    background-attachment: fixed;
    background-repeat: no-repeat;
    font-family: 'Montserrat', sans-serif;
}

#navigation {
    background-color: rgb(252, 167, 152);
    height: auto;
    width: 100%;
    margin-top: 0;
}

#textdiv {
    font-size: 25px;
    font-weight: 500;
    text-align: center;
    padding: 10px 0;
}

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

caption {
    color: white;
    text-align: left;
    padding: 10px;
    background-color: rgba(30, 168, 210, 0.295);
    font-size: 18px;
    font-weight: 500;
}

thead {
    background-color: #4CAF50;
    color: white;
}

table thead td {
    border: 1px solid rgba(49, 104, 50, 0.63);
    color: white;
    padding: 8px;
    text-align: left;
}

table tbody td {
    border: 1px solid rgba(76, 175, 79, 0.63);
    padding: 8px;
    text-align: left;
    color: aqua;
}

table a {
    text-decoration: none;
    color: aqua;
    font-weight: 500;
}

table a:hover {
    text-decoration: underline;
}

table td:nth-child(2),
table td:nth-child(3),
table td:nth-child(4) {
    /* Adjusted to include lyrics column */
    text-align: center;
    width: 8%;
}

/* Selected Key column styling */
table td.selected-key {
    text-align: center;
    width: 8%;
    font-weight: 600;
    color: aqua;
    background-color: rgba(255, 255, 255, 0.03);
}

/* Icon styling in tables */
table i {
    font-size: 1.2em;
    vertical-align: middle;
}

tr:nth-child(even) {
    background-color: #1cb9be21;
}

tr:nth-child(odd) {
    background-color: #f2f2f200;
}

/* ===== INPUTS & BUTTONS ===== */
input[type="text"]#myInput {
    margin-top: 20px;
    margin-bottom: 10px;
    height: 30px;
    border: none;
    border-radius: 3px;
    font-size: 15px;
    font-family: 'Montserrat', sans-serif;
    background-color: honeydew;
    width: 300px;
    padding: 0 10px;
}

#setlist-management-container {
    padding: 20px 15px;
    text-align: center;
}

#setlist-management-container button {
    border: none;
    border-radius: 5px;
    color: black;
    padding: 12px 18px;
    /* Reduced padding */
    font-size: 14px;
    /* Reduced font size */
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    cursor: pointer;
    margin: 5px;
    /* Added small vertical margin for wrapping */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#setlist-management-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* MODIFICATION: Style for new Manage Setlist button */
#manage-setlist-btn {
    background-color: #4CAF50;
    /* Green */
}

/* New Sign Up Button Style */
#signup-modal-btn {
    background-color: #9c27b0;
    /* Purple */
}

#login-modal-btn {
    background-color: #008CBA;
    /* Blue */
}

#logout-btn {
    background-color: #f44336;
    /* Red */
}

#add-song-btn {
    background-color: #f0ad4e;
    /* Orange */
}

#switch-church-btn {
    background-color: #ff9800;
    /* A nice orange/amber distinct from add song */
}

/* ===== MODAL STYLES (MOVED FROM INDEX.HTML) ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    padding-top: 60px;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    max-height: 85vh;
    overflow-y: auto;
    color: #333;
    /* Added for better text readability */
}

.close-modal-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}

.close-modal-btn:hover,
.close-modal-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Modal Specific Inputs and Buttons */
.modal-btn {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.modal-content input[type="text"],
.modal-content input[type="password"],
.modal-content input[type="email"],
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.modal-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

#password-error-msg,
#login-error-msg,
#add-song-error-msg,
#edit-song-msg,
#signup-msg {
    color: red;
    font-size: 14px;
    margin-top: -10px;
    margin-bottom: 10px;
    height: 16px;
}

/* Style for success messages */
#edit-song-msg,
#signup-msg.success {
    color: green;
}


#edit-song-msg {
    color: green;
}

/* Setlist Modal */
#current-setlist-items {
    list-style: none;
    padding: 0;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 10px;
}

#current-setlist-items li {
    padding: 8px 5px;
    border-bottom: 1px dashed #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remove-song-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 15px;
}

/* Song Search in Modal */
#song-search-results .results-list {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    display: none;
    background-color: #fff;
    border: 1px solid #ccc;
    width: 100%;
    box-sizing: border-box;
    margin-top: -10px;
    position: absolute;
    z-index: 1001;
}

#song-search-results .result-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

#song-search-results .result-item:last-child {
    border-bottom: none;
}

#song-search-results .result-item:hover {
    background-color: #f0f0f0;
}

/* Edit/Add Song Modals */
#edit-song-modal textarea,
#add-song-modal textarea {
    width: 100%;
    height: 25vh;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
}

#edit-song-modal .modal-footer,
#add-song-modal .modal-footer {
    text-align: right;
    margin-top: 15px;
}

/* ===== DESKTOP LAYOUT FOR SONG MODALS ===== */
@media (min-width: 900px) {

    /* Wider modal for song editing on desktop */
    #edit-song-modal .modal-content,
    #add-song-modal .modal-content {
        max-width: 950px;
        width: 90%;
    }

    /* Grid container for the textarea sections */
    #edit-song-modal .textarea-row,
    #add-song-modal .textarea-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    /* Make textareas taller on desktop since they're now side-by-side */
    #edit-song-modal textarea,
    #add-song-modal textarea {
        height: 45vh;
    }
}

#save-song-btn,
#save-new-song-btn {
    background-color: #28a745;
}

#cancel-edit-btn,
#cancel-add-btn {
    background-color: #6c757d;
    margin-right: 10px;
}

/* ===== VISIBILITY LOGIC ===== */
#tabletwo .edit-col {
    display: none;
}

body.logged-in #tabletwo .edit-col {
    display: table-cell;
}

body.logged-in #switch-church-btn,
body.logged-in #add-song-btn {
    display: inline-block;
}

/* Hide login/signup when logged in */
body.logged-in #login-modal-btn,
body.logged-in #signup-modal-btn {
    display: none;
}

/* Hide logout when logged out */
body:not(.logged-in) #logout-btn {
    display: none;
}


/* ===== USER MANAGEMENT STYLES (REFINED) ===== */

/* New Button Color */
#user-management-btn {
    background-color: #6f42c1;
    /* A nice purple */
}

/* Make the User Management modal wider and styled to match the app theme */
.modal-content.large {
    max-width: 800px;
    background-color: #1a2634;
    /* Solid dark blue-grey for a cleaner look */
    border-radius: 8px;
    border: 1px solid #34495e;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border-top: 4px solid #4CAF50;
    color: #ecf0f1;
}

/* Theming the modal's titles */
#user-management-modal h2,
#user-management-modal h3 {
    color: #ffffff;
    padding-bottom: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #34495e;
    font-weight: 500;
}

#user-management-modal h3 {
    font-size: 1.1em;
    margin-top: 25px;
    margin-bottom: 10px;
}

.table-container {
    max-height: 40vh;
    overflow-y: auto;
    border-radius: 5px;
    margin-top: 15px;
    border: 1px solid #34495e;
}

/* User list table styling */
#user-list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

#user-list-table th,
#user-list-table td {
    text-align: left;
    padding: 12px 15px;
    border-bottom: 1px solid #34495e;
    vertical-align: middle;
}

#user-list-table th {
    background-color: #2c3e50;
    color: #bdc3c7;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Set a specific width for the Role column */
#user-list-table th:nth-child(2),
#user-list-table td:nth-child(2) {
    width: 180px;
}

#user-list-table td {
    color: #ecf0f1;
}

/* Alternating row colors for readability */
#user-list-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03);
}

#user-list-table tbody tr:nth-child(odd) {
    background-color: transparent;
}


/* Hover effect for rows */
#user-list-table tbody tr:hover {
    background-color: #2c3e50;
}

/* Styling for the 'Add New User' section */
.add-user-section {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    margin-top: 20px;
}

.add-user-section>* {
    flex-grow: 1;
}

.add-user-section label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #ccc;
}

/* Inputs and Selects within the modal */
#user-management-modal input[type="email"],
#user-management-modal select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid rgba(76, 175, 79, 0.6);
    border-radius: 4px;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
}

#user-management-modal select {
    cursor: pointer;
}

#user-management-modal input[type="email"]:focus,
#user-management-modal select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 79, 0.5);
}

/* Style the invite button */
#invite-user-btn {
    background-color: #f0ad4e;
    /* Orange from theme */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-grow: 0.5;
    /* Make button not as wide */
    align-self: flex-end;
    /* Align with bottom of inputs */
    margin-bottom: 0;
    /* Override default modal input margin */
}

#invite-user-btn:hover {
    background-color: #ec9b3b;
}

/* Feedback message styling */
#user-management-msg {
    height: 20px;
    font-weight: 500;
    margin-top: 15px;
    text-align: center;
}

#user-management-msg.error {
    color: #f44336;
    /* Red from theme */
}

#user-management-msg.success {
    color: #4CAF50;
    /* Green from theme */
}

/* Role select dropdown in the table */
.role-select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #34495e;
    background-color: #1a2634;
    color: #ecf0f1;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.role-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #2c3e50;
}

.role-select:focus {
    border-color: #4CAF50;
}

.user-email-hint {
    font-size: 0.85em;
    color: #95a5a6;
    margin-left: 8px;
    font-weight: 400;
}

/* Year Selector Styling */
.year-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.year-selector-wrapper label {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1;
}

#schedule-year-select {
    background: transparent;
    border: none;
    color: #00bcd4;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    padding: 0;
    margin: 0;
    height: auto;
    width: auto;
}

#schedule-year-select option {
    background: #1a1a1a;
    color: white;
}

/* Global Role Modal Premium Overhaul */
#add-global-role-modal .modal-content {
    background: linear-gradient(145deg, #1e2a38, #16202c);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    padding: 40px;
}

#add-global-role-modal h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #fff 0%, #00bcd4 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}


#add-global-role-modal label {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    display: block;
}

#add-global-role-modal input[type="text"],
#add-global-role-modal select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s ease;
    margin-bottom: 25px;
}

#add-global-role-modal input[type="text"]:focus,
#add-global-role-modal select:focus {
    border-color: #00bcd4;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 4px rgba(0, 188, 212, 0.1);
    outline: none;
}

#add-global-role-modal .modal-btn {
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
}

#save-global-role-btn {
    background: linear-gradient(135deg, #00bcd4 0%, #00acc1 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.3);
}

#save-global-role-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 188, 212, 0.4);
}

#cancel-global-role-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    color: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#cancel-global-role-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

#add-global-role-modal .modal-footer {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

#add-global-role-modal .modal-body {
    margin-top: 20px;
}




.delete-user-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.delete-user-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.feedback-msg {
    height: 20px;
    font-weight: 500;
    margin-bottom: 10px;
}

#current-setlist-items {
    list-style: none;
    padding: 0;
    margin-top: 10px;
    max-height: 250px;
    /* Increased height slightly */
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 10px;
}

/* NEW: Style for each song item as a distinct 'box' */
#current-setlist-items li {
    display: flex;
    align-items: center;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
    /* Spacing between items */
    user-select: none;
    /* Prevents text selection during drag */
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* NEW: Style for the drag handle */
.drag-handle {
    display: flex;
    align-items: center;
    padding-right: 12px;
    cursor: move;
    color: #888;
}

.drag-handle:hover {
    color: #333;
}

/* NEW: The song name span should take up the available space */
.song-name {
    flex-grow: 1;
    /* Pushes the remove button to the far right */
    text-align: left;
    /*  <-- ADD THIS LINE */
}

.remove-song-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 15px;
}

/* NEW: Enhanced style for the item being dragged */
#current-setlist-items li.dragging {
    opacity: 0.9;
    background: #e7f3ff;
    border-color: #9acffa;
    box-shadow: 0 4px 12px rgba(0, 80, 150, 0.2);
    transform: scale(1.02);
    /* Lifts the item slightly */
}

/* ===== RESPONSIVE LAYOUT FOR BUTTONS ===== */
@media (max-width: 768px) {

    #setlist-management-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        /* Creates a 2-column grid */
        gap: 12px;
        /* Sets the space between buttons */

        /* Optional: Constrain width and center the grid on mobile */
        max-width: 450px;
        margin: 0 auto;
    }

    #setlist-management-container button {
        margin: 0;
        /* The 'gap' property now handles spacing */
        width: 100%;
        /* Makes buttons fill their grid cell */
        padding: 15px 10px;
        /* Adjust padding for better look on mobile */
    }

    /* This rule targets the 5th button (User Management for Admins)
       and ensures it starts in the first column of the third row,
       leaving the non-admin view clean. */
    #user-management-btn {
        grid-column: 1 / 2;
    }

    /* --- Styles for Add Song Modal on Mobile --- */
    #add-song-modal .modal-content {
        width: 95%;
        /* Make modal almost full width */
        max-width: none;
        /* Remove the desktop max-width limit */
        margin: 20px auto;
        /* Adjust top/bottom margin */
        padding: 15px;
        /* Slightly reduce padding on smaller screens */
    }

    #add-song-modal textarea {
        height: 35vh;
        /* Increase height (approx 2-3 lines more than before) */
        font-size: 13px;
        /* Make font one size smaller */
    }
}

/* ===== ENHANCED MOBILE MODAL RESPONSIVENESS ===== */
@media (max-width: 600px) {
    .modal {
        padding-top: 20px;
        /* Reduced from 60px for better modal positioning */
    }

    .modal-content {
        width: 95%;
        /* Use more screen space */
        max-width: none;
        /* Remove desktop max-width constraint */
        margin: 10px auto;
        /* Tighter top/bottom spacing */
        padding: 15px;
        /* Reduced from 25px */
        max-height: 90vh;
        /* Increased from 85vh */
    }

    .modal-content textarea {
        height: 40vh;
        /* More consistent sizing for mobile */
        font-size: 16px;
        /* Prevents browser auto-zoom on input focus (iOS) */
    }

    .modal-footer {
        display: flex;
        gap: 10px;
        flex-direction: row;
        margin-top: 15px;
    }

    .modal-footer button {
        flex: 1;
        /* Equal button widths */
        padding: 12px 10px;
    }

    #edit-song-modal textarea,
    #add-song-modal textarea {
        height: 40vh;
    }

    #setlist-modal .modal-content {
        padding: 15px;
    }

    #current-setlist-items {
        max-height: 40vh;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 12px;
        margin: 5px auto;
    }

    .modal-content input[type="text"],
    .modal-content input[type="password"],
    .modal-content input[type="email"],
    .modal-content select,
    .modal-content textarea {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }

    .modal-content textarea {
        height: 45vh;
        /* Slightly larger for better usability */
    }

    .modal-footer {
        flex-direction: column;
        /* Stack buttons vertically on tiny screens */
        gap: 8px;
    }

    .modal-footer button {
        width: 100%;
        padding: 14px;
    }

    .modal-btn {
        width: 100%;
        padding: 12px;
    }

    #setlist-management-container button {
        padding: 12px 10px;
        font-size: 13px;
    }

    #current-setlist-items li {
        padding: 8px;
        margin-bottom: 6px;
    }

    .drag-handle {
        padding-right: 8px;
    }

    .song-name {
        font-size: 14px;
    }

    .remove-song-btn {
        padding: 4px 8px;
        font-size: 11px;
        margin-left: 8px;
    }
}

/* ===== SCHEDULE MANAGER STYLES (PROFESSIONAL & PREMIUM) ===== */

/* Button colors */
#schedule-manager-btn {
    background-color: #00bcd4;
    /* Cyan */
}

#view-schedule-btn {
    background-color: #03a9f4;
    /* Light Blue */
}

/* Quarter Tabs */
.quarter-tabs {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}

.quarter-tabs::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

.quarter-tab {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.quarter-tab:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.quarter-tab.active {
    color: #00bcd4;
    border-bottom-color: #00bcd4;
    background-color: rgba(0, 188, 212, 0.05);
    font-weight: 700;
}

/* Schedule Cards Container */
.schedule-cards-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 15px 10px;
    max-height: 70vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Individual Sunday Card - Glassmorphism & Depth */
.schedule-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    /* Slightly more opaque for better visibility */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: visible;
    /* Crucial: show all content */
    min-height: 200px;
    height: auto;
    /* Allow growth */
    flex-shrink: 0;
    /* CRITICAL: Prevent cards from squashing and overlapping */
}


/* Modal sizing refinements */
.modal-content.large {
    width: 90%;
    max-width: 1200px;
}

.modal-content.small {
    width: 90%;
    max-width: 450px;
}

.schedule-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 188, 212, 0.4);
    box-shadow: 0 15px 45px 0 rgba(0, 0, 0, 0.5);
}

.schedule-card.readonly {
    background: rgba(255, 255, 255, 0.01);
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.05);
}

/* Date Badge - Full Width Header */
.schedule-date-badge {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    color: white;
    padding: 15px 25px;
    text-align: left;
    position: relative;
    overflow: hidden;
    border-top-left-radius: 12px; /* Slight mismatch fix if rounding varies */
    border-top-right-radius: 12px;
}

.schedule-date-badge::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
    pointer-events: none;
}

.schedule-card.readonly .schedule-date-badge {
    background: linear-gradient(135deg, #606c88 0%, #3f4c6b 100%);
}

.date-day {
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
}

.date-month {
    font-size: 18px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 2px;
    opacity: 0.95;
}

.date-year {
    font-size: 14px;
    opacity: 0.7;
    font-weight: 500;
    margin-left: auto; /* Push year to right */
}

/* Main Content Section (Right Side) */
.schedule-content {
    flex-grow: 1;
    padding: 25px 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Ensure top roles are never cut off */
}

/* Roles Grid System */
.schedule-roles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px 40px;
}

/* Individual Role Item */
.role-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-item label {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space for delete btn */
    gap: 8px;
    margin-bottom: 8px;
}

.role-item label span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-item label i {
    font-size: 14px;
    width: 20px;
    text-align: center;
    color: #00bcd4;
    opacity: 0.8;
}

.delete-role-btn {
    color: rgba(255, 107, 107, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-role-btn:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    transform: scale(1.1);
}


/* Highlight priority roles */
.role-item.priority label {
    color: #ff9800;
}

.role-item.priority label i {
    color: #ff9800;
}

/* Inputs & Selects - Premium Dark Style */
.role-item select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    background-color: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff !important;
    font-family: inherit;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2300BCD4%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 12px auto;
}

.role-item select:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 0 4px rgba(0, 188, 212, 0.15);
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.role-item select:hover {
    border-color: rgba(0, 188, 212, 0.5);
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.role-item select option {
    background-color: #1a1a1a;
    /* Solid dark background for the list */
    color: #fff;
    padding: 10px;
}


/* Multi-select styling */
.multi-select-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.checkbox-label {
    padding: 8px;
    font-size: 13px;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-label:hover {
    background-color: rgba(0, 188, 212, 0.1);
    color: #fff;
}

.checkbox-label input[type="checkbox"] {
    accent-color: #00bcd4;
    width: 16px;
    height: 16px;
}

/* Readonly Values */
.readonly-value {
    font-size: 15px;
    color: #fff;
    font-weight: 500;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Add Role Button */
.add-role-wrapper {
    grid-column: span 3;
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.add-column-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.4);
    padding: 10px 25px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-column-btn:hover {
    border-color: #00bcd4;
    color: #00bcd4;
    background-color: rgba(0, 188, 212, 0.1);
    transform: scale(1.05);
}

.add-column-btn i {
    font-size: 12px;
}

/* Toast Notification Upgrade */
.schedule-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 32px;
    background: rgba(46, 204, 113, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
}

.schedule-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.schedule-toast.error {
    background: rgba(231, 76, 60, 0.9);
}

/* Responsive Adjustments */
@media (max-width: 1000px) {
    .schedule-roles {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px 30px;
    }

    .add-role-wrapper {
        grid-column: span 2;
    }
}

@media (max-width: 650px) {
    .schedule-content {
        padding: 15px;
    }

    .schedule-roles {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .add-role-wrapper {
        grid-column: span 1;
    }
}

/* Scrollbar styling */
.schedule-cards-container::-webkit-scrollbar {
    width: 8px;
}

.schedule-cards-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.schedule-cards-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.schedule-cards-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 188, 212, 0.3);
}