﻿/* ===========================================================
   Kn1feTV Schedule v2
   Foundation
=========================================================== */

/* ===========================================================
   Design System
=========================================================== */

:root {
    /* Backgrounds */

    --bg: #090909;
    --surface: #111111;
    --surface-hover: #171717;
    --surface-light: #1d1d1d;
    /* Borders */

    --border: #292929;
    --border-light: #3b3b3b;
    /* Text */

    --text: #ffffff;
    --text-secondary: #b5b5b5;
    --text-muted: #7b7b7b;
    /* Status */

    --success: #2ecc71;
    --warning: #f1c40f;
    --danger: #e53935;
    --accent: #ff3030;
    /* Calendar */

    --calendar-free: #2ecc71;
    --calendar-partial: #f1c40f;
    --calendar-busy: #e53935;
    /* Radius */

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    /* Shadow */

    --shadow-sm: 0 4px 12px rgba(0,0,0,.15);
    --shadow-md: 0 10px 25px rgba(0,0,0,.28);
    --shadow-lg: 0 18px 40px rgba(0,0,0,.40);
    /* Animation */

    --transition-fast: .15s ease;
    --transition: .25s ease;
    --transition-slow: .35s ease;
    /* Timeline */

    --slot-height: 32px;
    --time-column-width: 90px;
    /* Layout */

    --content-width: 1500px;
    /* Spacing */

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 56px;
}

/* ===========================================================
   Global Reset
=========================================================== */

.schedule-page *,
.schedule-page *::before,
.schedule-page *::after {
    box-sizing: border-box;
}

/* ===========================================================
   Schedule Page
=========================================================== */

.schedule-page {
    padding-top: 150px;
    padding-bottom: 80px;
    min-height: 100vh;
}

    /* ===========================================================
   Container
=========================================================== */

    .schedule-page .container {
        max-width: var(--content-width);
        margin-inline: auto;
    }

    /* ===========================================================
   Links
=========================================================== */

    .schedule-page a {
        color: inherit;
        text-decoration: none;
    }

    /* ===========================================================
   Images
=========================================================== */

    .schedule-page img {
        display: block;
        max-width: 100%;
    }

    /* ===========================================================
   Typography
=========================================================== */

    .schedule-page h1,
    .schedule-page h2,
    .schedule-page h3,
    .schedule-page h4 {
        margin: 0;
        color: var(--text);
        line-height: 1.15;
    }

    .schedule-page p {
        margin: 0;
        color: var(--text-secondary);
    }

    .schedule-page small {
        color: var(--text-muted);
    }

/* ===========================================================
   Utilities
=========================================================== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.w-100 {
    width: 100%;
}

/* ===========================================================
   Header
=========================================================== */

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

    .schedule-header h1 {
        font-size: clamp(2rem, 3vw, 2.8rem);
        font-weight: 800;
        letter-spacing: -.02em;
    }

.schedule-header__subtitle {
    margin-top: var(--space-2);
    color: var(--text-secondary);
    font-size: .95rem;
}

/* ===========================================================
   Header Meta
=========================================================== */

.schedule-header__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-4);
    color: var(--text-secondary);
    font-size: .9rem;
}

.schedule-header__separator {
    opacity: .35;
}

/* ===========================================================
   Day Status
=========================================================== */

.schedule-day-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}

.schedule-day-state--free {
    color: var(--success);
}

.schedule-day-state--partial {
    color: var(--warning);
}

.schedule-day-state--busy {
    color: var(--danger);
}

/* ===========================================================
   Busy Progress
=========================================================== */

.schedule-progress {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 26px;
    padding-inline: 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.05);
    color: var(--text);
    font-weight: 700;
    font-size: .85rem;
}

/* ===========================================================
   Actions
=========================================================== */

.schedule-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ===========================================================
   Reveal animation support
=========================================================== */

.reveal {
    animation: scheduleFade .35s ease;
}

@keyframes scheduleFade {

    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================================
   Month Calendar
=========================================================== */

.calendar {
    width: 100%;
    margin-top: var(--space-8);
}

/* ===========================================================
   Calendar Header
=========================================================== */

.calendar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-7);
}

    .calendar__header h1 {
        font-size: clamp(1.8rem, 3vw, 2.5rem);
        font-weight: 800;
    }

    .calendar__header a {
        width: 52px;
        height: 52px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        border: 1px solid var(--border);
        background: var(--surface);
        font-size: 24px;
        transition: var(--transition);
    }

        .calendar__header a:hover {
            background: var(--surface-hover);
            border-color: var(--border-light);
            transform: scale(1.05);
        }

/* ===========================================================
   Week Days
=========================================================== */

.calendar__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

    .calendar__weekdays div {
        padding: var(--space-4);
        text-align: center;
        font-weight: 700;
        color: var(--text-secondary);
        text-transform: uppercase;
        font-size: .8rem;
        letter-spacing: .08em;
    }

/* ===========================================================
   Calendar Grid
=========================================================== */

.calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-2);
}

/* ===========================================================
   Day
=========================================================== */

.calendar__day {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 110px;
    padding: 8px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}

    .calendar__day:hover {
        background: var(--surface-hover);
        border-color: var(--border-light);
        transform: translateY(-4px);
        box-shadow: var(--shadow-md);
    }

    /* ===========================================================
   Busy Gradient
=========================================================== */

    .calendar__day::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 5px;
        background: hsl( calc(120 - (var(--busy,0) * 1.2)), 85%, 52% );
    }

/* ===========================================================
   Other Month
=========================================================== */

.calendar__day--other {
    opacity: .35;
}

/* ===========================================================
   Today
=========================================================== */

.calendar__day--today {
    border-color: var(--accent);
    box-shadow: 0 0 22px rgba(255,48,48,.20);
}

.calendar__day--blocked {
    border-color: rgba(235, 35, 47, .65);
}

.calendar__blocked-label {
    position: relative;
    z-index: 1;
    color: #ff676e;
    font-size: .72rem;
    font-weight: 700;
}

.schedule-day-admin-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.schedule-day-admin-actions form {
    margin: 0;
}

.schedule-day-admin-actions .schedule-create-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.schedule-day-admin-actions .schedule-create-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===========================================================
   Day Number
=========================================================== */

.calendar__number {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: var(--space-3);
}

/* ===========================================================
   Busy States
=========================================================== */

.calendar__day--free {
    --busy: 0;
}

.calendar__day--partial {
    --busy: 50;
}

.calendar__day--busy {
    --busy: 100;
}

/* ===========================================================
   Event Card
=========================================================== */

.calendar-event {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: #fff;
    overflow: hidden;
    transition: var(--transition-fast);
    cursor: pointer;
}

    .calendar-event:hover {
        transform: translateX(2px);
        filter: brightness(1.08);
    }

/* ===========================================================
   Status Colors
=========================================================== */

.calendar-event--confirmed {
    background: linear-gradient( 135deg, #d32f2f, #8e0000 );
}

.calendar-event--tentative {
    background: linear-gradient( 135deg, #ffca28, #ff9800 );
    color: #111;
}

.calendar-event--busy {
    background: linear-gradient( 135deg, #2ecc71, #1b8f4f );
}

/* ===========================================================
   Teams
=========================================================== */

.timeline-team {
    display: flex;
    align-items: center;
    gap: 18px;
}
.timeline-team--left {
    justify-content: flex-end;
}
.timeline-team--right {
    justify-content: flex-start;
}

.calendar-event__team {
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .78rem;
    font-weight: 700;
}

.timeline-event__vs {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .45em;
    opacity: .45;
    text-align: center;
}

.timeline-team__logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,.45));
}

.timeline-team__name {
    font-size: 1.6rem;
    font-weight: 800;
    white-space: nowrap;
}

/* ===========================================================
   Footer
=========================================================== */

.timeline-event__footer {
    margin-top: auto;
    margin-bottom: 10px;
}

/* ===========================================================
   More Events
=========================================================== */

.calendar-platforms {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 18px;
}

.timeline-reservation {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px;
    border-radius: 16px;
    background: rgba(255, 180, 0, .06);
    border: 1px dashed rgba(255, 180, 0, .18);
    z-index: 1;
    overflow: hidden;
}

.calendar-platform {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #cf1f2e;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(207,31,46,.35);
    transition: .2s;
    cursor: pointer;
}
.calendar-platform-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: .72rem;
}

    .calendar-platform:hover {
        transform: scale(1.12);
    }

.calendar-platform img {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
}

.calendar-event-more {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,.05);
    color: var(--text-secondary);
    font-size: .72rem;
    font-weight: 700;
    transition: var(--transition-fast);
}

    .calendar-event-more:hover {
        background: rgba(255,255,255,.08);
        color: var(--text);
    }

/* ===========================================================
   Empty Day
=========================================================== */

.calendar-day-empty {
    flex: 1;
}

/* ===========================================================
   Day Hover Effect
=========================================================== */

.calendar__day:hover .calendar-event {
    transform: translateX(3px);
}

.calendar__day:hover .calendar-event-more {
    background: rgba(255,255,255,.10);
}

/* ===========================================================
   Schedule Events
=========================================================== */

.schedule-events {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.schedule-events__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .schedule-events__header h2 {
        font-size: 1.5rem;
        font-weight: 800;
    }

.schedule-events__count {
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface-light);
    color: var(--text);
    font-weight: 700;
}

/* ===========================================================
   Grid
=========================================================== */

.schedule-events__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px,1fr));
    gap: var(--space-5);
}

/* ===========================================================
   Card
=========================================================== */

.schedule-event-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

    .schedule-event-card:hover {
        transform: translateY(-4px);
        border-color: var(--border-light);
        box-shadow: var(--shadow-lg);
    }

/* ===========================================================
   Top
=========================================================== */

.schedule-event-card__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.schedule-event-card__time {
    font-size: 1rem;
    font-weight: 800;
}

.schedule-event-card__format {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    font-size: .75rem;
    font-weight: 700;
}

/* ===========================================================
   Teams
=========================================================== */

.schedule-event-card__teams {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-7);
}

.schedule-event-card__team {
    font-size: 1.2rem;
    font-weight: 800;
    text-align: center;
}

.schedule-event-card__vs {
    color: var(--text-muted);
    letter-spacing: .25em;
    font-size: .75rem;
    font-weight: 700;
}

/* ===========================================================
   Tournament
=========================================================== */

.schedule-event-card__tournament {
    padding: 0 var(--space-6) var(--space-5);
    text-align: center;
    color: var(--text-secondary);
}

/* ===========================================================
   Bottom
=========================================================== */

.schedule-event-card__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,.03);
}

.schedule-event-card__duration {
    color: var(--text-secondary);
}

.schedule-event-card__status {
    font-weight: 700;
}

/* ===========================================================
   Status
=========================================================== */

.schedule-event-card--confirmed {
    border-left: 5px solid var(--danger);
}

.schedule-event-card--tentative {
    border-left: 5px solid var(--warning);
}

.schedule-event-card--busy {
    border-left: 5px solid var(--success);
}

/* ===========================================================
   Timeline
=========================================================== */

.timeline-page-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 48px;
    min-height: 96px;
}

.schedule-back {
    position: absolute;
    left: 0;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #d8d8d8;
    font-size: 1rem;
    font-weight: 600;
    transition: .2s;
}

    .schedule-back:hover {
        color: #ffffff;
    }
.timeline-page-header h1 {
    margin: 0;
    text-align: center;
    font-size: clamp(3rem,5vw,5rem);
    font-weight: 900;
    line-height: 1;
}

.timeline-section {
    margin-top: var(--space-9);
}

.timeline-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

    .timeline-section__header h2 {
        font-size: 1.6rem;
        font-weight: 800;
    }

.timeline-section__legend {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

/* ===========================================================
   Timeline Layout
=========================================================== */

.timeline {
    display: grid;
    grid-template-columns: var(--time-column-width) 1fr;
    gap: var(--space-5);
    align-items: start;
}

/* ===========================================================
   Time Column
=========================================================== */

.timeline__time-column {
    display: grid;
    grid-template-rows: repeat(48, var(--slot-height));
}

.timeline-time {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding-right: var(--space-3);
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* ===========================================================
   Canvas
=========================================================== */

.timeline__canvas {
    overflow-x: auto;
    overflow-y: visible;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

/* ===========================================================
   Timeline Grid
=========================================================== */

.timeline-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(48, var(--slot-height));
    min-width: 900px;
}

/* ===========================================================
   Rows
=========================================================== */

.timeline-grid__row {
    grid-column: 1 / -1;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

    .timeline-grid__row:nth-child(2n) {
        background: rgba(255,255,255,.015);
    }

    .timeline-grid__row:last-child {
        border-bottom: none;
    }

    /* ===========================================================
   Hour Divider
=========================================================== */

    .timeline-grid__row:nth-child(odd) {
        border-bottom: 1px solid rgba(255,255,255,.09);
    }

/* ===========================================================
   Canvas Hover
=========================================================== */

.timeline__canvas:hover {
    border-color: var(--border-light);
}

/* ===========================================================
   Scrollbar
=========================================================== */

.timeline__canvas::-webkit-scrollbar {
    height: 10px;
}

.timeline__canvas::-webkit-scrollbar-track {
    background: var(--surface);
}

.timeline__canvas::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 999px;
}

    .timeline__canvas::-webkit-scrollbar-thumb:hover {
        background: #555;
    }

/* ===========================================================
   Timeline Buffer
=========================================================== */

.timeline-buffer {
    border-radius: 14px;
    background: rgba(255,180,0,.08);
    border: 1px dashed rgba(255,180,0,.22);
    margin: 4px;
    z-index: 1;
}

/* ===========================================================
   Timeline Event
=========================================================== */

.timeline-event {
    width: calc(100% - 18px);
    height: calc(100% - 18px);
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    position: relative;
    border-radius: 14px;
    color: #fff;
    background: #171717;
    box-shadow: 0 8px 24px rgba(0,0,0,.30);
    overflow: hidden;
    z-index: 2;
}

    .timeline-event > * {
        position: relative;
        z-index: 1;
    }

/* ===========================================================
   Status Colors
=========================================================== */

.timeline-event--confirmed {
    background: #321516;
}

.timeline-event--tentative {
    background: #2c2514;
}

.timeline-event--busy {
    background: #14271c;
}

/* ===========================================================
   Hover
=========================================================== */

.timeline-event:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
    box-shadow: var(--shadow-lg);
    z-index: 5;
}

/* ===========================================================
   Selected (будет использоваться позже)
=========================================================== */

.timeline-event.is-selected {
    outline: 3px solid rgba(255,255,255,.18);
}

/* ===========================================================
   Header
=========================================================== */

.timeline-event__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.timeline-event__time {
    font-size: .78rem;
    font-weight: 700;
    opacity: .9;
}

.timeline-event__format {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    font-size: .72rem;
    font-weight: 700;
}

/* ===========================================================
   Content
=========================================================== */

.timeline-event__body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-event__match {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 30px;
}

.timeline-event__team {
    font-size: 1.35rem;
    font-weight: 800;
    text-align: center;
    line-height: 1.15;
}

.timeline-event__vs {
    font-size: .75rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: .35em;
    opacity: .55;
}

/* ===========================================================
   Tournament
=========================================================== */

.timeline-event__footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.12);
    text-align: center;
    font-size: .85rem;
    color: #d8d8d8;
}

/* ===========================================================
   Small Events
=========================================================== */

.timeline-event[data-size="small"] {
    padding: var(--space-2);
}

    .timeline-event[data-size="small"] .timeline-event__team {
        font-size: .8rem;
    }

    .timeline-event[data-size="small"] .timeline-event__tournament {
        display: none;
    }

/* ===========================================================
   Very Small Events
=========================================================== */

.timeline-event[data-size="tiny"] {
    justify-content: center;
    align-items: center;
    padding: 4px;
}

    .timeline-event[data-size="tiny"] .timeline-event__header,
    .timeline-event[data-size="tiny"] .timeline-event__tournament {
        display: none;
    }

    .timeline-event[data-size="tiny"] .timeline-event__team {
        font-size: .72rem;
    }

    .timeline-event[data-size="tiny"] .timeline-event__vs {
        display: none;
    }

/* ===========================================================
   Timeline Legend
=========================================================== */

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: .85rem;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-color--buffer {
    background: rgba(255,193,7,.55);
    border: 1px solid rgba(255,193,7,.35);
}

.legend-color--event {
    background: var(--danger);
}

/* ===========================================================
   Empty States
=========================================================== */

.schedule-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: 80px 40px;
    text-align: center;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

    .schedule-empty h2 {
        font-size: 1.4rem;
    }

    .schedule-empty p {
        max-width: 480px;
        color: var(--text-secondary);
    }

/* ===========================================================
   Loading State
=========================================================== */

.schedule-loading {
    position: relative;
    overflow: hidden;
}

    .schedule-loading::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient( 90deg, transparent, rgba(255,255,255,.05), transparent );
        animation: shimmer 1.4s infinite;
    }

@keyframes shimmer {

    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(100%);
    }
}

/* ===========================================================
   Drag & Drop Preparation
=========================================================== */

.timeline-event.draggable {
    cursor: grab;
}

    .timeline-event.draggable:active {
        cursor: grabbing;
    }

.timeline-event.dragging {
    opacity: .55;
    transform: rotate(.5deg);
    box-shadow: var(--shadow-lg);
    z-index: 999;
}

.timeline-drop-target {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

/* ===========================================================
   Busy Indicator
=========================================================== */

.busy-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.busy-indicator__bar {
    width: 120px;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,.08);
}

.busy-indicator__fill {
    height: 100%;
    width: var(--busy-percent,0%);
    background: linear-gradient( 90deg, var(--success), var(--warning), var(--danger) );
    transition: width .3s ease;
}

/* ===========================================================
   Generic Badges
=========================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    font-size: .75rem;
    font-weight: 700;
}

.badge--success {
    color: var(--success);
}

.badge--warning {
    color: var(--warning);
}

.badge--danger {
    color: var(--danger);
}

/* ===========================================================
   Helpers
=========================================================== */

.flex {
    display: flex;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: var(--space-1);
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

.mt-auto {
    margin-top: auto;
}

.w-full {
    width: 100%;
}

/* ===========================================================
   Accessibility
=========================================================== */

.timeline-event:focus-visible,
.calendar-event:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===========================================================
   Large Desktop
=========================================================== */

@media (max-width: 1600px) {

    :root {
        --content-width: 1400px;
    }
}

/* ===========================================================
   Laptop
=========================================================== */

@media (max-width: 1366px) {

    :root {
        --slot-height: 30px;
    }

    .calendar__day {
        min-height: 150px;
    }

    .schedule-events__grid {
        grid-template-columns: repeat(auto-fit, minmax(300px,1fr));
    }

    .timeline-grid {
        min-width: 760px;
    }
}

/* ===========================================================
   Tablet
=========================================================== */

@media (max-width: 1024px) {

    .schedule-header {
        flex-direction: column;
        align-items: stretch;
    }

    .schedule-header__actions {
        width: 100%;
    }

        .schedule-header__actions .btn {
            width: 100%;
        }

    .calendar__day {
        min-height: 140px;
    }

    .calendar-event {
        font-size: .72rem;
    }

    .timeline {
        grid-template-columns: 70px 1fr;
    }

    .timeline-grid {
        min-width: 700px;
    }
}

/* ===========================================================
   Mobile
=========================================================== */

@media (max-width: 768px) {

    .calendar__weekdays {
        font-size: .72rem;
    }

    .calendar__grid {
        gap: 6px;
    }

    .calendar__day {
        min-height: 110px;
        padding: var(--space-2);
    }

    .calendar__number {
        font-size: .9rem;
    }

    .schedule-events__grid {
        grid-template-columns: 1fr;
    }

    .schedule-event-card__teams {
        padding: var(--space-5);
    }

    .schedule-event-card__team {
        font-size: 1rem;
    }

    .timeline {
        grid-template-columns: 60px 1fr;
        gap: var(--space-2);
    }

    .timeline-time {
        font-size: .72rem;
    }

    .timeline-grid {
        min-width: 620px;
    }
}

/* ===========================================================
   Small Mobile
=========================================================== */

@media (max-width: 480px) {

    .schedule-page {
        padding-top: 110px;
    }

    .calendar__header h1 {
        font-size: 1.5rem;
    }

    .calendar__header a {
        width: 42px;
        height: 42px;
    }

    .calendar__weekdays div {
        padding: 8px 0;
        font-size: .65rem;
    }

    .calendar__day {
        min-height: 92px;
    }

    .calendar-event {
        padding: 4px;
    }

    .calendar-event__team {
        font-size: .65rem;
    }

    .calendar-event__vs {
        display: none;
    }

    .timeline {
        grid-template-columns: 52px 1fr;
    }

    .timeline-grid {
        min-width: 560px;
    }

    .timeline-event {
        padding: var(--space-2);
    }

    .timeline-event__team {
        font-size: .8rem;
    }

    .timeline-event__tournament {
        display: none;
    }
}

/* ===========================================================
   Reduced Motion
=========================================================== */

@media (prefers-reduced-motion: reduce) {

    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* ===========================================================
   Theme
=========================================================== */

:root {
    color-scheme: dark;
}

/* ===========================================================
   Selection
=========================================================== */

::selection {
    background: rgba(255,48,48,.35);
    color: #fff;
}

/* ===========================================================
   Admin Mode
=========================================================== */

.timeline-event.is-editing {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(255,48,48,.12), var(--shadow-lg);
}

.timeline-event.is-disabled {
    opacity: .45;
    pointer-events: none;
}

.timeline-event.is-hidden {
    filter: grayscale(100%);
    opacity: .35;
}

/* ===========================================================
   Booking Preview
=========================================================== */

.timeline-booking-preview {
    position: absolute;
    inset-inline: 2px;
    border-radius: var(--radius-md);
    background: rgba(46,204,113,.18);
    border: 2px dashed var(--success);
    pointer-events: none;
    z-index: 10;
}

/* ===========================================================
   Resize Handles
=========================================================== */

.timeline-event__resize {
    position: absolute;
    left: 0;
    width: 100%;
    height: 8px;
    cursor: ns-resize;
}

.timeline-event__resize--top {
    top: -4px;
}

.timeline-event__resize--bottom {
    bottom: -4px;
}

/* ===========================================================
   Drop Marker
=========================================================== */

.timeline-drop-marker {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    z-index: 50;
    box-shadow: 0 0 10px rgba(255,48,48,.45);
}

/* ===========================================================
   Calendar Drag Hover
=========================================================== */

.calendar__day.is-drop-target {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 2px rgba(255,48,48,.15), var(--shadow-md);
}

/* ===========================================================
   Future Animation Helpers
=========================================================== */

.fade-in {
    animation: fadeIn .25s ease;
}

.scale-in {
    animation: scaleIn .22s ease;
}

.slide-up {
    animation: slideUp .25s ease;
}

@keyframes fadeIn {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {

    from {
        opacity: 0;
        transform: scale(.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {

    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================================
   Print
=========================================================== */

@media print {

    body {
        background: white;
        color: black;
    }

    .btn,
    .timeline-section__legend,
    .schedule-header__actions {
        display: none !important;
    }

    .timeline-event {
        box-shadow: none;
        border: 1px solid #888;
    }

    /* =========================================================
   MANUAL SCHEDULE EVENT
========================================================= */

    .schedule-create-page {
        width: 100%;
        min-height: calc(100vh - 80px);
        padding: 120px 20px 80px;
        background: #090909;
    }

    .schedule-create {
        width: 100%;
        max-width: 900px;
        margin: 0 auto;
    }

    /* HEADER */

    .schedule-create__header {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 32px;
        margin-bottom: 32px;
    }

    .schedule-create__heading {
        min-width: 0;
    }

    .schedule-create__eyebrow {
        margin-bottom: 10px;
        color: #ff3030;
        font-size: 11px;
        line-height: 1;
        font-weight: 800;
        letter-spacing: .16em;
    }

    .schedule-create__heading h1 {
        margin: 0;
        color: #fff;
        font-size: clamp(32px, 4vw, 46px);
        line-height: 1.05;
        font-weight: 800;
        letter-spacing: -.035em;
    }

    .schedule-create__heading p {
        margin: 12px 0 0;
        color: #8f8f8f;
        font-size: 14px;
        line-height: 1.5;
    }

    .schedule-create__back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 9px;
        flex-shrink: 0;
        min-height: 44px;
        padding: 0 18px;
        border: 1px solid #292929;
        border-radius: 10px;
        background: #111;
        color: #ddd;
        font-size: 13px;
        font-weight: 700;
        text-decoration: none;
        transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
    }

        .schedule-create__back:hover {
            background: #171717;
            border-color: #3a3a3a;
            color: #fff;
            transform: translateY(-1px);
        }

        .schedule-create__back span {
            color: #ff3030;
            font-size: 17px;
        }

    /* FORM */

    .schedule-create__form {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    /* VALIDATION */

    .schedule-create__validation {
        padding: 14px 16px;
        border: 1px solid rgba(255, 48, 48, .35);
        border-radius: 10px;
        background: rgba(255, 48, 48, .07);
        color: #ff7777;
        font-size: 13px;
    }

        .schedule-create__validation:empty {
            display: none;
        }

    .schedule-create__error {
        display: block;
        margin-top: 6px;
        color: #ff6868;
        font-size: 12px;
    }

    /* CARD */

    .schedule-create__card {
        padding: 26px;
        border: 1px solid #292929;
        border-radius: 14px;
        background: #111;
        box-shadow: 0 10px 35px rgba(0, 0, 0, .18);
    }

        .schedule-create__card[hidden] {
            display: none;
        }

    .schedule-create__card--small {
        padding: 20px 26px;
    }

    /* CARD HEADER */

    .schedule-create__card-header {
        display: flex;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 24px;
    }

    .schedule-create__step {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        flex-shrink: 0;
        border: 1px solid rgba(255, 48, 48, .28);
        border-radius: 9px;
        background: rgba(255, 48, 48, .08);
        color: #ff3030;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: .05em;
    }

    .schedule-create__card-header h2 {
        margin: 0;
        color: #fff;
        font-size: 18px;
        line-height: 1.25;
        font-weight: 750;
    }

    .schedule-create__card-header p {
        margin: 5px 0 0;
        color: #777;
        font-size: 12px;
        line-height: 1.4;
    }

    /* FIELDS */

    .schedule-create__field {
        margin-bottom: 18px;
    }

        .schedule-create__field:last-child {
            margin-bottom: 0;
        }

        .schedule-create__field > label {
            display: block;
            margin-bottom: 8px;
            color: #cfcfcf;
            font-size: 12px;
            line-height: 1.3;
            font-weight: 700;
        }

    /* GRID */

    .schedule-create__grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

        .schedule-create__grid + .schedule-create__field {
            margin-top: 2px;
        }

    /* INPUTS */

    .schedule-create__input {
        display: block;
        width: 100%;
        height: 46px;
        padding: 0 13px;
        box-sizing: border-box;
        border: 1px solid #303030;
        border-radius: 9px;
        outline: none;
        background: #0b0b0b;
        color: #f5f5f5;
        font-family: inherit;
        font-size: 13px;
        transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
    }

        .schedule-create__input:hover {
            border-color: #3b3b3b;
        }

        .schedule-create__input:focus {
            border-color: #ff3030;
            background: #0e0e0e;
            box-shadow: 0 0 0 3px rgba(255, 48, 48, .10);
        }

        .schedule-create__input::placeholder {
            color: #5f5f5f;
        }

    select.schedule-create__input {
        cursor: pointer;
    }

        select.schedule-create__input option {
            background: #111;
            color: #fff;
        }

    input[type="date"].schedule-create__input,
    input[type="time"].schedule-create__input {
        color-scheme: dark;
    }

    /* BUFFER */

    .schedule-create__buffer {
        display: flex;
        align-items: flex-end;
        min-height: 64px;
    }

    .schedule-create__checkbox {
        display: flex;
        align-items: center;
        gap: 11px;
        width: 100%;
        cursor: pointer;
    }

        .schedule-create__checkbox input {
            position: absolute;
            width: 1px;
            height: 1px;
            opacity: 0;
            pointer-events: none;
        }

    .schedule-create__checkbox-box {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        border: 1px solid #444;
        border-radius: 5px;
        background: #0b0b0b;
        transition: background .15s ease, border-color .15s ease;
    }

    .schedule-create__checkbox input:checked + .schedule-create__checkbox-box {
        border-color: #ff3030;
        background: #ff3030;
    }

        .schedule-create__checkbox input:checked + .schedule-create__checkbox-box::after {
            content: "✓";
            color: #fff;
            font-size: 12px;
            font-weight: 900;
        }

    .schedule-create__checkbox > span:last-child {
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .schedule-create__checkbox strong {
        color: #ddd;
        font-size: 13px;
        font-weight: 650;
    }

    .schedule-create__checkbox small {
        color: #666;
        font-size: 11px;
        line-height: 1.3;
    }

    /* ACTIONS */

    .schedule-create__actions {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        padding-top: 4px;
    }

    .schedule-create__button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 150px;
        height: 46px;
        padding: 0 22px;
        box-sizing: border-box;
        border-radius: 9px;
        font-family: inherit;
        font-size: 13px;
        font-weight: 750;
        text-decoration: none;
        cursor: pointer;
        transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .15s ease;
    }

    .schedule-create__button--secondary {
        border: 1px solid #292929;
        background: #111;
        color: #ccc;
    }

        .schedule-create__button--secondary:hover {
            border-color: #3d3d3d;
            background: #181818;
            color: #fff;
        }

    .schedule-create__button--primary {
        border: 1px solid #ff3030;
        background: #ff3030;
        color: #fff;
        box-shadow: 0 8px 25px rgba(255, 48, 48, .16);
    }

        .schedule-create__button--primary:hover {
            border-color: #ff4141;
            background: #ff4141;
            box-shadow: 0 10px 30px rgba(255, 48, 48, .25);
            transform: translateY(-1px);
        }

    .schedule-create__button:active {
        transform: translateY(1px);
    }

    /* RESPONSIVE */

    @media (max-width: 700px) {

        .schedule-create-page {
            padding: 105px 14px 50px;
        }

        .schedule-create__header {
            flex-direction: column;
            align-items: stretch;
            gap: 18px;
        }

        .schedule-create__heading h1 {
            font-size: 32px;
        }

        .schedule-create__back {
            width: 100%;
        }

        .schedule-create__card {
            padding: 20px;
        }

        .schedule-create__grid {
            grid-template-columns: 1fr;
            gap: 0;
        }

        .schedule-create__actions {
            flex-direction: column-reverse;
        }

        .schedule-create__button {
            width: 100%;
        }
    }

    @media (max-width: 420px) {

        .schedule-create-page {
            padding-inline: 10px;
        }

        .schedule-create__card {
            padding: 16px;
        }

        .schedule-create__card-header {
            gap: 11px;
        }

        .schedule-create__step {
            width: 34px;
            height: 34px;
        }
    }
/* ===========================================================
   Timeline Event Delete
=========================================================== */

.timeline-event__delete-form {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    margin: 0;
}

.timeline-event__delete {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    padding: 0;

    border: 1px solid rgba(255,255,255,.22);
    border-radius: 8px;

    background: rgba(0,0,0,.35);
    color: rgba(255,255,255,.82);

    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;

    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease,
        transform .15s ease;
}

.timeline-event__delete:hover {
    border-color: rgba(255,90,90,.7);
    background: rgba(180,0,0,.65);
    color: #fff;
    transform: scale(1.05);
}

.timeline-event__header {
    padding-right: 34px;
}

.timeline-event[data-size="tiny"] .timeline-event__delete {
    width: 24px;
    height: 24px;
    font-size: 17px;
}
