/* ============================================================
   Race Calendar — Main Container
   ============================================================ */

.xio-race-calendar {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    font-family: inherit;
}

/* ============================================================
   Header / Hero
   ============================================================ */

.xio-race-calendar__header {
    position: relative;
    background: transparent;
    padding: 40px 40px 36px;
}

.xio-race-calendar__header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.xio-race-calendar__title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-weight: 700;
    font-size: 42px;
    line-height: 1.15;
    color: #1a1a2e;
    margin: 0;
    padding: 0;
}

/* ============================================================
   Month Navigation
   ============================================================ */

.xio-race-calendar__nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.xio-race-calendar__nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #1a1a2e;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.25s ease, transform 0.2s ease;
    padding: 0;
}

.xio-race-calendar__nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.xio-race-calendar__nav-btn:active {
    transform: scale(0.95);
}

.xio-race-calendar__nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.xio-race-calendar__nav-btn svg {
    display: block;
}

.xio-race-calendar__nav-label {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #1a1a2e;
    text-transform: uppercase;
    min-width: 200px;
    text-align: center;
    user-select: none;
}

/* ============================================================
   Table Header
   ============================================================ */

.xio-race-calendar__table-header {
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, #EAA383 0%, #836890 100%);
    padding: 42px 24px;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.xio-race-calendar__table-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--xio-rc-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.12;
    pointer-events: none;
}

.xio-race-calendar__th {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #fff;
}

.xio-race-calendar__th--icon {
    width: 40px;
    flex-shrink: 0;
}

.xio-race-calendar__th--name {
    flex: 1;
    min-width: 0;
}

.xio-race-calendar__th--country {
    width: 120px;
    flex-shrink: 0;
}

.xio-race-calendar__th--date {
    width: 120px;
    flex-shrink: 0;
}

.xio-race-calendar__th--web {
    width: 60px;
    flex-shrink: 0;
    text-align: center;
}

/* ============================================================
   Body / Rows Container
   ============================================================ */

.xio-race-calendar__body {
    background: #fff;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.xio-race-calendar__rows {
    transition: opacity 0.35s ease;
}

.xio-race-calendar__rows--loading {
    opacity: 0.35;
    pointer-events: none;
}

/* ============================================================
   Row
   ============================================================ */

.xio-race-calendar__row {
    border-bottom: 1px solid #f0eded;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    position: relative;
}

.xio-race-calendar__row--visible {
    opacity: 1;
    transform: translateY(0);
}

.xio-race-calendar__row:last-child {
    border-bottom: none;
}

.xio-race-calendar__row-main {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    gap: 12px;
    cursor: default;
    position: relative;
    transition: background-color 0.35s ease,
                padding-left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s ease;
}

.xio-race-calendar__row-main::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(180deg, #EAA383, #836890);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.xio-race-calendar__row--expandable .xio-race-calendar__row-main {
    cursor: pointer;
    outline: none;
}

.xio-race-calendar__row--expandable .xio-race-calendar__row-main:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(212, 123, 79, 0.4);
}

.xio-race-calendar__row-main:hover {
    background-color: rgba(234, 163, 131, 0.03);
    padding-left: 32px;
    box-shadow: inset 0 0 20px rgba(234, 163, 131, 0.04);
}

.xio-race-calendar__row-main:hover::before {
    width: 4px;
}

.xio-race-calendar__row-main:hover .xio-race-calendar__icon-chevron {
    color: #D47B4F;
    transform: translateX(3px);
}

.xio-race-calendar__row-main:hover .xio-race-calendar__cell--name {
    color: #1a1a1a;
}

.xio-race-calendar__row-main:hover .xio-race-calendar__race-link {
    color: #D47B4F;
}

.xio-race-calendar__row-main:hover .xio-race-calendar__cell--country {
    background: #ede4df;
    border-color: #ddd0c9;
    color: #7a5a46;
}

.xio-race-calendar__row-main:hover .xio-race-calendar__cell--date {
    color: #b5623a;
    letter-spacing: 0.6px;
}

.xio-race-calendar__row--expanded .xio-race-calendar__row-main {
    background-color: rgba(234, 163, 131, 0.04);
    padding-left: 32px;
}

.xio-race-calendar__row--expanded .xio-race-calendar__row-main::before {
    width: 4px;
}

/* ============================================================
   Toggle Icon
   ============================================================ */

.xio-race-calendar__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    padding: 0;
}

.xio-race-calendar__toggle--static {
    visibility: hidden;
}

.xio-race-calendar__icon-chevron {
    color: #b0b0b0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s ease;
}

.xio-race-calendar__row--expanded .xio-race-calendar__icon-chevron {
    transform: rotate(90deg) !important;
    color: #D47B4F;
}

/* ============================================================
   Cells
   ============================================================ */

.xio-race-calendar__cell {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.xio-race-calendar__cell--name {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    transition: color 0.3s ease;
}

.xio-race-calendar__cell--country {
    width: 120px;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    background: #f4f2f2;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid #e8e4e4;
    text-align: center;
    line-height: 1.3;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.xio-race-calendar__cell--date {
    width: 120px;
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 700;
    color: #D47B4F;
    letter-spacing: 0.3px;
    transition: color 0.3s ease, letter-spacing 0.35s ease;
}

.xio-race-calendar__cell--web {
    width: 60px;
    flex-shrink: 0;
    text-align: center;
}

/* ============================================================
   Race Link
   ============================================================ */

.xio-race-calendar__race-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.25s ease;
    display: inline-block;
}

.xio-race-calendar__race-link:hover {
    color: #D47B4F;
}

.xio-race-calendar__row--expanded .xio-race-calendar__race-link {
    color: #D47B4F;
    font-weight: 600;
}

/* ============================================================
   Web / Globe Link
   ============================================================ */

.xio-race-calendar__web-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #D47B4F;
    transition: color 0.25s ease, transform 0.25s ease;
}

.xio-race-calendar__web-link:hover {
    color: #b5623a;
    transform: scale(1.15);
}

.xio-race-calendar__globe-icon {
    display: block;
    transition: color 0.3s ease;
}

/* ============================================================
   Stages Panel (Accordion)
   ============================================================ */

.xio-race-calendar__stages {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s ease;
}

.xio-race-calendar__row--expanded .xio-race-calendar__stages {
    opacity: 1;
}

.xio-race-calendar__stages-inner {
    padding: 0 24px 20px 84px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.xio-race-calendar__stage {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}

.xio-race-calendar__row--expanded .xio-race-calendar__stage {
    opacity: 1;
    transform: translateX(0);
}

.xio-race-calendar__stage:hover {
    background-color: rgba(234, 163, 131, 0.06);
}

.xio-race-calendar__stage-bullet {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #D47B4F;
    flex-shrink: 0;
    opacity: 0.7;
}

.xio-race-calendar__stage-name {
    flex: 1;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.xio-race-calendar__stage-date {
    font-size: 13px;
    color: #888;
    flex-shrink: 0;
}

/* ============================================================
   Empty State
   ============================================================ */

.xio-race-calendar__empty {
    padding: 60px 24px;
    text-align: center;
}

.xio-race-calendar__empty p {
    font-size: 15px;
    color: #999;
    margin: 0;
}

/* ============================================================
   Loading Skeleton
   ============================================================ */

.xio-race-calendar__skeleton {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    gap: 12px;
    border-bottom: 1px solid #f0eded;
}

.xio-race-calendar__skeleton-bar {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: xio-rc-shimmer 1.5s ease-in-out infinite;
}

.xio-race-calendar__skeleton-bar--icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.xio-race-calendar__skeleton-bar--name {
    flex: 1;
}

.xio-race-calendar__skeleton-bar--country {
    width: 80px;
}

.xio-race-calendar__skeleton-bar--date {
    width: 90px;
}

.xio-race-calendar__skeleton-bar--web {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

@keyframes xio-rc-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   Responsive — Tablet (max-width: 900px)
   ============================================================ */

@media (max-width: 900px) {
    .xio-race-calendar__header {
        padding: 28px 24px;
    }

    .xio-race-calendar__title {
        font-size: 32px;
    }

    .xio-race-calendar__nav-label {
        font-size: 16px;
        min-width: 160px;
    }

    .xio-race-calendar__th--icon {
        display: none;
    }

    .xio-race-calendar__th--country,
    .xio-race-calendar__cell--country {
        width: 90px;
    }

    .xio-race-calendar__th--date,
    .xio-race-calendar__cell--date {
        width: 90px;
    }

    .xio-race-calendar__th--web,
    .xio-race-calendar__cell--web {
        width: 50px;
    }

    .xio-race-calendar__toggle {
        width: 32px;
        height: 32px;
    }

    .xio-race-calendar__row-main {
        padding: 16px 20px;
        gap: 10px;
    }

    .xio-race-calendar__stages-inner {
        padding-left: 52px;
    }
}

/* ============================================================
   Responsive — Mobile (max-width: 640px)
   ============================================================ */

@media (max-width: 640px) {

    .xio-race-calendar__header {
        padding: 20px 16px 16px;
    }

    .xio-race-calendar__header-content {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .xio-race-calendar__title {
        font-size: 26px;
        text-align: center;
    }

    .xio-race-calendar__nav {
        gap: 10px;
    }

    .xio-race-calendar__nav-label {
        font-size: 13px;
        min-width: 140px;
        letter-spacing: 1.5px;
    }

    .xio-race-calendar__nav-btn {
        width: 32px;
        height: 32px;
    }

    .xio-race-calendar__nav-btn svg {
        width: 10px;
        height: 16px;
    }

    /* --- Gradient strip --- */

    .xio-race-calendar__table-header {
        padding: 18px 0;
        border-radius: 10px 10px 0 0;
    }

    .xio-race-calendar__th {
        display: none;
    }

    /* --- Body: transparent to show card gaps --- */

    .xio-race-calendar__body {
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }

    .xio-race-calendar__rows {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 10px 0 0;
    }

    /* --- Row: elevated card --- */

    .xio-race-calendar__row {
        border-bottom: none;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
        border-left: 3px solid #D47B4F;
        overflow: hidden;
    }

    .xio-race-calendar__row:last-child {
        border-bottom: none;
    }

    /* --- Row main: 2-row grid --- */

    .xio-race-calendar__row-main {
        display: grid;
        grid-template-columns: 1fr auto auto;
        grid-template-rows: auto auto;
        align-items: center;
        padding: 14px 14px 14px 16px;
        gap: 6px 10px;
    }

    /* --- Name: col 1, row 1 --- */

    .xio-race-calendar__cell--name {
        grid-column: 1;
        grid-row: 1;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.3;
        padding-right: 0;
    }

    /* --- Web: col 2, row 1 --- */

    .xio-race-calendar__cell--web {
        grid-column: 2;
        grid-row: 1;
        width: auto;
        align-self: center;
    }

    .xio-race-calendar__globe-icon {
        width: 16px;
        height: 16px;
    }

    /* --- Toggle: col 3, row 1-2 --- */

    .xio-race-calendar__toggle {
        grid-column: 3;
        grid-row: 1 / 3;
        width: 26px;
        height: 26px;
        align-self: center;
    }

    .xio-race-calendar__toggle--static {
        display: none;
    }

    .xio-race-calendar__icon-chevron {
        width: 12px;
        height: 12px;
        color: #ccc;
    }

    /* --- Country + Date: col 1-2, row 2, inline --- */

    .xio-race-calendar__cell--country {
        grid-column: 1;
        grid-row: 2;
        width: fit-content;
        font-size: 10px;
        font-weight: 600;
        color: #888;
        background: #f5f3f3;
        padding: 2px 10px;
        border-radius: 10px;
        border: 1px solid #ece8e8;
        margin-top: 0;
        text-align: center;
        line-height: 1.4;
    }

    .xio-race-calendar__cell--country::after {
        display: none;
    }

    .xio-race-calendar__cell--date {
        display: block;
        grid-column: 2;
        grid-row: 2;
        width: auto;
        font-size: 13px;
        font-weight: 700;
        color: #D47B4F;
        letter-spacing: 0.2px;
        text-align: right;
    }

    /* --- Stages --- */

    .xio-race-calendar__stages-inner {
        padding: 0 14px 12px 16px;
    }

    .xio-race-calendar__stage {
        padding: 9px 12px;
        gap: 10px;
        background: rgba(212, 123, 79, 0.04);
        border-radius: 8px;
        margin-bottom: 4px;
    }

    .xio-race-calendar__stage-bullet {
        width: 5px;
        height: 5px;
    }

    .xio-race-calendar__stage-name {
        font-size: 12px;
    }

    .xio-race-calendar__stage-date {
        font-size: 11px;
    }

    /* --- Skeleton --- */

    .xio-race-calendar__skeleton {
        padding: 14px 16px;
        gap: 10px;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        border-left: 3px solid #eee;
        margin-bottom: 10px;
    }

    .xio-race-calendar__skeleton-bar--country,
    .xio-race-calendar__skeleton-bar--date {
        width: 60px;
        height: 10px;
    }

    .xio-race-calendar__skeleton-bar--web {
        display: none;
    }

    /* --- Empty state --- */

    .xio-race-calendar__empty {
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        margin-top: 10px;
    }
}

/* ============================================================
   Responsive — Small Mobile (max-width: 420px)
   ============================================================ */

@media (max-width: 420px) {
    .xio-race-calendar__header {
        padding: 16px 12px 14px;
    }

    .xio-race-calendar__title {
        font-size: 22px;
    }

    .xio-race-calendar__nav-label {
        font-size: 12px;
        min-width: 120px;
        letter-spacing: 1px;
    }

    .xio-race-calendar__rows {
        gap: 8px;
    }

    .xio-race-calendar__row-main {
        padding: 12px 10px 12px 14px;
        gap: 5px 8px;
    }

    .xio-race-calendar__cell--name {
        font-size: 13px;
    }

    .xio-race-calendar__cell--country {
        font-size: 9px;
        padding: 2px 8px;
    }

    .xio-race-calendar__cell--date {
        font-size: 12px;
    }

    .xio-race-calendar__toggle {
        width: 22px;
        height: 22px;
    }

    .xio-race-calendar__globe-icon {
        width: 14px;
        height: 14px;
    }

    .xio-race-calendar__stages-inner {
        padding: 0 10px 10px 14px;
    }

    .xio-race-calendar__stage {
        padding: 8px 10px;
        gap: 8px;
    }

    .xio-race-calendar__stage-name {
        font-size: 11px;
    }

    .xio-race-calendar__stage-date {
        font-size: 10px;
    }

    .xio-race-calendar__empty {
        padding: 40px 12px;
    }

    .xio-race-calendar__empty p {
        font-size: 13px;
    }
}
