/* ========================================
   Matches Ticker Component Styles
   World Cup 2026 - Ynet Sport
   ======================================== */

/* Font Declarations */
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-VF.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Light.otf?v=c4168ce4') format('opentype');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Regular.otf?v=9275aca6') format('opentype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Medium.otf?v=22fa8d06') format('opentype');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Bold.otf?v=770b9b85') format('opentype');
    font-weight: 700;
    font-style: normal;
}
/* Condensed ("Negative") variants */
@font-face {
    font-family: 'MosesTextNegative';
    src: url('../assets/fonts/MosesTextNegative_Inter-Regular.otf?v=b57919e8') format('opentype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'MosesTextNegative';
    src: url('../assets/fonts/MosesTextNegative_Inter-Bold.otf?v=97203665') format('opentype');
    font-weight: 700;
    font-style: normal;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'MosesText', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: rtl;
    padding: 0;
}

/* Main Ticker Container */
.ticker-container {
    position: relative;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 184px;
    background-color: #EEF2FB;
}

/* Matches Scroll Wrapper */
.matches-scroll-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    height: 100%;
    user-select: none;
    touch-action: pan-y;
}
/* Prevent browser from hijacking horizontal swipes on any child element */
.matches-scroll-wrapper * {
    touch-action: pan-y;
}
@media (min-width: 769px) {
    .matches-scroll-wrapper {
        cursor: grab;
    }
    .matches-scroll-wrapper:active {
        cursor: grabbing;
    }
}

/* Matches Container — also acts as the slide stage for day transitions */
.matches-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    height: 100%;
    overflow: hidden;
    position: relative;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.matches-container::-webkit-scrollbar {
    display: none;
}

/* Matches Content Wrapper */
.matches-content {
    display: flex;
    flex-direction: row;
    align-items: center;   /* centers items vertically within the 184px height */
    height: 100%;          /* fills matches-container = 184px */
    gap: 30px;
    /* Transition used by the slide-navigation animation (inline styles) */
    transition: opacity 0.3s ease, transform 0.3s ease;
    justify-content: center;
}

/* Date Group Wrapper - holds header + matches for one date */
.date-group-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Date Header */
.date-header {
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.2) 100%
    ), #03122B;
    padding: 5px 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    /* width will be set dynamically by JavaScript */
}

.date-header span {
    font-family: 'MosesText', sans-serif;
    font-weight: 630;
    font-size: 16px;
    color: #FFFFFF;
    line-height: 16px;
    white-space: nowrap;
}

/* Peek date headers — centered (no link) */
.date-header.peek-header {
    justify-content: center;
}

/* "See all matches" link inside current date header — pinned to left edge */
.date-header__link {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.date-header__link:hover {
    color: #FFFFFF;
}

/* Date Matches - container for matches of a single date */
.date-matches {
    display: flex;
    flex-direction: row;
    gap: 4px;
}

/* Date Group Wrapper — real peek groups: 126px height, centered by parent flex */
.peek-group {
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Inner wrapper: holds header + matches grid, sized to card width.
   The overlay lives here so it never bleeds into the empty background space. */
.peek-group__inner {
    display: flex;
    flex-direction: column;
    position: relative;
}

.peek-group__inner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.72);
    pointer-events: none;
    z-index: 2;
}

/* Spacer: invisible placeholder, no overlay */
.peek-group--spacer {
    overflow: visible;
}

.peek-group--spacer::after {
    display: none;
}

/* ---------------------------------------------------------------------------
   Peek card internal sizing — shrinks the card to ~126px without distortion
   Breakdown: header(26) + main(64) + border(1) + footer(35) = 126px
   --------------------------------------------------------------------------- */
.peek-group .match-main {
    min-height: 64px;
    padding: 8px 10px;
    overflow: hidden;
}

.peek-group .match-teams {
    gap: 8px;
}

.peek-group .team-flag {
    width: 30px;
    height: 20px;
}

.peek-group .team-score {
    font-size: 18px;
    line-height: 20px;
}

.peek-group .time-display:not(.time-display--soon) {
    font-size: 20px;
    line-height: 20px;
}

.peek-group .time-display--soon {
    font-size: 10px;
    line-height: 1.3;
    max-width: 44px;
}

.peek-group .match-time {
    min-width: 44px;
}

.peek-group .match-footer {
    padding: 9px 10px 10px;
}

/* Date Group (for mobile - groups date header + matches) */
.date-group {
    display: none; /* Hidden by default, shown only in mobile */
}

/* Inline Date Header (for mobile scroll) */
.inline-date-header {
    display: none; /* Hidden by default, shown in mobile */
}

/* Matches Grid */
.matches-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    flex: 1;
    align-items: flex-start;
}

/* ── Final match card — golden gradient (Figma spec) ───────────────────── */
.match-card--final {
    background: linear-gradient(
        -22.65deg,
        #FFF7D8 3.93%,
        #FFE476 50.47%,
        #FFCC00 97%
    ) !important;
}

.match-card--final .match-main {
    background: linear-gradient(
        -16deg,
        rgba(240, 147, 22, 0.6) 3%,
        rgba(247, 198, 133, 0.6) 49.5%,
        rgba(252, 242, 225, 0.6) 96%
    );
    border-bottom-color: #E4E8F0;
}

.match-card--final .match-footer {
    background: linear-gradient(
        -6.9deg,
        rgba(240, 147, 22, 0.6) 3%,
        rgba(247, 198, 133, 0.6) 49.5%,
        rgba(252, 242, 225, 0.6) 96%
    );
}

/* Match Card */
.match-card {
    display: flex;
    flex-direction: column;
    min-width: 240px;
    flex-shrink: 0;
    background: #FFFFFF !important;
    border: 0.5px solid #E4E8F0;
    border-top: none;
    border-radius: 0;
}

/* Peek Cards - partially visible cards from adjacent dates */
.match-card.peek-card {
    pointer-events: none;
}

/* Article link wrapper — inherits card appearance, adds click affordance */
a:has(> .match-card--linked) {
    display: contents;
    text-decoration: none;
    color: inherit;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.match-card--linked {
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    outline: none;
}

@media (hover: hover) {
    .match-card--linked:hover {
        box-shadow: 0 2px 8px rgba(82, 107, 219, 0.12);
    }
}

/* Match Main Section */
.match-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 10px;
    min-height: 95px;
    border-bottom: 1px solid #E4E8F0;
}

/* When showing time (not scores), reverse order: teams on right, time on left */
.match-main:has(.match-time .time-display) {
    flex-direction: row-reverse;
}

/* Match Time */
.match-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: stretch;
    justify-content: center;
    position: relative;
    min-width: 56px;
    text-align: center;
}

.time-display {
    font-family: 'MosesTextNegative', sans-serif;
    font-weight: 400;
    font-size: 26.667px;
    color: #03122B;
    line-height: 26.667px;
}

.time-display[data-kickoff] {
    color: #E41D35;
}


.time-display--soon {
    font-family: 'MosesText', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #E41D35;
    line-height: 1.3;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    max-width: 60px;
    text-align: center;
    letter-spacing: -0.5px;
}

.time-subtitle {
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 10px;
    color: #F43056;
    line-height: 11px;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

/* Match Teams */
.match-teams {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.match-teams.with-scores {
    margin-right: 0;
}

.team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* In matches with scores, reverse team-row to show: teams+flags on right, scores on left */
.match-teams.with-scores .team-row {
    flex-direction: row-reverse;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row-reverse;
}

.team-name {
    font-family: 'MosesText', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: #03122B;
    line-height: 16px;
}

.team-flag {
    width: 41px;
    height: 30.75px;
    overflow: hidden;
    border-radius: 2px;
    flex-shrink: 0;
}

.team-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Team Scores */
.team-score {
    font-family: 'MosesText', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: #03122B;
    line-height: 26.667px;
    min-width: 20px;
    text-align: center;
}

.team-score.winning-score {
}

/* Match Footer */
.match-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    padding: 8px 10px 12px;
    background: #FFFFFF;
}

.match-stage {
    font-family: 'MosesText', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #03122B;
    line-height: 16px;
}

.match-channel {
    font-family: 'MosesText', sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #03122B;
    line-height: 16px;
    padding-left: 10px;
    border-left: 1px solid #E4E8F0;
}

/* Live Match Status */
.match-live-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'MosesTextNegative', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: #03122B;
    line-height: 16px;
    padding-left: 10px;
    border-left: 1px solid #E4E8F0;
}

.live-dot {
    width: 9.333px;
    height: 9.333px;
    background-color: #00B140;
    border: 1.5px solid #27DF6A;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Finished Match Status */
.match-finished-status {
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: #F43056;
    line-height: 16px;
    padding-left: 10px;
    border-left: 1px solid #E4E8F0;
}

/* Half-time / ET break interval */
.match-halftime-status {
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: #526BDB;
    line-height: 16px;
    padding-left: 10px;
    border-left: 1px solid #E4E8F0;
}

/* Disrupted / cancelled / postponed / suspended */
.match-disruption-status {
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: #888888;
    line-height: 16px;
    padding-left: 10px;
    border-left: 1px solid #E4E8F0;
}

/* Navigation Arrows */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #526BDB;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    z-index: 10;
}

.nav-arrow-left {
    right: 10px;
    opacity: 0;
    transition: background-color 0.2s, opacity 0.2s;
}

.nav-arrow-right {
    left: 10px;
    opacity: 0;
    transition: background-color 0.2s, opacity 0.2s;
}

.ticker-container:hover .nav-arrow {
    opacity: 1;
}

.ticker-container:hover .nav-arrow:disabled {
    opacity: 0.5;
}

.nav-arrow:hover {
    background-color: #3d54c5;
}

.nav-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.nav-arrow:disabled {
    background-color: #a0a8d4;
    cursor: not-allowed;
}

/* Fade Overlays — hidden on desktop, peek overlay handles visual separation */
.fade-overlay {
    display: none;
}

.fade-left {
    left: 0;
    background: linear-gradient(to left, rgba(238, 242, 251, 0), rgba(238, 242, 251, 1));
}

.fade-right {
    right: 0;
    background: linear-gradient(to right, rgba(238, 242, 251, 0), rgba(238, 242, 251, 1));
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .ticker-container {
        height: auto;
        gap: 0;
        padding: 0;
    }

    .matches-container {
        width: 100%;
        height: auto;
    }

    .matches-scroll-wrapper {
        overflow: hidden;
        height: auto;
    }

    /* 10px breathing room above and below the current-group on mobile */
    .current-group {
        padding: 10px 0;
        box-sizing: border-box;
    }

    /* Reduce gap between peek groups and current group on mobile */
    .matches-content {
        gap: 10px;
    }

    /* Peek cards: show only a slim hint on each side */
    .peek-group {
        width: 57px;
        min-width: 57px;
        max-width: 57px;
        overflow: hidden;
    }

    .peek-group--spacer {
        width: 57px;
        min-width: 57px;
        max-width: 57px;
    }

    /* Mobile current-group: single card, no horizontal scroll needed */
    .current-group .date-matches {
        overflow: visible;
    }

    .date-header__link {
        display: none;
    }

    .date-header.peek-header {
        overflow: hidden;
    }

    .date-header.peek-header span {
        visibility: hidden;
    }

    .date-header {
        width: 100%;
        max-width: 100%;
        margin-right: 0;
        padding: 4px 0;
    }

    .date-group {
        display: flex;
        flex-direction: column;
        gap: 0;
        flex-shrink: 0;
        scroll-snap-align: start;
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: auto;
    }

    .inline-date-header {
        display: block;
        width: 100%;
        flex-shrink: 0;
        background: linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.2) 0%,
            rgba(0, 0, 0, 0.2) 100%
        ), #03122B;
        padding: 8px 0;
        text-align: center;
        border-radius: 0;
        margin-bottom: 0;
    }

    .inline-date-header span {
        font-family: 'MosesTextNegative', sans-serif;
        font-weight: 700;
        font-size: 16px;
        color: #FFFFFF;
        line-height: 16px;
    }

    .matches-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: scroll;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        align-items: stretch;
    }

    .matches-grid::-webkit-scrollbar {
        display: none;
    }

    .match-card {
        width: 100%;
        flex-shrink: 0;
        border-radius: 0;
    }

    /* Reverse order: teams on left, time/scores on right — only for the active card */
    .match-main {
        padding: 12px 10px;
    }

    .current-group .match-main {
        flex-direction: row-reverse !important;
    }

    .match-time {
        min-width: 75px;
        flex-shrink: 0;
    }

    .match-teams {
        align-items: flex-start;
        width: 100%;
        flex: 1;
    }

    .team-row {
        width: 100%;
        gap: 10px;
    }

    .current-group .team-row {
        justify-content: flex-end;
        flex-direction: row-reverse;
    }

    .current-group .team-info {
        flex-direction: row-reverse;
    }

    .current-group .team-score {
        margin-right: auto;
    }

    /* Right (previous) peek: undo flex reversals so score/time sit on the RTL-right edge (visible) */
    .peek-prev .match-main,
    .peek-prev .match-main:has(.match-time .time-display) {
        flex-direction: row !important;
    }

    /* Not-started: no score exists, hide teams (time is in .match-time on the right) */
    .peek-prev .match-teams:not(.with-scores) {
        display: none;
    }

    /* Started/ended: hide name + flag, leave only .team-score visible.
       team-score is first DOM child → rightmost in RTL flex-direction:row → visible on right edge */
    .peek-prev .match-teams.with-scores .team-info {
        display: none;
    }

    .peek-prev .match-teams.with-scores .team-row {
        flex-direction: row;
    }

    .peek-prev .match-footer {
        flex-direction: row;
    }

    .time-display:not(.time-display--soon) {
        font-size: 26px;
        line-height: 36px;
    }

    .team-name {
        font-size: 16px;
        line-height: 21px;
    }

    .team-flag {
        width: 41px;
        height: 30.75px;
    }

    .date-header span {
        font-size: 16px;
        line-height: 21px;
        font-family: 'MosesText';
        font-weight: 630;
    }

    /* No navigation arrows on mobile — swipe to navigate */
    .nav-arrow {
        display: none;
    }

    /* Hide fade overlays on mobile */
    .fade-overlay {
        display: none;
    }

    .match-stage {
        font-size: 14px;
        line-height: 16px;
    }

    .match-channel {
        font-size: 12px;
        line-height: 16px;
    }

    .time-subtitle {
        font-size: 12px;
        line-height: 12px;
    }

    .match-live-status {
        font-size: 10px;
        line-height: 15px;
    }

    .match-finished-status {
        font-size: 10px;
        line-height: 15px;
    }

    .match-halftime-status {
        font-size: 10px;
        line-height: 15px;
    }

    .match-disruption-status {
        font-size: 10px;
        line-height: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .ticker-container {
        height: auto;
        gap: 0;
        padding: 0;
    }

    .matches-scroll-wrapper {
        overflow: hidden;
        height: auto;
    }

    .matches-container {
        height: auto;
    }

    .date-header {
        width: 100%;
        max-width: 100%;
        margin-right: 0;
    }

    .date-group {
        gap: 0;
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: auto;
        max-height: none;
    }

    .inline-date-header {
        width: 100%;
    }

    .matches-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        align-items: stretch;
    }

    .matches-grid::-webkit-scrollbar {
        display: none;
    }

    .match-card {
        width: 100%;
        flex-shrink: 0;
        border-radius: 0;
    }

    .date-header {
        padding: 4px 0;
    }

    .date-header span {
        font-size: 16px;
        line-height: 21px;
    }

    .match-main {
        padding: 12px 10px;
    }

    .match-footer {
        padding: 4px 10px 6px;
    }
}

/* ── Dark mode (mobile) ─────────────────────────────────── */

@media (max-width: 768px) and (prefers-color-scheme: dark) {
    body {
        background-color: #000000;
    }

    .ticker-container {
        background-color: #000000;
    }

    .inline-date-header {
        background: #505b73;
    }

    .date-header {
        background: #00182f;
    }
}
