/* YENİ TASARIM CSS DEĞİŞKENLERİ (Aydınlık Tema) */
:root {
    --bg-body: #e8e8e8;
    --bg-card: #f9f9f9;
    --bg-input: #eaeaea;
    --bg-date: #efefef;
    --bg-table-header: #ECECEC;
    --blue-main: #0885fe;
    --blue-hover: #006ce0;
    --text-dark: #000000;
    --text-gray: #4c4c4c;
    --border-color: #e0e0e0;
    --shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
    --radius-card: 24px;
    --radius-item: 12px;
}

/* KARANLIK MOD (DARK MODE) DESTEĞİ */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #121212;
        --bg-card: #1e1e1e;
        --bg-input: #2d2d2d;
        --bg-date: #252525;
        --bg-table-header: #141414;
        --blue-main: #3b82f6;
        --blue-hover: #60a5fa;
        --text-dark: #f3f4f6;
        --text-gray: #9ca3af;
        --border-color: #333333;
        --shadow: 0px 4px 15px rgba(0, 0, 0, 0.3);
    }
}

* {
    box-sizing: border-box;
    font-family: Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg-body);
    margin: 0;
    padding: 24px 16px;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    display: flex;
    justify-content: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 40px;
}

/* KART YAPISI */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 20px 16px;
    box-shadow: var(--shadow);
    width: 100%;
    transition: background-color 0.3s ease;
}

.card-header {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
}

/* GİRİŞ ALANI */
.login-grid {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.login-input {
    flex: 1 1 50%;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-item);
    padding: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--text-dark);
    outline: none;
    -webkit-appearance: none;
    height: 52px;
    transition: all 0.2s ease;
    width: 100%;
}

.login-input:focus {
    box-shadow: 0 0 0 2px var(--blue-main);
    border-color: var(--blue-main);
    background: var(--bg-card);
}

.login-btn {
    background: var(--blue-main);
    color: #fff;
    border: none;
    border-radius: var(--radius-item);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.login-btn:active {
    transform: scale(0.95);
}

.logout-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
}

.edit-btn {
    background: var(--bg-card);
    border: 1px solid var(--blue-main);
    color: var(--blue-main);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.edit-btn:hover {
    background: var(--blue-main);
    color: #ffffff;
    border-color: var(--blue-main);
}

.edit-btn:active {
    transform: scale(0.95);
}

/* MAÇ SATIRLARI */
.match-row {
    display: flex;
    align-items: stretch;
    margin-bottom: 8px;
    gap: 12px;
    position: relative;
}

.date-block {
    background: var(--bg-date);
    padding: 10px 8px;
    border-top-right-radius: var(--radius-item);
    border-bottom-right-radius: var(--radius-item);
    width: 85px;
    flex-shrink: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-left: -16px;
    transition: background-color 0.3s ease;
}

.date-text,
.time-text {
    font-size: 14px;
    font-weight: normal;
}

.desktop-match-layout {
    display: none !important;
}

.mobile-match-layout {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    flex: 1;
    padding: 4px 0;
}

@media (max-width: 560px) {
    .desktop-match-layout {
        display: none !important;
    }

    .mobile-match-layout {
        display: flex !important;
    }
}

.team-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-name {
    font-weight: normal;
    font-size: 14px;
}

.derby-badge {
    font-size: 10px;
    color: #fff;
    background: #ef4444;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: auto;
    font-weight: bold;
}

/* TAHMİN GİRİŞ INPUTLARI */
.score-input {
    width: 40px;
    height: 32px;
    text-align: center;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-dark);
    font-weight: bold;
    font-size: 14px;
    padding: 0;
    outline: none;
    transition: all 0.2s ease;
}

.score-input:focus {
    border-color: var(--blue-main);
    box-shadow: 0 0 0 2px rgba(8, 133, 254, 0.2);
}

.score-display {
    font-weight: bold;
    font-size: 14px;
}

/* DURUM ROZETLERİ (Badge) */
.status-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.status-missed {
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fca5a5;
}

.status-points-success {
    background: #d1fae5;
    color: #10b981;
    border: 1px solid #6ee7b7;
}

.status-points-zero {
    background: var(--bg-input);
    color: var(--text-gray);
    border: 1px solid var(--border-color);
}

@media (prefers-color-scheme: dark) {
    .status-missed {
        background: #450a0a;
        color: #fca5a5;
        border-color: #991b1b;
    }

    .status-points-success {
        background: #064e3b;
        color: #6ee7b7;
        border-color: #047857;
    }

    .status-points-zero {
        background: var(--bg-input);
        color: var(--text-gray);
        border-color: var(--border-color);
    }
}

/* LİDERLİK TABLOSU */
.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.leaderboard-table thead th {
    background: var(--bg-table-header);
    padding: 16px 12px;
    font-size: 12px;
    color: var(--text-gray);
    text-align: left;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.leaderboard-table thead th:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.leaderboard-table thead th:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.leaderboard-table tbody td {
    background: var(--bg-card);
    padding: 12px 12px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.leaderboard-table tbody tr td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    font-weight: normal;
}

.leaderboard-table tbody tr td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.leaderboard-username {
    color: var(--blue-main);
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
}

.rank-bold {
    font-weight: bold;
}

.points-bold {
    font-weight: bold;
}

/* 10 KARTLIK TOPLULUK İÇGÖRÜLERİ (YATAY SCROLL CONTAINER) */
.insights-scroll-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    /* Ekranın sağ-sol kenarlarına kadar kayabilmesi için ana gövde padding'ini ezer */
    margin: 0 -16px;
    padding: 8px 16px 24px 16px;
}

.insights-scroll-container::-webkit-scrollbar {
    display: none;
}

/* İÇGÖRÜ ANA KARTI (PEEKING EFEKTİ) */
.insight-card {
    flex: 0 0 82%;
    /* Kartın %82'sini gösterir, %18'i yandaki karta ayrılır */
    scroll-snap-align: center;
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow);
    transition: background-color 0.3s ease;
}

/* Not: .insight-emoji ve .insight-title yerine doğrudan ana temanın .card-header class'ını kullanacağız */

.insight-desc {
    font-size: 13px;
    color: var(--text-gray);
    line-height: 1.4;
    flex-grow: 1;
}

/* User Badge stili ve boş/veri yok (placeholder) durumu */
.insight-user-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    color: var(--blue-main);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    align-self: flex-start;
    margin-top: 8px;
    border: 1px solid var(--border-color);
}

.insight-user-badge.placeholder {
    color: var(--text-gray);
    background: transparent;
    border-style: dashed;
}

/* BUTONLAR VE DİĞER DURUMLAR */
.btn-primary {
    background: var(--blue-main);
    color: #fff;
    border: none;
    border-radius: var(--radius-item);
    padding: 16px;
    width: 100%;
    font-size: 14px;
    font-weight: bold;
    margin-top: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary:active {
    background: var(--blue-hover);
}

.matches-locked {
    opacity: 0.5;
    pointer-events: none;
}

.success-card {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    padding: 16px;
    border-radius: var(--radius-item);
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 16px;
}

/* TOAST MESAJI */
#statusMsg {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    box-shadow: var(--shadow);
    display: none;
    white-space: nowrap;
}

.status-success {
    background: #10b981;
}

.status-error {
    background: #ef4444;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* SKELETON */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border-color) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: var(--radius-item);
}

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skel-row {
    height: 58px;
    width: 100%;
    margin-bottom: 8px;
}

.skel-tr {
    height: 40px;
    width: 100%;
}

/* MODAL (POP-UP) STİLLERİ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    overflow: hidden;
    overscroll-behavior: contain;
}

.modal-content {
    background: var(--bg-body);
    border-radius: var(--radius-card);
    width: 100%;
    max-width: 450px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    padding: 20px;
    animation: modalScaleUp 0.2s ease;
    overflow: hidden;
    overscroll-behavior: contain;
}

@keyframes modalScaleUp {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-gray);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.modal-close-btn:hover {
    background: var(--bg-input);
}

.modal-score-summary {
    background: var(--bg-card);
    padding: 12px;
    border-radius: var(--radius-item);
    text-align: center;
    font-size: 15px;
    font-weight: bold;
    color: var(--blue-main);
    margin-bottom: 16px;
}

.modal-matches-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 12px 12px 12px 0px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.modal-matches-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    max-height: 50vh;
}