/* ----------------------------------------------------------------
    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-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;
}