/* ============================================================
   Teams Page — styles.css
   World Cup 2026
   ============================================================ */

@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-VF.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'MosesText', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f0f2f5;
    color: #fff;
    direction: rtl;
    min-height: 100vh;
    max-width: 1240px;
    margin: auto;
}

/* ── Page wrapper ────────────────────────────────── */

.page-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ─────────────────────────────────────────────── */

.page-header {
    background-color: #f0f2f5;
    user-select: none;
    padding: 20px 20px 0;
    position: relative;
}

.header-inner {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    height: 95px;
    overflow: visible;
    border-radius: 8px 8px 0 0;
    background-color: #00182F;
    background-image: url('../assets/images/Teams_bg.png?v=c2059735');
    background-size: cover;
    background-position: center;
    /* allow right overflow for tab decoration, bottom overflow for trophy */
    clip-path: inset(0 0 -200px 0);
}

/* keep the waves div but hide it — bg image replaces it */
.header-bg-waves {
    display: none;
}

/* Tab shape — top half (lavender), peeks from right edge */
.header-inner::before {
    content: '';
    position: absolute;
    right: -53px;
    top: 0;
    width: 97px;
    height: 47.5px;
    background: #b4aed5;
    border-radius: 10000px 0 0 0;
    pointer-events: none;
    z-index: 2;
}

/* Tab shape — bottom half (purple), peeks from right edge */
.header-inner::after {
    content: '';
    position: absolute;
    right: -53px;
    bottom: 0;
    width: 97px;
    height: 47.5px;
    background: #b089fe;
    border-radius: 10000px 0 0 0;
    pointer-events: none;
    z-index: 2;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 50px;
    direction: rtl;
}

.header-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
    line-height: 1;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.header-trophy {
    position: absolute;
    bottom: -45px;
    left: 20px;
    height: 88px;
    width: auto;
    object-fit: contain;
    z-index: 10;
}

/* ── Search bar ─────────────────────────────────────────── */

.search-bar-wrapper {
    background: #e8eaed;
    padding: 12px 20px;
    max-width: 1280px;
    margin: 0 auto;
    border-radius: 0 0 8px 8px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 24px;
    padding: 8px 16px;
    max-width: 720px;
    transition: border-color 0.2s;
}

.search-bar:focus-within {
    border-color: #689ABF;
}

.search-icon {
    color: #A5ACBB;
    flex-shrink: 0;
}

#search-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
    color: #1a1a2e;
    background: transparent;
    text-align: right;
    direction: rtl;
}

#search-input::placeholder {
    color: #A5ACBB;
}

/* ── Main content ───────────────────────────────────────── */

.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 20px 40px;
}

/* ── Teams Grid ─────────────────────────────────────────── */

.teams-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 46px;
}

/* ── Group Section Header ───────────────────────────────── */

.group-section-header {
    grid-column: 1 / -1;
    background-color: #00182F;
    color: #ffffff;
    font-size: 32px;
    font-weight: 630;
    line-height: 16px;
    padding: 20px;
    border-radius: 4px;
    text-align: right;
    direction: rtl;
    margin-bottom: -26px;
    
}

/* ── Team Card ──────────────────────────────────────────── */

.team-card {
    border: 1px solid #e4e8f0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 2px 7px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    background: #fff;
}

.team-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.team-card--dimmed {
    opacity: 0.35;
    pointer-events: auto;
}

/* Colored top area */
.team-card-top {
    position: relative;
    padding: 16px 14px 14px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 136px;
    direction: rtl;
}

/* Flag — top right corner */
.team-flag {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 41px;
    height: 31px;
    object-fit: cover;
    border: 0.5px solid rgba(255,255,255,0.6);
    flex-shrink: 0;
}

/* Name area — bottom of colored section */
.team-name-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: right;
    margin-top: auto;
    padding-top: 28px;
}

.team-subtitle {
    font-size: 12px;
    font-weight: 200;
    color: inherit;
    opacity: 0.85;
    margin-bottom: 2px;
    line-height: 1.3;
}

.team-name {
    font-size: 1.85rem;
    font-weight: 700;
    color: inherit;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* White stats section */
.team-card-stats {
    background: #fff;
    border-top: 1px solid #e4e8f0;
    padding: 15px 14px;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 20px;
    direction: rtl;
}

.team-stat-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.team-stat-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: #505B73;
}

.team-stat-value {
    font-size: 1rem;
    font-weight: 500;
    color: #03122b;
}

/* ── Skeleton loader ────────────────────────────────────── */

.team-card.skeleton {
    cursor: default;
    min-height: 220px;
    border: 1px solid #e4e8f0;
    background: linear-gradient(90deg, #d0d3da 25%, #e8eaed 50%, #d0d3da 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── No results ─────────────────────────────────────────── */

.no-results {
    text-align: center;
    color: #666;
    font-size: 1.1rem;
    padding: 48px 0;
    grid-column: 1 / -1;
}

.hidden {
    display: none;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 1024px) {
    .teams-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .page-header {
        padding: 0;
    }

    .header-inner {
        height: 78px;
        border-radius: 0;
    }

    .header-inner::before,
    .header-inner::after {
        height: 39px !important;
        right: -65px !important;
    }    

    .header-trophy {
        height: 65px;
        bottom: 3px;
        left: 12px;
    }

    .search-bar-wrapper {
        padding: 10px 8px;
        border-radius: 0;
        max-width: 100%;
    }

    .main-content {
        padding: 12px 8px 32px;
    }

    .teams-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .group-section-header {
        margin-bottom: 0;
        border-radius: 0;
        font-size: 2rem;
        padding: 10px 14px;
    }

    .team-card-top {
        min-height: 136px;
        padding: 20px 15px 10px;
    }

    .team-flag {
        top: 20px;
        right: 15px;
        width: 41px;
        height: 30px;
    }

    .team-name {
        font-size: 1.75rem;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .team-card-stats {
        padding: 10px 15px;
        gap: 8px;
    }

    /* .team-stat-label,
    .team-stat-value {
        font-size: 12px;
    } */
}

@media (max-width: 400px) {
    .teams-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Dark mode ──────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
    body {
        background-color: #0a0a0a;
        color: #fff;
    }

    .page-header {
        background-color: #0a0a0a;
    }

    .search-bar-wrapper {
        background: #1e1e1e;
    }

    .search-bar {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }

    #search-input {
        color: #fff;
    }

    #search-input::placeholder {
        color: #666;
    }

    .search-icon {
        color: #666;
    }

    .team-card {
        background: #1e1e1e;
        border-color: #333;
    }

    .team-card-stats {
        background: #1e1e1e;
        border-top-color: #333;
    }

    .team-stat-value {
        color: #ffffff;
    }

    .team-stat-label {
        color: #a5acbb;
    }

    .no-results {
        color: #a5acbb;
    }

    .group-section-header {
        background-color: #30334e;
    }

    .team-card-stats {
        background: #1e1e1e;
        border-top-color: #2e2e2e;
    }
}
