/*
 * KlubTek Public Styles
 * Prefixed with .klubtek- to avoid theme conflicts.
 * Uses CSS custom properties for club branding.
 *
 * Variables are injected inline by the plugin based on admin settings:
 *   --klubtek-primary
 *   --klubtek-secondary
 */

/* ─── Reset & Container ─── */

.klubtek-container {
    --klubtek-primary: #1a1a2e;
    --klubtek-secondary: #e94560;
    --klubtek-bg: #ffffff;
    --klubtek-bg-card: #f8f9fa;
    --klubtek-border: #e2e6ea;
    --klubtek-text: #212529;
    --klubtek-text-muted: #6c757d;
    --klubtek-radius: 10px;
    --klubtek-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    font-family: var(--klubtek-font);
    color: var(--klubtek-text);
    margin: 1.5rem 0;
}

.klubtek-container *,
.klubtek-container *::before,
.klubtek-container *::after {
    box-sizing: border-box;
}

/* ─── Section title ─── */

.klubtek-container .klubtek-section-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    margin: 0 0 1rem 0 !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 3px solid var(--klubtek-primary) !important;
    display: inline-block !important;
    color: var(--klubtek-text) !important;
}

/* ─── Week Navigator ─── */

.klubtek-week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.klubtek-week-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--klubtek-primary);
    text-transform: capitalize;
    min-width: 200px;
    text-align: center;
}

.klubtek-week-prev,
.klubtek-week-next {
    background: var(--klubtek-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.klubtek-week-prev:hover,
.klubtek-week-next:hover {
    opacity: 0.85;
    transform: scale(1.08);
}

.klubtek-week-prev:disabled,
.klubtek-week-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.klubtek-matches-grid.klubtek-loading {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* ─── Match Cards ─── */

.klubtek-container .klubtek-match-card {
    background: var(--klubtek-bg-card) !important;
    border: 1px solid var(--klubtek-border) !important;
    border-radius: var(--klubtek-radius) !important;
    padding: 1rem 1.25rem !important;
    transition: box-shadow 0.2s ease, transform 0.15s ease !important;
    text-align: center !important;
    display: block !important;
    width: 100% !important;
    margin-bottom: 0.75rem !important;
    position: relative !important;
    /* Added for absolute positioning of badge */
}

.klubtek-container .klubtek-match-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-1px) !important;
}

/* ─── Match Category Badge (Unified) ─── */

.klubtek-category-badge {
    position: absolute !important;
    top: -13px !important;
    right: 10px !important;
    background: #f0f0f0 !important;
    border: none !important;
    color: #353535 !important;
    font-size: 0.5rem !important;
    padding: 1px 8px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    z-index: 10 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
}

.klubtek-container .klubtek-match-meta {
    display: flex !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.klubtek-container .klubtek-match-category {
    background: var(--klubtek-primary) !important;
    color: #fff !important;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.klubtek-container .klubtek-match-competition {
    color: var(--klubtek-text-muted) !important;
    padding: 2px 0 !important;
    display: inline-block !important;
}

/* ─── Resting Style ─── */

.klubtek-container .klubtek-match-card--resting {
    background: linear-gradient(to right, #ffffff, #fdfdfd) !important;
    border-left: 4px solid var(--klubtek-secondary) !important;
    opacity: 0.95 !important;
}

.klubtek-container .klubtek-match-card--resting .klubtek-match-body {
    grid-template-columns: 1fr !important;
    justify-content: center !important;
}

.klubtek-container .klubtek-match-card--resting .klubtek-match-team--home {
    display: none !important;
}

.klubtek-container .klubtek-match-card--resting .klubtek-match-team--away {
    justify-content: center !important;
    font-size: 1.25rem !important;
    color: var(--klubtek-secondary) !important;
}

.klubtek-container .klubtek-match-card--resting .klubtek-match-score {
    display: none !important;
}

.klubtek-container .klubtek-match-card--resting .klubtek-team-name {
    font-size: 1.3rem !important;
    letter-spacing: 0.05em !important;
    color: var(--klubtek-secondary) !important;
}

.klubtek-container .klubtek-match-body {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.5rem 0 !important;
    margin: 0 !important;
}

.klubtek-match-team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.klubtek-match-team--home {
    justify-content: flex-end;
}

.klubtek-match-team--away {
    justify-content: flex-start;
}

.klubtek-team-badge {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.klubtek-team-badge--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--klubtek-bg-card);
    border: 1px solid var(--klubtek-border);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--klubtek-text-muted);
}

.klubtek-container .klubtek-match-body .klubtek-team-name {
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    line-height: 1.2 !important;
    color: var(--klubtek-text) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.klubtek-match-score {
    text-align: center;
    min-width: 80px;
}

.klubtek-score-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 2px 10px;
    border-radius: 6px;
}

.klubtek-score-value--live {
    color: #fff !important;
    background: var(--klubtek-secondary) !important;
}

.klubtek-score-value--finished {
    color: #fff !important;
    background: #333 !important;
}

.klubtek-score-vs {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--klubtek-text-muted);
    text-transform: uppercase;
}

.klubtek-match-date {
    font-size: 0.78rem;
    color: var(--klubtek-text-muted);
    text-transform: capitalize;
}

.klubtek-match-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--klubtek-text-muted);
}

.klubtek-match-venue {
    font-size: 0.8rem;
    color: var(--klubtek-text-muted);
}

/* ─── Teams Grid ─── */

.klubtek-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.klubtek-container .klubtek-team-card {
    background: var(--klubtek-bg-card) !important;
    border: 1px solid var(--klubtek-border) !important;
    border-radius: var(--klubtek-radius) !important;
    padding: 1.25rem !important;
    text-align: center !important;
    transition: box-shadow 0.2s ease, transform 0.15s ease !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.klubtek-container .klubtek-team-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-2px) !important;
}

.klubtek-team-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin: 0 auto 0.75rem;
    display: block;
}

.klubtek-team-logo--placeholder {
    font-size: 2.5rem;
    line-height: 64px;
}

.klubtek-team-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.klubtek-teams .klubtek-team-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.klubtek-team-category {
    font-size: 0.78rem;
    color: var(--klubtek-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ─── Squad Grid ─── */

.klubtek-squad-category {
    font-size: 1rem;
    font-weight: 600;
    color: var(--klubtek-secondary);
    margin: 1.25rem 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.klubtek-squad-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.klubtek-player-card {
    background: var(--klubtek-bg-card);
    border: 1px solid var(--klubtek-border);
    border-radius: var(--klubtek-radius);
    padding: 1rem;
    text-align: center;
    transition: box-shadow 0.2s ease;
}

.klubtek-player-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.klubtek-player-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 0.6rem;
    display: block;
    border: 2px solid var(--klubtek-border);
}

.klubtek-player-photo--placeholder {
    font-size: 2rem;
    line-height: 72px;
    background: #eee;
}

.klubtek-player-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.klubtek-player-name {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.2;
}

.klubtek-player-role {
    font-size: 0.72rem;
    color: var(--klubtek-text-muted);
    text-transform: uppercase;
}

/* ─── Events List ─── */

.klubtek-events-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.klubtek-event-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--klubtek-bg-card);
    border: 1px solid var(--klubtek-border);
    border-radius: var(--klubtek-radius);
    padding: 1rem 1.25rem;
    transition: box-shadow 0.2s ease;
}

.klubtek-event-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.klubtek-event-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--klubtek-secondary);
    white-space: nowrap;
    min-width: 110px;
    padding-top: 2px;
}

.klubtek-event-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.klubtek-event-type {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--klubtek-text-muted);
    letter-spacing: 0.04em;
}

.klubtek-event-title {
    font-weight: 700;
    font-size: 1rem;
}

.klubtek-event-venue {
    font-size: 0.82rem;
    color: var(--klubtek-text-muted);
}

/* ─── Birthdays Widget ─── */

.klubtek-birthday-group {
    margin-bottom: 1.25rem;
}

.klubtek-birthday-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--klubtek-text-muted);
    margin: 0 0 0.6rem 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.klubtek-birthday-heading--today {
    color: var(--klubtek-secondary);
    font-size: 1.1rem;
}

.klubtek-birthday-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.klubtek-birthday-card {
    background: var(--klubtek-bg-card);
    border: 1px solid var(--klubtek-border);
    border-radius: var(--klubtek-radius);
    padding: 1rem;
    text-align: center;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.klubtek-birthday-card:hover {
    box-shadow: 0 4px 14px rgba(233, 69, 96, 0.15);
    transform: translateY(-2px);
}

.klubtek-birthday-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 0.6rem;
    display: block;
    border: 3px solid var(--klubtek-secondary);
}

.klubtek-birthday-photo--placeholder {
    font-size: 2rem;
    line-height: 64px;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-color: var(--klubtek-secondary);
}

.klubtek-birthday-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.klubtek-birthday-name {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
}

.klubtek-birthday-age {
    font-size: 0.8rem;
    color: var(--klubtek-secondary);
    font-weight: 600;
}

.klubtek-birthday-team {
    font-size: 0.72rem;
    color: var(--klubtek-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ─── Birthdays Carousel ─── */

.klubtek-birthdays--carousel {
    overflow: hidden;
}

.klubtek-birthday-carousel {
    display: flex;
    gap: 1.5rem;
    width: max-content;
    animation: klubtek-marquee 35s linear infinite;
}

.klubtek-birthday-carousel:hover {
    animation-play-state: paused;
}

@keyframes klubtek-marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.klubtek-birthday-item {
    flex: 0 0 auto;
    width: 90px;
    text-align: center;
    scroll-snap-align: start;
}

.klubtek-birthday-item__photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 0.35rem;
    display: block;
    border: 2px solid var(--klubtek-secondary);
}

.klubtek-birthday-item__photo--placeholder {
    font-size: 1.6rem;
    line-height: 56px;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-color: var(--klubtek-secondary);
}

.klubtek-birthday-item__name {
    display: block;
    font-weight: 600;
    font-size: 0.72rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.klubtek-birthday-item__age {
    display: block;
    font-size: 0.65rem;
    color: var(--klubtek-text-muted);
}

.klubtek-birthday-item__badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    background: var(--klubtek-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    margin-top: 0.2rem;
}

.klubtek-birthday-item__day {
    display: block;
    font-size: 0.6rem;
    color: var(--klubtek-text-muted);
    margin-top: 0.15rem;
}

/* ─── Notices (Error / Empty) ─── */

.klubtek-notice {
    padding: 1rem 1.25rem;
    border-radius: var(--klubtek-radius);
    font-size: 0.9rem;
}

.klubtek-notice p {
    margin: 0;
}

.klubtek-notice--error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.klubtek-notice--empty {
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    color: #6c757d;
    text-align: center;
    font-style: italic;
}

/* ─── Responsive ─── */

@media (max-width: 600px) {
    .klubtek-match-body {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 0.5rem;
    }

    .klubtek-match-team--home,
    .klubtek-match-team--away {
        justify-content: center;
        text-align: center;
    }

    .klubtek-teams-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .klubtek-squad-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .klubtek-event-card {
        flex-direction: column;
        gap: 0.4rem;
    }
}

/* ─── Standings ─── */
.klubtek-standings {
    margin: 20px 0;
}

.klubtek-standings-table-wrapper {
    overflow-x: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.klubtek-standings-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

.klubtek-standings-table th,
.klubtek-standings-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.klubtek-standings-table th {
    background-color: #f8f9fa;
    color: #1a1a2e;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
}

.klubtek-standings-team-name {
    text-align: left !important;
    font-weight: 500;
    color: #1a1a2e;
}

.klubtek-container .klubtek-standings-pts {
    font-weight: 700 !important;
    color: #e94560 !important;
}

.klubtek-standings-table tr:hover {
    background-color: #fafafa;
}

.klubtek-standings-table tr:last-child td {
    border-bottom: none;
}

/* ─── Sidebar Matches ─── */

.klubtek-container.klubtek-sidebar-matches {
    margin: 1rem 0 !important;
}

.klubtek-sidebar-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.6rem !important;
}

/* ─── Sidebar Compact List ─── */

.klubtek-sl-container {
    font-family: var(--klubtek-font) !important;
    padding: 0 !important;
}

.klubtek-sl-day-group {
    margin-bottom: 0.5rem !important;
}

.klubtek-sl-date-heading {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    color: var(--klubtek-text-muted) !important;
    padding: 0.35rem 0.5rem !important;
    background: #f8f8f8 !important;
    border-radius: 4px !important;
    margin-bottom: 2px !important;
}

.klubtek-sl-row {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.4rem 0.5rem !important;
    border-bottom: 1px solid #f0f0f0 !important;
    transition: background 0.15s ease !important;
    font-size: 0.75rem !important;
}

.klubtek-sl-row:last-child {
    border-bottom: none !important;
}

.klubtek-sl-row:hover {
    background: #fafafa !important;
}

/* Live match row */
.klubtek-sl-row--live {
    background: rgba(40, 167, 69, 0.04) !important;
    border-left: 3px solid #28a745 !important;
    padding-left: calc(0.5rem - 3px) !important;
}

/* Finished match row */
.klubtek-sl-row--finished {
    opacity: 0.7 !important;
}

/* Time column */
.klubtek-sl-time {
    min-width: 38px !important;
    font-weight: 800 !important;
    font-size: 0.7rem !important;
    color: var(--klubtek-primary) !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.klubtek-sl-live-dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background: #28a745 !important;
    display: inline-block !important;
    animation: klubtek-pulse 1.5s infinite !important;
    flex-shrink: 0 !important;
}

/* Teams column */
.klubtek-sl-teams {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

/* Venue column (inline) */
.klubtek-sl-venue {
    font-size: 0.5rem !important;
    color: #aaa !important;
    font-style: italic !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex-shrink: 0 !important;
    max-width: 120px !important;
}

.klubtek-sl-team {
    font-size: 0.72rem !important;
    font-weight: 400 !important;
    color: var(--klubtek-text) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 45% !important;
}

.klubtek-sl-team--club {
    font-weight: 700 !important;
}

.klubtek-sl-separator {
    font-size: 0.6rem !important;
    color: var(--klubtek-text-muted) !important;
    flex-shrink: 0 !important;
    padding: 0 2px !important;
}

/* Score inside separator */
.klubtek-sl-score {
    font-weight: 800 !important;
    font-size: 0.7rem !important;
    padding: 1px 4px !important;
    border-radius: 3px !important;
}

.klubtek-sl-score--finished {
    color: #333 !important;
    background: #eee !important;
}

.klubtek-sl-score--live {
    color: #fff !important;
    background: #28a745 !important;
}

/* Category column */
.klubtek-sl-category {
    font-size: 0.5rem !important;
    color: #999 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

/* ─── Sidebar Refresh Button ─── */

.klubtek-sidebar-header {
    display: flex !important;
    justify-content: flex-end !important;
    margin-bottom: 0.5rem !important;
}

.klubtek-sidebar-refresh {
    background: var(--klubtek-bg-card) !important;
    border: 1px solid var(--klubtek-border) !important;
    color: var(--klubtek-text-muted) !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.klubtek-sidebar-refresh:hover:not(:disabled) {
    background: #fff !important;
    border-color: var(--klubtek-primary) !important;
    color: var(--klubtek-primary) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

.klubtek-sidebar-refresh:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.klubtek-sidebar-refresh.klubtek-is-loading::before {
    content: "🔄" !important;
    display: inline-block !important;
    animation: klubtek-spin 1s linear infinite !important;
}

@keyframes klubtek-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}