/* ----------------------------------------------------------------
    CSB Team App - Public Styles
-----------------------------------------------------------------*/

/* General Table & Form Styles */
.csb-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.csb-table th, .csb-table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}
.csb-table th {
    background-color: #f5f5f5;
}

/* Status Badges */
.csb-status-paid { color: #4CAF50; font-weight: bold; }
.csb-status-partially_paid { color: #f0ad4e; font-weight: bold; }
.csb-status-unpaid { color: #f44336; font-weight: bold; }
.csb-status-overdue { color: #ff9800; font-weight: bold; }
.csb-status-cancelled { color: #9e9e9e; }


/* --- Collapsible Section Styles --- */
.csb-collapsible-trigger {
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.csb-collapsible-trigger:hover {
    color: #0073aa;
}

.csb-collapsible-content {
    display: none; /* Hidden by default */
    padding-left: 15px;
    border-left: 3px solid #f0f0f0;
}

/* --- Calendar Styles (with increased specificity) --- */
.csb-calendar-wrapper {
    width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.csb-calendar-wrapper .csb-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.csb-calendar-wrapper .csb-calendar-header h2 {
    margin: 0 10px;
    font-size: 24px;
    order: 2;
}

.csb-calendar-wrapper .csb-calendar-header a {
    text-decoration: none;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #333;
    order: 1;
}

.csb-calendar-wrapper .csb-calendar-header a:last-of-type {
    order: 3;
}

.csb-calendar-wrapper .csb-calendar-nav-form {
    order: 2;
}

.csb-calendar-wrapper .csb-calendar {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    border: 1px solid #ddd; /* Add a border around the whole calendar */
}

.csb-calendar-wrapper .csb-calendar th {
    text-align: center;
    padding: 10px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
}

.csb-calendar-wrapper .csb-calendar td {
    border: 1px solid #ddd;
    vertical-align: top;
    height: 120px;
    padding: 5px;
    overflow: hidden;
}

.csb-calendar-wrapper .csb-calendar .day-number {
    font-weight: bold;
    font-size: 14px;
    text-align: right;
    margin-bottom: 5px;
}
.csb-calendar-wrapper .csb-calendar .day-number a {
    text-decoration: none;
    color: #333;
    padding: 2px 5px;
    display: inline-block;
}

.csb-calendar-wrapper .csb-calendar .csb-today {
    background-color: #fffde7;
}

.csb-calendar-wrapper .csb-calendar .csb-today .day-number a {
    color: #d84315;
    font-weight: bold;
}

.csb-calendar-wrapper .csb-calendar .events-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
}

.csb-calendar-wrapper .csb-calendar .events-list li {
    margin-bottom: 3px;
}

.csb-calendar-wrapper .csb-calendar .events-list a {
    display: block;
    background-color: #e3f2fd;
    color: #1e88e5;
    padding: 3px 5px;
    border-radius: 3px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.csb-calendar-wrapper .csb-calendar .events-list a:hover {
    background-color: #bbdefb;
}

/* --- Event Highlight Colour Styles --- */
.csb-event-highlight-red { background-color: #ffcdd2 !important; color: #c62828 !important; }
.csb-event-highlight-yellow { background-color: #fff9c4 !important; color: #f9a825 !important; }
.csb-event-highlight-orange { background-color: #ffe0b2 !important; color: #ef6c00 !important; }
.csb-event-highlight-pink { background-color: #f8bbd0 !important; color: #c2185b !important; }
.csb-event-highlight-purple { background-color: #e1bee7 !important; color: #7b1fa2 !important; }
.csb-event-highlight-green { background-color: #c8e6c9 !important; color: #2e7d32 !important; }


/* --- Modal Styles --- */
.csb-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.csb-modal-content {
    background-color: #fefefe; /* This provides the white background */
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 5px;
    position: relative;
}

.csb-modal-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* --- Responsive Invoice Table Styles --- */
@media screen and (max-width: 768px) {
    .csb-table thead {
        /* Hide the table header on mobile */
        border: none;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }
    .csb-table, .csb-table tbody, .csb-table tr, .csb-table td {
        display: block;
        width: 100%;
    }
    .csb-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
    }
    .csb-table td {
        text-align: right; /* Align content to the right */
        padding-left: 50%; /* Create space for the label */
        position: relative;
        border: none;
        border-bottom: 1px solid #eee;
    }
    .csb-table td:before {
        /* Use the data-label attribute as the column header */
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: calc(50% - 20px);
        padding-right: 10px;
        font-weight: bold;
        text-align: left;
    }
    .csb-invoice-items-table tfoot td {
        text-align: left;
        padding-left: 10px;
    }
    .csb-invoice-items-table tfoot td.text-right {
        text-align: right !important;
    }
    .csb-calendar-header h2 {
        font-size: 18px;
    }
    .csb-calendar th {
        padding: 5px;
        font-size: 12px;
    }
    .csb-calendar td {
        height: 90px;
    }
    .csb-calendar .events-list a {
        font-size: 11px;
    }
}

/* --- Form Alignment Styles --- */
.csb-form p,
#csb-login-form p {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.csb-form label,
#csb-login-form label {
    flex-basis: 150px; /* Adjust this width as needed */
    flex-grow: 0;
    flex-shrink: 0;
    padding-right: 15px;
    text-align: left;
}

.csb-form .checkbox-label {
    flex-basis: auto;
}

.csb-form input[type="text"],
.csb-form input[type="email"],
.csb-form input[type="password"],
.csb-form input[type="date"],
.csb-form select,
#csb-login-form input[type="text"],
#csb-login-form input[type="password"] {
    flex-grow: 1;
    width: auto;
}

.csb-form-field-container {
    padding-left: 165px; 
    margin-top: -10px; 
    margin-bottom: 10px;
}

.csb-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.csb-form-label-wrapper {
    flex-basis: 150px;
    flex-grow: 0;
    flex-shrink: 0;
    padding-right: 15px;
    text-align: left;
}

.csb-form-label-wrapper .description {
    font-size: 0.85em;
    font-style: italic;
    color: #666;
}

.csb-form-input-wrapper {
    flex-grow: 1;
    width: auto;
}

.csb-full-width-input {
    width: 100%;
}


/* --- Bulletin Page Styles --- */
.csb-bulletin-item {
    margin-bottom: 2.5em;
    padding-bottom: 1.5em;
    border-bottom: 1px solid #eee;
}
.csb-bulletin-item:last-child {
    border-bottom: none;
}
.csb-bulletin-item h3 {
    margin-top: 0;
    margin-bottom: 0.25em;
}
.csb-bulletin-meta {
    font-size: 0.9em;
    color: #666;
    margin-top: 0;
    margin-bottom: 1em;
}
.csb-bulletin-content p:first-child {
    margin-top: 0;
}
.csb-bulletin-content p:last-child {
    margin-bottom: 0;
}
.csb-bulletin-read-more {
    display: inline-block;
    margin-top: 1em;
    font-weight: bold;
}
/* --- Dashboard Notices --- */
.csb-error {
    color: #a94442;
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}
.csb-success {
    color: #3c763d;
    background-color: #dff0d8;
    border: 1px solid #d6e9c6;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}}

/* ============================================================
   WAIVERS
   ============================================================ */

.csb-waivers-wrapper {
    max-width: 820px;
    margin: 0 auto;
}

/* Flash notice */
.csb-notice { padding: 12px 16px; border-radius: 4px; margin-bottom: 20px; }
.csb-notice-success { background: #eafaea; border: 1px solid #4caf50; color: #2a662a; }

/* Waiver card */
.csb-waiver-card {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 24px;
    overflow: hidden;
}
.csb-waiver-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #f7f7f7;
    border-bottom: 1px solid #ddd;
}
.csb-waiver-card-header h2 {
    margin: 0;
    font-size: 1.2em;
}
.csb-waiver-status {
    font-size: 0.8em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.csb-status-open   { background: #eafaea; color: #2a662a; border: 1px solid #4caf50; }
.csb-status-closed { background: #f5f5f5; color: #666; border: 1px solid #ccc; }

/* Dancer rows */
.csb-waiver-dancers-list { padding: 0 20px; }
.csb-waiver-dancer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.csb-waiver-dancer-row:last-of-type { border-bottom: none; }
.csb-dancer-name { flex: 1; font-weight: 600; }
.csb-waiver-signed-badge {
    color: #2a662a;
    font-size: 0.9em;
    font-weight: 600;
}
.csb-btn-review {
    background: none;
    border: 1px solid #0073aa;
    color: #0073aa;
    padding: 4px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85em;
}
.csb-btn-review:hover { background: #0073aa; color: #fff; }

/* Inline waiver form */
.csb-waiver-form-section {
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}
.csb-waiver-form-inner { padding: 20px; }

.csb-waiver-body-display {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 0.95em;
    line-height: 1.7;
}

/* Sections inside form */
.csb-waiver-section { margin-bottom: 20px; }
.csb-waiver-section h4 {
    font-size: 1em;
    font-weight: 700;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

/* Yes/No questions */
.csb-waiver-question-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.csb-waiver-question-item p { margin: 0 0 8px; }
.csb-yn-radios { display: flex; gap: 16px; }
.csb-yn-radios label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; }
.csb-yn-label {
    padding: 3px 14px;
    border-radius: 3px;
    border: 2px solid #ddd;
    font-size: 0.9em;
    transition: all 0.15s;
}
.csb-yn-radios input[type="radio"]:checked + .csb-yn-yes { background: #eafaea; border-color: #4caf50; color: #2a662a; }
.csb-yn-radios input[type="radio"]:checked + .csb-yn-no  { background: #faeaea; border-color: #e53935; color: #b71c1c; }
.csb-yn-radios input[type="radio"] { display: none; }

/* Emergency contact */
.csb-form-row { margin-bottom: 12px; }
.csb-form-row label { display: block; font-weight: 600; margin-bottom: 4px; }
.csb-input {
    width: 100%;
    max-width: 400px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    box-sizing: border-box;
}
.required { color: #c00; }

/* Signature section */
.csb-sig-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    border-bottom: 2px solid #ddd;
}
.csb-sig-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #666;
    margin-bottom: -2px;
    transition: color 0.15s;
}
.csb-sig-tab:hover { color: #0073aa; }
.csb-sig-tab-active { border-bottom-color: #0073aa; color: #0073aa; }

/* Typed signature */
.csb-typed-signature {
    font-family: 'Dancing Script', 'Brush Script MT', 'Segoe Script', cursive !important;
    font-size: 1.5em !important;
    padding: 8px 12px !important;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    letter-spacing: 0.03em;
}

/* Drawn signature canvas */
.csb-signature-pad-wrapper {
    width: 100%;
    max-width: 460px;
    border: 2px solid #ccc;
    border-radius: 4px;
    background: #fff;
    margin-bottom: 8px;
    cursor: crosshair;
}
.csb-signature-canvas { display: block; width: 100%; }
.csb-btn-clear-sig { font-size: 0.8em; margin-bottom: 4px; }
.csb-sig-hint { font-size: 0.8em; color: #888; margin: 4px 0 0; }

/* Typed signature display (review modal) */
.csb-typed-signature-display {
    font-family: 'Dancing Script', 'Brush Script MT', 'Segoe Script', cursive !important;
    font-size: 2em;
    border-bottom: 1px solid #333;
    display: inline-block;
    padding: 0 20px 4px;
    min-width: 180px;
}
.csb-sig-typed-label, .csb-sig-date { font-size: 0.82em; color: #666; margin-top: 4px; }

/* Signature image (drawn, in review modal) */
.csb-sig-image-wrapper {
    border: 1px solid #ccc;
    display: inline-block;
    padding: 6px;
    border-radius: 4px;
    background: #fff;
}
.csb-sig-image-wrapper img { max-width: 360px; display: block; }

/* Form footer */
.csb-waiver-form-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}
.csb-waiver-error {
    background: #faeaea;
    border: 1px solid #e53935;
    color: #b71c1c;
    padding: 10px 14px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 0.9em;
}

/* Review modal (public) */
.csb-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 99999;
    overflow-y: auto;
}
.csb-modal-box {
    background: #fff;
    max-width: 760px;
    margin: 40px auto 60px;
    border-radius: 6px;
    padding: 28px 32px;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.28);
}
.csb-modal-close {
    position: absolute;
    top: 14px; right: 18px;
    background: none;
    border: none;
    font-size: 1.6em;
    cursor: pointer;
    color: #666;
    line-height: 1;
}
.csb-modal-close:hover { color: #000; }
.csb-review-meta { color: #666; font-size: 0.9em; margin-bottom: 18px; }
.csb-review-body {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 14px 18px;
    background: #fafafa;
    margin-bottom: 20px;
    font-size: 0.93em;
    line-height: 1.7;
}
.csb-review-questions h3,
.csb-review-emergency h3,
.csb-review-signature h3 {
    font-size: 1em;
    font-weight: 700;
    margin: 0 0 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}
.csb-review-question-item {
    padding: 10px 12px;
    border-left: 3px solid #ddd;
    margin-bottom: 8px;
}
.csb-review-question-item p { margin: 0 0 4px; font-size: 0.9em; }
.csb-yn-yes { color: #2a662a; }
.csb-yn-no  { color: #b71c1c; }
