/*
    CrossCourt brand theme
    ----------------------
    Loaded AFTER assets/css/style.bundle.css so these tokens win.

    Keep brand overrides in this file, never in style.bundle.css - that file is
    vendor output and gets replaced wholesale on a Metronic upgrade.

    Brand palette (CrossCourt_colour_chart.pdf):
        Sunset Yellow  #FFB400
        Black          #000000
        Grey           #BDBDBD
        White          #FFFFFF
*/

:root,
[data-bs-theme="light"] {
    /* --- Raw brand colours --- */
    --cc-yellow: #FFB400;
    --cc-black: #000000;
    --cc-grey: #BDBDBD;
    --cc-white: #FFFFFF;

    /* --- Metronic primary ramp, derived from Sunset Yellow --- */
    --bs-primary: #FFB400;
    --bs-primary-rgb: 255, 180, 0;

    /* Hover / pressed state: a deeper yellow, NOT grey. */
    --bs-primary-active: #E09E00;

    /* Subtle tint used by .btn-light-primary, .bg-light-primary, badges. */
    --bs-primary-light: #FFF6E0;

    /*
        Text/icon colour placed ON TOP of --bs-primary.
        White on #FFB400 is 1.8:1 and fails WCAG AA outright.
        Black is 11.7:1 and matches the brand's black anyway.
    */
    --bs-primary-inverse: #000000;

    /* Focus rings and soft shadows. */
    --bs-primary-clarity: rgba(255, 180, 0, .2);

    /* --- Layout --- */
    --cc-header-height: 70px;
    --cc-sidebar-width: 280px;
    --cc-sidebar-width-rail: 76px;

    /* Neutral canvas behind cards. */
    --cc-body-bg: #F9F9F9;
}

/*
    Dark theme. Metronic ships a full dark palette behind [data-bs-theme="dark"];
    these are the brand overrides that sit on top of it.
*/
[data-bs-theme="dark"] {
    --bs-primary: #FFB400;
    --bs-primary-rgb: 255, 180, 0;
    --bs-primary-active: #FFC633;
    --bs-primary-light: #2B2519;
    --bs-primary-inverse: #000000;
    --bs-primary-clarity: rgba(255, 180, 0, .2);

    --cc-body-bg: #15171C;
}

    /* Yellow on a dark surface clears AA, so links keep the brand colour. */
    [data-bs-theme="dark"] .text-primary,
    [data-bs-theme="dark"] .link-primary,
    [data-bs-theme="dark"] a.text-primary {
        color: var(--bs-primary) !important;
    }

/* Show the icon for the theme you would switch TO. */
.cc-theme-icon-dark {
    display: none;
}

[data-bs-theme="dark"] .cc-theme-icon-light {
    display: none;
}

[data-bs-theme="dark"] .cc-theme-icon-dark {
    display: inline-block;
}

/* ==========================================================================
   Page toolbar
   ========================================================================== */

.cc-toolbar {
    padding: 1.5rem 1.75rem 1.25rem;
}

.cc-content {
    padding: 0 1.75rem 1.75rem;
}

.cc-page-title {
    margin: 0 0 .25rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--bs-gray-900);
}

.cc-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: .85rem;
    color: var(--bs-gray-600);
}

    .cc-breadcrumb li {
        display: flex;
        align-items: center;
        gap: .5rem;
    }

        /* Separator dot between crumbs. */
        .cc-breadcrumb li + li::before {
            content: "";
            width: 4px;
            height: 4px;
            border-radius: 50%;
            background-color: var(--bs-gray-400);
        }

        .cc-breadcrumb a {
            color: var(--bs-gray-600);
            text-decoration: none;
        }

            .cc-breadcrumb a:hover {
                color: var(--bs-gray-900);
            }

@media (max-width: 575.98px) {
    .cc-toolbar {
        padding: 1.25rem 1rem 1rem;
    }

    .cc-content {
        padding: 0 1rem 1.25rem;
    }
}

/* ==========================================================================
   Error screens
   ========================================================================== */

.cc-error-code {
    font-size: clamp(4rem, 14vw, 7rem);
    font-weight: 800;
    line-height: 1;
    color: var(--bs-primary);
    letter-spacing: -.03em;
}

/* ==========================================================================
   Court cards
   ========================================================================== */

.cc-court-card {
    transition: box-shadow .15s ease-in-out, transform .15s ease-in-out;
}

    .cc-court-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .08);
    }

/* Live indicator. Currently a placeholder - always shown as live. */
.cc-live {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .2rem .55rem;
    border-radius: 1rem;
    background-color: var(--bs-success-light);
    color: var(--bs-success);
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

/* Tone variants, e.g. .cc-live.cc-live--warning for a stale service. */
.cc-live--success {
    background-color: var(--bs-success-light);
    color: var(--bs-success);
}

    .cc-live--success .cc-live-dot {
        background-color: var(--bs-success);
    }

.cc-live--warning {
    background-color: var(--bs-warning-light);
    color: var(--bs-warning);
}

    .cc-live--warning .cc-live-dot {
        background-color: var(--bs-warning);
    }

.cc-live--danger {
    background-color: var(--bs-danger-light);
    color: var(--bs-danger);
}

    .cc-live--danger .cc-live-dot {
        background-color: var(--bs-danger);
    }

.cc-live--secondary {
    background-color: var(--bs-gray-200);
    color: var(--bs-gray-700);
}

    .cc-live--secondary .cc-live-dot {
        background-color: var(--bs-gray-500);
        animation: none;
    }

.cc-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--bs-success);
    animation: cc-pulse 1.8s ease-in-out infinite;
}

@keyframes cc-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(23, 198, 83, .5);
    }

    50% {
        opacity: .65;
        box-shadow: 0 0 0 5px rgba(23, 198, 83, 0);
    }
}

/* Respect users who have asked for less motion. */
@media (prefers-reduced-motion: reduce) {
    .cc-live-dot {
        animation: none;
    }

    .cc-court-card:hover {
        transform: none;
    }
}

.cc-court-status {
    min-height: 1.25rem;
}

/* Keep camera panes at 16:9 so the modal doesn't jump as streams connect. */
.cc-stream-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    border-radius: .475rem;
    overflow: hidden;
    background-color: #000;
}

    .cc-stream-frame iframe {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
        display: block;
    }

/* Covers the frame until a stream is confirmed live. */
.cc-stream-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, .75);
    color: var(--bs-gray-300);
    font-size: .9rem;
    text-align: center;
    padding: 1rem;
}

/* ==========================================================================
   Tables
   ========================================================================== */

/* Let wide tables scroll instead of blowing out the page on small screens. */
.cc-table-wrap {
    overflow-x: auto;
}

/* ---------- DataTables layout ----------

   The Metronic build replaces DataTables 2's layout renderer with its own
   Bootstrap one, so .dt-layout-row / .dt-layout-cell / .dt-length are never
   emitted - styling them does nothing. These rules target the markup it
   actually produces. Buttons and page length are relocated into
   .cc-table-toolbar by buildToolbar() in table-page.js.
*/

.cc-table-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1rem;
}

    .cc-table-toolbar:empty {
        display: none;
    }

    /* "25 per page" reads as one unit and sizes to its content. */
    .cc-table-toolbar .cc-table-length {
        display: flex;
        align-items: center;
        gap: .5rem;
        white-space: nowrap;
        color: var(--bs-gray-600);
        font-size: .875rem;
    }

        .cc-table-toolbar .cc-table-length select {
            width: auto;
            min-width: 4.5rem;
        }

        .cc-table-toolbar .cc-table-length label {
            margin: 0;
        }

    .cc-table-toolbar .dt-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: .5rem;
        margin: 0;
    }

/* Footer row: record count left, paging right, both on the table's edges. */
div.dt-container div.dt-info {
    margin-left: 0;
    padding-top: 0;
    color: var(--bs-gray-600);
    font-size: .875rem;
}

div.dt-container div.dt-paging {
    padding: 0;
}

    div.dt-container div.dt-paging ul.pagination {
        margin: 0;
    }

@media (max-width: 767.98px) {
    .cc-table-toolbar .cc-table-length {
        margin-left: 0 !important;
    }
}

/* ---------- Video thumbnails ---------- */

.cc-thumb {
    position: relative;
    display: block;
    width: 120px;
    aspect-ratio: 16 / 9;
    padding: 0;
    border: 0;
    border-radius: .475rem;
    overflow: hidden;
    background-color: var(--bs-gray-200);
    cursor: pointer;
}

    .cc-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    /* Play badge, revealed on hover. */
    .cc-thumb .cc-thumb-play {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(0, 0, 0, .35);
        color: #fff;
        font-size: 1.5rem;
        opacity: 0;
        transition: opacity .15s ease-in-out;
    }

    .cc-thumb:hover .cc-thumb-play,
    .cc-thumb:focus-visible .cc-thumb-play {
        opacity: 1;
    }

    .cc-thumb:focus-visible {
        outline: 2px solid var(--bs-primary);
        outline-offset: 2px;
    }

/* Placeholder when a clip has no thumbnail. */
.cc-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-gray-500);
    font-size: 1.35rem;
    cursor: default;
}

@media (max-width: 767.98px) {
    .cc-thumb {
        width: 88px;
    }
}

/* Skeleton placeholder rows shown while a page loads. */
.cc-skeleton {
    display: block;
    height: .85rem;
    width: 100%;
    border-radius: .35rem;
    background: linear-gradient(90deg,
                var(--bs-gray-200) 25%,
                var(--bs-gray-100) 37%,
                var(--bs-gray-200) 63%);
    background-size: 400% 100%;
    animation: cc-shimmer 1.4s ease infinite;
}

@keyframes cc-shimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cc-skeleton {
        animation: none;
    }
}

/* Empty / error state shown inside the table body. */
.cc-empty {
    padding: 2.5rem 1rem;
    text-align: center;
}

    .cc-empty i {
        display: block;
        margin-bottom: .75rem;
        font-size: 2.5rem;
        color: var(--bs-gray-400);
    }

    .cc-empty .cc-empty-title {
        font-weight: 600;
        color: var(--bs-gray-800);
    }

    .cc-empty .cc-empty-text {
        margin-top: .25rem;
        font-size: .9rem;
        color: var(--bs-gray-600);
    }

/*
    Metronic renders .btn-primary text via --bs-primary-inverse, which is now
    black. Links, however, use --bs-primary directly on a white background,
    where #FFB400 is only 1.9:1. Darken link text while leaving the yellow for
    fills and accents.
*/
.text-primary,
.link-primary,
a.text-primary {
    color: #8A6100 !important;
}

    .link-primary:hover,
    a.text-primary:hover {
        color: #6B4B00 !important;
    }
