/* ==========================================================================
   app.css — Custom Properties, Bootstrap 5 Overrides, Legacy Compatibility
   Loads AFTER bootstrap.min.css, BEFORE client CSS
   ========================================================================== */

/* ---------- Design Tokens ---------- */

:root {
    --bs-primary: #046bd2;
    --bs-primary-hover: #045cb4;
    --color-accent: #2e8b3c;
    --bs-danger: #DC2626;
    --color-text-heading: #1e293b;
    --color-text-body: #334155;
    --color-bg-page: #f0f2f5;
    --color-border: #D1D5DB;
    --color-link: #046bd2;
    --color-link-hover: #045cb4;
}

/* ---------- Base Styles ---------- */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-body);
    background-color: var(--color-bg-page);
    min-width: 320px;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-text-heading);
    font-weight: 600;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3, h4, h5, h6 { font-size: 1.25rem; }

a { color: var(--color-link); }
a:hover { color: var(--color-link-hover); }

img { max-width: 100%; }

/* ---------- Bootstrap 5 Primary Color Override ---------- */

.btn-primary {
    background-color: #046bd2;
    border-color: #046bd2;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #045cb4;
    border-color: #045cb4;
}
.btn-outline-primary {
    color: #046bd2;
    border-color: #046bd2;
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: #046bd2;
    border-color: #046bd2;
    color: #fff;
}
.btn-check:checked + .btn-outline-primary {
    background-color: #046bd2;
    border-color: #046bd2;
}

/* Accent button */
.btn-accent {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}
.btn-accent:hover {
    background-color: #256e30;
    border-color: #256e30;
    color: #fff;
}

/* ---------- Navbar ---------- */

.navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #046bd2;
}

/* Mobile: navbar-collapse overlays content instead of pushing it down */
@media (max-width: 991.98px) {
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        padding: 0.75rem 1rem;
        z-index: 1029;
    }
}

.navbar-brand img {
    height: 60px;
    width: auto;
}

.navbar .navbar-text {
    font-size: 1.1rem;
    color: var(--color-text-heading);
}

.navbar .nav-link {
    color: var(--color-text-body);
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}
.navbar .nav-link:hover {
    color: var(--color-link);
}
.navbar .nav-link .fa {
    margin-right: 0.25rem;
}

/* Topbar info items */
.topbar-label {
    font-size: 0.75rem;
    color: #6b7280;
}
.topbar-text {
    font-size: 1rem;
}

/* ---------- Main Content Area ---------- */

main.container-xl {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

/* ---------- Cards (replaces .panel / .centered-panel) ---------- */

.card {
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

/* Content panel */
.content-panel {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

/* Panel compatibility — old .panel and .centered-panel classes */
.panel,
.centered-panel {
    margin-bottom: 1rem;
    padding: 1rem;
    color: var(--color-text-body);
    background-color: #fff;
    border-radius: 0.5rem;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

.centered-panel {
    margin-left: auto;
    margin-right: auto;
    max-width: 768px;
}

.large-sized { max-width: 1024px; }
.giant-sized { max-width: 1280px; }

.phantom-panel {
    margin-bottom: 0;
    padding: 0;
    color: inherit;
    background-color: transparent;
    border: none;
    box-shadow: none;
}

.phantom-panel { max-width: 800px; }
.phantom-panel.large-sized { max-width: 1056px; }
.phantom-panel.giant-sized { max-width: 1312px; }

/* ---------- Forms (Bootstrap 5) ---------- */

.form-control, .form-select {
    font-size: 14px;
}

/* Ensure 16px on iOS to prevent zoom */
@media (max-width: 767.98px) {
    .form-control, .form-select, textarea.form-control {
        font-size: 16px;
    }
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text-heading);
    margin-bottom: 0.25rem;
}

.form-text {
    font-size: 0.8125rem;
    color: #6b7280;
    font-style: italic;
}

.invalid-feedback {
    font-size: 0.8125rem;
    font-style: italic;
}

.form-check-label {
    font-size: 0.875rem;
}

/* Focus states matching primary color */
.form-control:focus, .form-select:focus {
    border-color: #046bd2;
    box-shadow: 0 0 0 0.2rem rgba(4, 107, 210, 0.25);
}

/* Legacy form notes/errors compatibility */
.default-form-notes {
    margin: 0.25rem 0 0 0;
    color: #6b7280;
    line-height: 1.4;
    font-size: 0.8125rem;
    font-style: italic;
}

.default-form-postfix {
    color: #6b7280;
    font-size: 0.875rem;
}

/* ---------- Alerts (replaces custom messages) ---------- */

.alert {
    border-radius: 0.5rem;
    border: none;
    font-size: 0.9rem;
    line-height: 1.5;
}

.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-info {
    background-color: #eff6ff;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.rules-text-scroll {
    max-height: 120px;
    overflow-y: auto;
    padding-right: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.5;
}
.rules-text-scroll p:last-child {
    margin-bottom: 0;
}
@media (min-width: 768px) {
    .rules-text-scroll {
        max-height: 180px;
    }
}

/* ---------- Nav Tabs (replaces custom tabs) ---------- */

.nav-tabs {
    border-bottom-color: var(--color-border);
}

.nav-tabs .nav-link {
    color: var(--color-text-body);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem 0.375rem 0 0;
}

.nav-tabs .nav-link:hover {
    color: var(--color-link);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--color-link);
    font-weight: 600;
    background-color: #fff;
    border-color: var(--color-border) var(--color-border) #fff;
}

/* ---------- Tables ---------- */

.table {
    font-size: 0.8125rem;
    table-layout: auto;
    width: 100%;
}

.table th, .table td {
    padding: 0.35rem 0.4rem;
    white-space: nowrap;
}

.table th {
    font-weight: 600;
    color: var(--color-text-heading);
}

/* Sortable column headers */
th.sortable { cursor: pointer; position: relative; padding-right: 1.25rem; user-select: none; }
th.sortable:hover { background-color: #f8f9fa; }
th.sortable::after { content: '\2195'; position: absolute; right: 0.375rem; top: 50%; transform: translateY(-50%); font-size: 0.75rem; color: #9ca3af; }
th.sortable.sort-asc::after { content: '\2191'; color: var(--bs-primary); }
th.sortable.sort-desc::after { content: '\2193'; color: var(--bs-primary); }

/* Column filter row */
.filter-row td { padding: 0.25rem 0.375rem; background-color: #f8f9fa; overflow: visible; }
.col-filter { font-size: 0.75rem !important; padding: 0.15rem 0.3rem !important; }
select.col-filter { padding-right: 1.5rem !important; background-size: 10px; }
.col-filter:focus { border-color: var(--bs-primary); box-shadow: 0 0 0 0.15rem rgba(4, 107, 210, 0.2); }

/* Compact column styles — auto-sized via content, nowrap inherited from .table td */
.table .status-col { }
.table .nr-col { }
.table .member-col { }
.table .court-col { }
.table .price-col { text-align: right; }
.table .budget-col { text-align: right; }
.table .bulk-check-col { width: 36px; text-align: center; }
.table .payment-method-col { width: 5.5rem; }
.table .actions-col { }
.table .actions-col .symbolic { min-width: 44px; min-height: 44px; padding-top: 12px; padding-bottom: 12px; }
/* Flexible columns that can wrap/truncate to absorb remaining space */
.table .notes-col { white-space: normal; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.table .email-col { white-space: normal; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

/* Status icons (single-letter badges in booking table) */
.status-icon {
    display: inline-block;
    width: 1.5em; height: 1.5em;
    line-height: 1.5em;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 0.25rem;
    color: #fff;
}
.status-single { background-color: #94A3B8; }
.status-subscription { background-color: #046bd2; }
.status-cancelled { background-color: #DC2626; }

/* Legacy table compatibility */
.bordered-table tr td { padding: 0.5rem; border: 1px solid #dee2e6; }
.bordered-table tr th { padding: 0 0.5rem 0.5rem 0.5rem; }

.default-table td { padding-right: 1rem; padding-bottom: 1rem; vertical-align: top; }
.default-table td:last-child { padding-right: 0; }
.default-table tr:last-child > td { padding-bottom: 0; }

/* Auto-style form inputs in default-table (backend compat) */
.default-table input[type="text"],
.default-table input[type="password"],
.default-table input[type="email"],
.default-table select,
.default-table textarea {
    font-size: 14px;
    padding: 0.375rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}
.default-table input[type="text"]:focus,
.default-table input[type="password"]:focus,
.default-table input[type="email"]:focus,
.default-table select:focus,
.default-table textarea:focus {
    border-color: #046bd2;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(4, 107, 210, 0.25);
}

/* ---------- Buttons (Legacy Fallbacks) ---------- */

.default-button,
a.default-button:link,
a.default-button:visited {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: #fff;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid #046bd2;
    border-radius: 0.375rem;
    background-color: #046bd2;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
    opacity: 1;
}

.default-button:hover,
a.default-button:hover {
    color: #fff;
    background-color: #045cb4;
    border-color: #045cb4;
    opacity: 1;
}

.default-button:active,
a.default-button:active {
    position: static;
}

/* Button variants */
.default-button-danger,
a.default-button-danger:link,
a.default-button-danger:visited {
    background-color: #DC2626;
    border-color: #DC2626;
}
.default-button-danger:hover,
a.default-button-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.default-button-warning,
a.default-button-warning:link,
a.default-button-warning:visited {
    background-color: #ffda6a;
    border-color: #ffda6a;
    color: #664d03;
}
.default-button-warning:hover,
a.default-button-warning:hover {
    background-color: #ffcd39;
    border-color: #ffcd39;
    color: #664d03;
}

.default-button-outline,
a.default-button-outline:link,
a.default-button-outline:visited {
    background-color: transparent;
    color: var(--color-link);
    border-color: var(--color-border);
}
.default-button-outline:hover,
a.default-button-outline:hover {
    background-color: #f8f9fa;
    color: var(--color-link-hover);
}

.mini-button,
a.mini-button:link,
a.mini-button:visited {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

/* ---------- Footer ---------- */

footer {
    font-size: 0.8125rem;
}

footer a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
}
footer a:hover {
    color: #fff;
    text-decoration: none;
}

/* ---------- Utility Classes (Legacy Compat) ---------- */

.gray, .gray a:link, a.gray:link, .gray a:visited, a.gray:visited { color: #6b7280; }
.gray a:hover, a.gray:hover { color: var(--color-text-body); }

.light-gray { color: #9ca3af; }
.white, .white a:link, a.white:link, .white a:visited, a.white:visited { color: #fff; }
.unlined { text-decoration: none; }

.left-text { text-align: left; }
.centered-text { text-align: center; }
.right-text { text-align: right; }

.full-width { width: 100%; }
.no-wrap { white-space: nowrap; }

.tiny-text { font-size: 0.625rem; }
.small-text { font-size: 0.6875rem; }
.medium-text { font-size: 0.75rem; }
.large-text { font-size: 1.0625rem; }

.separator { margin: 1rem 0; height: 1px; clear: both; }
.separator-small { margin: 0.5rem 0; height: 1px; clear: both; }
.separator-line { background: #dee2e6; }

.padded { padding: 2rem; }

.sandbox {
    position: relative;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
}

/* Symbolic icons (legacy) */
.symbolic { display: inline-block; min-height: 16px; background-repeat: no-repeat; background-position: left center; }
p.symbolic { display: block; }

.symbolic-plus { padding-left: 20px; background-image: url(../imgs/icons/plus.png); }
.symbolic-plus-link { padding-left: 20px; background-image: url(../imgs/icons/plus-link.png); }
.symbolic-minus { padding-left: 20px; background-image: url(../imgs/icons/minus.png); }
.symbolic-email { padding-left: 24px; background-image: url(../imgs/icons/email.png); }
.symbolic-pw { padding-left: 16px; background-image: url(../imgs/icons/pw.png); }
.symbolic-phone { padding-left: 20px; background-image: url(../imgs/icons/phone.png); }
.symbolic-off { padding-left: 20px; background-image: url(../imgs/icons/off.png); }
.symbolic-cross { padding-left: 22px; background-image: url(../imgs/icons/cross.png); }
.symbolic-user { padding-left: 19px; background-image: url(../imgs/icons/user.png); }
.symbolic-booking { padding-left: 21px; background-image: url(../imgs/icons/booking.png); }
.symbolic-date { padding-left: 20px; background-image: url(../imgs/icons/calendar.png); }
.symbolic-warning { padding-left: 22px; background-image: url(../imgs/icons/warning.png); }
.symbolic-attachment { padding-left: 22px; background-image: url(../imgs/icons/attachment.png); }
.symbolic-config { padding-left: 21px; background-image: url(../imgs/icons/config.png); }
.symbolic-stats { padding-left: 18px; background-image: url(../imgs/icons/stats.png); }
.symbolic-tag { padding-left: 22px; background-image: url(../imgs/icons/tag.png); }
.symbolic-reload { padding-left: 22px; background-image: url(../imgs/icons/reload.png); }
.symbolic-info { padding-left: 22px; background-image: url(../imgs/icons/info.png); }
.symbolic-edit { padding-left: 20px; background-image: url(../imgs/icons/edit.png); }

.my-highlight { color: #10b981; }

.red { padding: 3px; color: #991b1b; background-color: #fef2f2; }
.yellow { padding: 3px; color: #92400e; background-color: #fffbeb; }
.blue { padding: 3px; color: #1e40af; background-color: #eff6ff; }
.green { padding: 3px; color: #065f46; background-color: #ecfdf5; }

/* ---------- Badge (legacy compat — avoid conflict with BS5 .badge) ---------- */

.legacy-badge {
    display: inline-block;
    padding: 0.75rem 1.125rem;
    vertical-align: middle;
    color: #fff;
    font-size: 1.75rem;
    line-height: 1.0;
    cursor: default;
    background-color: #046bd2;
    border-radius: 128px;
}

.legacy-badge-label {
    margin: 0 0.5rem;
    color: #046bd2;
    vertical-align: middle;
    font-size: 1rem;
    cursor: default;
}

/* ---------- Loading ---------- */

.loading {
    width: 100%; height: 100%;
    opacity: 0.1;
    background: url("../imgs/icons/jquery-ui/animated-overlay.gif");
    box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.5);
}

/* ---------- Arrows (legacy) ---------- */

a.symbolic-button { width: 16px; opacity: 1.0; }
a.symbolic-button:hover .arrow-left { border-color: transparent #333 transparent transparent; }
a.symbolic-button:hover .arrow-right { border-color: transparent transparent transparent #333; }

.arrow-left,
.arrow-right {
    position: absolute;
    left: 50%; top: 50%;
    margin: -8px 0 0 -8px;
    width: 0; height: 0;
    border-style: solid;
    border-width: 8px 16px 8px 0;
    border-color: transparent #6b7280 transparent transparent;
}

.arrow-right {
    border-width: 8px 0 8px 16px;
    border-color: transparent transparent transparent #6b7280;
}

/* ---------- Calendar Toolbar ---------- */

#calendar-toolbar {
    text-align: center;
}

@media screen and (min-width: 1280px) {
    #calendar-toolbar {
        display: flex;
        justify-content: space-between;
        text-align: left;
    }
}

#calendar-toolbar table td { padding-right: 8px; }
#calendar-toolbar table td:last-child { padding-right: 0; }

#calendar-toolbar-datepicker { float: left; }
#calendar-toolbar-userpanel { float: right; }
#calendar-toolbar-groupselector { display: inline-block; background-color: #96bd42; }

/* --- Userpanel Offline (Login + Register) --- */

.userpanel-offline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.userpanel-offline-register {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--color-text-body);
}

.userpanel-offline-login {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.userpanel-offline-login .input-group {
    width: 180px;
}

.userpanel-offline-login .input-group-text {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #6b7280;
    padding: 0.25rem 0.5rem;
}

/* --- Datepicker Navigation --- */

.datepicker-nav {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.datepicker-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #6b7280;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.datepicker-nav-btn:hover {
    background-color: #f0f7ff;
    color: var(--bs-primary);
}

.datepicker-nav-today {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--bs-primary);
    text-decoration: none;
    border-left: 1px solid #dee2e6;
    transition: background-color 0.15s;
}

.datepicker-nav-today:hover {
    background-color: #f0f7ff;
    color: var(--bs-primary);
}

.datepicker-nav-form {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 0.5rem 0 0.75rem;
    border-left: 1px solid #dee2e6;
    gap: 0.375rem;
}

.datepicker-nav-icon {
    color: #9ca3af;
    font-size: 0.8125rem;
}

.datepicker-nav-input {
    border: none;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-heading);
    width: 120px;
    padding: 0;
    cursor: pointer;
    outline: none;
}

.datepicker-nav-input:focus {
    color: var(--bs-primary);
}

/* Mobile: stack toolbar vertically */
@media screen and (max-width: 767px) {
    .userpanel-offline {
        flex-direction: column;
        gap: 0.5rem;
    }
    .userpanel-offline-register {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
    .userpanel-offline-login {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    .userpanel-offline-login .input-group {
        width: 100%;
    }
    .userpanel-offline-login .btn {
        width: 100%;
    }
}

#calendar { clear: both; overflow-x: auto; }

.calendar-table, .calendar-table table, .calendar-table td { text-align: center; }
.calendar-table > tbody > tr > td,
.calendar-table > tr > td { vertical-align: top; }
.calendar-table .calendar-date-col { padding-left: 3px; }

/* Calendar table reset.
   BS5 sets border-box and line-height:1.5 globally. We keep border-box (so
   percentage widths on square columns include padding/border and don't overflow
   on mobile) but reset line-height to 1 so that the time column and date grid
   rows have identical heights. Heights are adjusted for border-box
   (= old content-box height + 2×padding + border). */
.calendar-time-table, .calendar-date-table, .calendar-square-table {
    border-right: 1px solid #d1d5db;
    border-bottom: 1px solid #d1d5db;
    table-layout: fixed;
}

.calendar-time-table td, .calendar-date-table td, .calendar-square-table td {
    padding: 3px;
    border-top: 1px solid #d1d5db;
    border-left: 1px solid #d1d5db;
    font-size: 14px;
    line-height: 1;
}

.calendar-time-table td,
.calendar-square-table td { text-align: left; }

/* Heights include padding (3+3=6px) + border-top (1px) in border-box mode */
.calendar-date-row td { height: 49px; }  /* was 42 content + 7 = 49 */
.calendar-time-row td { height: 49px; }
.calendar-square-row td { height: 35px; } /* was 28 content + 7 = 35 */
.calendar-core-row td { height: 37px; }   /* was 30 content + 7 = 37 */

.cts-label { font-weight: bold; font-size: 14px; line-height: 1; margin: 0; }
.cte-label { color: #6b7280; font-size: 10px; line-height: 1; margin: 0; }
.day-label, .square-label { font-weight: bold; line-height: 1; margin: 0; }
.date-label { line-height: 1; margin: 0; }

.calendar-cell {
    display: block;
    font-size: 10px;
    line-height: 1.0;
    padding: 10px 0;
    overflow: hidden;
    text-decoration: none;
    border-radius: 0.25rem;
}

.cc-height-2 { padding: 3px 0 2px 0; }

.cc-label {
    display: block;
    height: 10px;
    overflow: visible;
}

.cc-over { cursor: default; color: #6b7280; background-color: #f8f9fa; }

/* Calendar cell colors */
a.cc-event:link,
a.cc-event:visited { opacity: 1.0; color: #fff; background: #DC2626 url(../imgs/icons/misc-event.png) no-repeat center center; }
a.cc-event:hover { background-color: #b91c1c; }

a.cc-free:link,
a.cc-free:visited { opacity: 1.0; color: var(--color-text-body); background-color: #F0F5FA; }
a.cc-free:hover { background-color: #DBEAFE; }

a.cc-free-partially { text-decoration: underline; }

a.cc-free-min:link,
a.cc-free-min:visited { opacity: 1.0; color: var(--color-text-body); background-color: #F0F5FA; }
a.cc-free-min:hover { background-color: #DBEAFE; }
a.cc-free-min-partially { text-decoration: underline; }

a.cc-free-max:link,
a.cc-free-max:visited { opacity: 1.0; color: var(--color-text-body); background-color: #F0F5FA; }
a.cc-free-max:hover { background-color: #DBEAFE; }
a.cc-free-max-partially { text-decoration: underline; }

a.cc-free-hidden:link,
a.cc-free-hidden:visited { opacity: 1.0; color: var(--color-text-body); background-color: #F0F5FA; display: none; }
a.cc-free-hidden:hover { background-color: #DBEAFE; display: none; }
a.cc-free-hidden-partially { text-decoration: underline; }

a.cc-own:link,
a.cc-own:visited { opacity: 1.0; color: #fff; background-color: var(--color-accent); }
a.cc-own:hover { background-color: #22b022; }

a.cc-single:link,
a.cc-single:visited { opacity: 1.0; color: #fff; background-color: #94A3B8; }
a.cc-single:hover { background-color: #64748b; }

a.cc-multiple:link,
a.cc-multiple:visited { opacity: 1.0; color: #fff; background-color: #046bd2; }
a.cc-multiple:hover { background-color: #045cb4; }

a.cc-conflict:link,
a.cc-conflict:visited { opacity: 1.0; color: #fff; background-color: #045cb4; }
a.cc-conflict:hover { background-color: #045cb4; }
a.cc-conflict { position: relative; z-index: 256; }

a.cc-try:link,
a.cc-try:visited { opacity: 1.0; color: #664d03; background-color: #ffda6a; }
a.cc-try:hover { background-color: #ffcd39; }

/* Squarebox */
/* BS5 .form-select is display:block — override so text-align:center can center it */
.centered-text .form-select { display: inline-block; width: auto; }

a.squarebox-primary-close-link,
a.squarebox-primary-close-link:hover {
    position: absolute;
    right: -4px; top: -4px;
    display: block;
    padding: 4px;
    opacity: 1;
    color: #6b7280;
    line-height: 1;
    font-size: 22px;
    text-decoration: none;
    background: #fff;
    border-radius: 0.25rem;
    box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.5);
}
a.squarebox-primary-close-link:hover {
    color: #fff;
    background: #DC2626;
}

/* Squarebox desktop — smooth re-centering on content change */
.squarebox-desktop { transition: top 0.3s ease, left 0.3s ease; }

/* Squarebox desktop — sticky close button (scrollable modal) */
.squarebox-desktop a.squarebox-primary-close-link { position: sticky; float: right; top: 0; right: 0; z-index: 10; }

/* Squarebox desktop — 2-column grid for the 4-section booking form */
.squarebox-desktop table.middle-table,
.squarebox-desktop table.middle-table > tbody {
    display: block;
    width: 100%;
}
.squarebox-desktop table.middle-table > tbody > tr:first-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.squarebox-desktop table.middle-table > tbody > tr:first-child > td {
    padding-right: 0;
    padding-bottom: 0;
}
.squarebox-desktop table.middle-table > tbody > tr:last-child {
    display: block;
}
.squarebox-desktop table.middle-table > tbody > tr:last-child > td[colspan] {
    display: block;
    width: 100%;
}

/* Squarebox mobile — fixed positioning, scrollable, stacked layout */
.squarebox-mobile { box-sizing: border-box; }
.squarebox-mobile a.squarebox-primary-close-link { position: sticky; float: right; top: 0; right: 0; z-index: 10; }

/* Stack outer table columns vertically on mobile (e.g. backend booking edit 4-col layout) */
.squarebox-mobile table.middle-table,
.squarebox-mobile table.middle-table > tbody,
.squarebox-mobile table.middle-table > tbody > tr,
.squarebox-mobile table.middle-table > tbody > tr > td {
    display: block;
    width: 100%;
}
.squarebox-mobile table.middle-table > tbody > tr > td {
    padding-right: 0;
    padding-bottom: 0.75rem;
}

/* Sandbox blocks full-width on mobile */
.squarebox-mobile .sandbox { margin-bottom: 0.5rem; }

/* Inner tables within sandbox: fit width, compact spacing */
.squarebox-mobile .sandbox table.default-table { width: 100%; }
.squarebox-mobile .sandbox table.default-table td { padding-right: 0.5rem; padding-bottom: 0.5rem; }

/* Half-tables and general table overflows */
.squarebox-mobile .half-table { width: 100% !important; border: none !important; }

/* Prevent horizontal overflow */
.squarebox-mobile input[type="text"],
.squarebox-mobile input[type="password"],
.squarebox-mobile select,
.squarebox-mobile textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* Typography: smaller, compact for mobile readability */
.squarebox-mobile { font-size: 13px; padding: 12px; text-align: center; }
/* Override BS5 display:block so text-align:center can center form elements */
.squarebox-mobile .form-control,
.squarebox-mobile .form-select { display: inline-block; width: auto; }
.squarebox-mobile textarea.form-control { display: block; width: 100%; }
.squarebox-mobile .form-label { display: block; }
.squarebox-mobile .p-3,
.squarebox-mobile .p-4 { padding: 0.5rem !important; }
.squarebox-mobile .padded { padding: 0.5rem; }
.squarebox-mobile .alert { text-align: left; }
.squarebox-mobile .sandbox p,
.squarebox-mobile .alert p { text-align: left; margin-bottom: 0.5rem; }
.squarebox-mobile .fs-5 { font-size: 1rem !important; }
.squarebox-mobile h1 { font-size: 1.25rem; }
.squarebox-mobile h2, .squarebox-mobile h3 { font-size: 1.1rem; }
.squarebox-mobile .alert { font-size: 12px; padding: 0.5rem 0.75rem; }
.squarebox-mobile .btn-lg { font-size: 0.9rem; padding: 0.5rem 1rem; }

/* Player name inputs within squarebox */
.sb-player-names .form-control { margin-bottom: 0.25rem; }
.squarebox-mobile .sb-player-names .form-control { width: 100% !important; display: block !important; }

/* Squarebox — visual hierarchy: rules/warnings less dominant */
.squarebox-desktop .alert-warning,
.squarebox-mobile .alert-warning {
    font-size: 0.8125rem;
    border-left: 3px solid #b45309;
    border-radius: 0;
    background-color: #fffbeb;
    padding: 0.75rem 1rem;
    text-align: left;
}
.squarebox-desktop .alert-warning strong,
.squarebox-desktop .alert-warning b,
.squarebox-mobile .alert-warning strong,
.squarebox-mobile .alert-warning b {
    font-weight: 600;
    color: #92400e;
}

/* Squarebox — booking summary card as primary element */
.squarebox-desktop .card.bg-light,
.squarebox-mobile .card.bg-light {
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Squarebox — sticky submit button at bottom on desktop */
.squarebox-desktop #confirmform > .text-center:last-child {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 0.75rem 0;
    border-top: 1px solid #e5e7eb;
    z-index: 5;
}

/* ---------- Admin Menu Popup ---------- */

.admin-menu .list-group-item { border-left: 0; border-right: 0; padding: 0.625rem 1rem; }
.admin-menu .list-group-item:first-child { border-top: 0; }
.admin-menu .list-group-item:last-child { border-bottom: 0; }
.admin-menu .list-group-item:hover { background-color: #f0f7ff; }
.admin-menu .fa { font-size: 1.1rem; width: 1.25rem; text-align: center; }

/* Alternate Calendar */
#calendar-choice-start .ui-datepicker { min-height: 240px; }
#calendar-choice-end .ui-datepicker { min-height: 240px; }
#calendar-choice-selection { position: relative; }

.cc-range-member a {
    color: #fff !important;
    border-color: #046bd2 !important;
    background: #046bd2 !important;
}

/* ---------- Edit form actions (button group) ---------- */

.edit-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.edit-actions .default-button {
    min-width: 140px;
}

/* Form fields fill sandbox width in edit forms */
.content-panel .sandbox input[type="text"],
.content-panel .sandbox select,
.content-panel .sandbox textarea {
    width: 100% !important;
    box-sizing: border-box;
}

/* ---------- Responsive breakpoints ---------- */

@media screen and (max-width: 1536px) {
    .responsive-pass-1 { display: none; }
}

@media screen and (max-width: 1280px) {
    .responsive-pass-2 { display: none; }
    .table { font-size: 0.75rem; }
    .table th, .table td { padding: 0.25rem 0.3rem; }
    #calendar-toolbar { text-align: center; }
    #calendar-toolbar-datepicker { display: inline-block; margin-left: 8px; margin-right: 8px; float: none; }
    #calendar-toolbar-userpanel { display: inline-block; margin-left: 8px; margin-right: 8px; float: none; }
}

@media screen and (max-width: 1024px) {
    .responsive-pass-3 { display: none; }
    .half-table { margin-bottom: 2rem; width: 100% !important; border: none !important; }
    .half-table:last-child { margin-bottom: 2rem; width: 100% !important; border: none !important; }
    .padded { padding: 0.5rem; }

    /* Edit actions: stack buttons vertically, full width */
    .edit-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .edit-actions .default-button,
    .edit-actions button,
    .edit-actions a.default-button {
        width: 100%;
        min-width: 0;
    }
}

@media screen and (max-width: 768px) {
    .responsive-pass-4 { display: none; }
    .table { font-size: 0.6875rem; }
    .table th, .table td { padding: 0.2rem 0.25rem; }
    .table .actions-col { font-size: 0.625rem; }
}

@media screen and (max-width: 512px) {
    .responsive-pass-5 { display: none; }

    /* Compact time column on small phones */
    .calendar-time-col { width: 50px !important; }
    .calendar-time-table { width: 50px !important; }
    .calendar-time-col .cts-label { font-size: 11px; }
    .calendar-time-col .cte-label { display: none; }
}

/* ---------- Cookie Consent ---------- */

#myCookieConsent {
    z-index: 999;
    min-height: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 10px 20px;
    background: rgba(0,0,0,0.6);
    overflow: hidden;
    position: fixed;
    color: #fff;
    bottom: 0;
    right: 10px;
    display: none;
    left: 0;
    text-align: center;
    font-size: 15px;
    font-weight: bold;
}
#myCookieConsent div { padding: 5px 0 0; }
#myCookieConsent a { color: #ffba55; display: inline-block; padding: 0 10px; }
#myCookieConsent a:hover { color: #fda016; }
#myCookieConsent a#cookieButton {
    display: inline-block;
    color: #000;
    font-size: 1.1em;
    background: #ffba55;
    text-decoration: none;
    cursor: pointer;
    padding: 2px 20px;
    float: right;
    border-radius: 20px;
}
#myCookieConsent a#cookieButton:hover { background: #fda016; color: #000; }

/* ---------- Print ---------- */

@media print {
    body { margin: 0; padding: 0; color: #333; background: #fff; }
    .no-print,
    .responsive-pass-1,
    .responsive-pass-2 { display: none; }
    .panel, .centered-panel, .card {
        position: static !important;
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }
    .half-table { margin-bottom: 2rem; width: 100% !important; border: none !important; }
    .half-table:last-child { margin-bottom: 2rem; width: 100% !important; border: none !important; }
    th.sortable { cursor: default; padding-right: 0.5rem; }
    th.sortable::after { display: none; }
    footer { margin: 0; border: none; }
}

/* ---------- Links Navigation (replaces old positioned layout) ---------- */

.links-nav {
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.links-nav .btn {
    font-size: 0.875rem;
}

/* Legacy links compat */
.links-back,
.links-forth { display: inline-block; margin: 0 3rem; line-height: 1.3; vertical-align: top; }
.links-forth ul { margin: 0.25rem 0 0 0.25rem; padding-left: 1rem; }

/* ---------- Half-table → columns (legacy compat) ---------- */

.half-table { width: 49%; }
.half-table:last-child { width: 50%; border-left: 1px solid #dee2e6; }

.middle-table td { vertical-align: middle; }

/* ---------- Payment Options ---------- */

.payment-options {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.75rem 0;
}

.payment_radio {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
    min-height: 44px;
}

.payment_radio:hover { border-color: #046bd2; }
.payment_radio input[type="radio"] { margin: 0; }
.payment_radio:has(input[type="radio"]:checked) {
    border-color: #046bd2;
    background-color: #eff6ff;
}
.payment_radio img { height: 24px; width: auto; }
.payment_radio .payment-label { font-size: 14px; font-weight: 600; color: #046bd2; }

/* Guest payment */
.guest-payment-instructions {
    font-size: 1rem;
    margin-top: 0.625rem;
    font-weight: bold;
    color: #DC2626;
}

.guest-player-badge {
    display: inline-block;
    margin-left: 0.3125rem;
    padding: 0.125rem 0.3125rem;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
    background-color: #DC2626;
    border-radius: 0.25rem;
}

.guest-payment-notice {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 1rem;
    margin-top: 0;
    background-color: #eff6ff;
    border: 2px solid #046bd2;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #046bd2;
    line-height: 1.5;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, margin-top 0.3s ease;
}
.guest-payment-notice.open {
    max-height: 200px;
    opacity: 1;
    padding: 0.75rem 1rem;
    margin-top: 0.625rem;
}

/* ---------- Billing Status Badges ---------- */

.billing-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
    white-space: nowrap;
}

.billing-paid { background-color: #ecfdf5; color: #065f46; }
.billing-pending { background-color: #fffbeb; color: #92400e; }
.billing-cancelled { background-color: #f3f4f6; color: #6b7280; }
.billing-uncollectable { background-color: #fef2f2; color: #991b1b; }
.billing-member { background-color: #eff6ff; color: #1e40af; }

/* ---------- Pricing Config Page ---------- */

#pricing-template { display: none; }

.pricing-rule .datepicker { width: 110px; }
.pricing-rule .timepicker { width: 65px; }
.pricing-rule .pricepicker { width: 80px; font-weight: bold; text-align: right; }
.pricing-rule .timeblockpicker { width: 50px; text-align: right; }
.pricing-grammar { margin: 0 4px; color: #777; cursor: default; font-size: 0.85rem; }

.pricing-rule input[type="text"],
.pricing-rule select,
#pricing-template input[type="text"],
#pricing-template select {
    font-size: 14px;
    padding: 0.25rem 0.375rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}
.pricing-rule input[type="text"]:focus,
.pricing-rule select:focus {
    border-color: #046bd2;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(4, 107, 210, 0.25);
}

.pricing-price-line + .pricing-price-line { padding-top: 0.5rem; border-top: 1px dashed #dee2e6; }

.pricing-price-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: flex-end;
}
.pricing-field-group { flex: 0 0 auto; }
.pricing-field-label {
    display: block;
    font-size: 0.675rem;
    color: #6c757d;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}
.pricing-field-delete {
    margin-left: auto;
    align-self: flex-end;
    padding-bottom: 2px;
}

.pricing-select-day { width: 130px; }
.pricing-select-gross { width: 80px; }
.pricing-select-rate { width: 68px; }
.pricing-select-sid { width: 140px; }
.pricing-select-member { width: 140px; }

.pricing-delete { color: #999 !important; text-decoration: none; cursor: pointer; font-size: 1rem; }
.pricing-delete:hover { color: #DC2626 !important; }
