/* ============================================
   TJK ALTILI GANYAN - MOBİL v10.2
   ✅ Seçili renk: Tatlı Mavi
   ✅ Tarih ve Program Getir butonu kaldırıldı
   ✅ İkinci Hesapla Butonu Eklendi
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.tjk-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    padding-bottom: 90px;
    background: #f5f5f5;
    min-height: 100vh;
}

/* ========== ŞEHİR TABLARI ========== */
.city-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    border-radius: 8px;
}

.city-tab {
    flex: 1;
    min-width: 80px;
    padding: 12px 6px;
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #666;
    cursor: pointer;
    text-align: center;
}

.city-tab.active {
    background: #8B0000;
    color: white;
}

/* ========== ŞEHİR İÇERİK ========== */
.city-content {
    display: none;
    background: white;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.city-content.active {
    display: block;
}

/* ========== AGF TABLARI ========== */
.agf-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.agf-tab {
    flex: 1;
    padding: 14px 10px;
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    color: #666;
    cursor: pointer;
}

.agf-tab.active {
    background: #10b981;
    color: white;
}

.agf-content {
    display: none;
}

.agf-content.active {
    display: block;
}

/* ========== KOŞU TABLARI ========== */
.race-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 6px;
    background: #f8f9fa;
    border-radius: 6px;
}

.race-tab {
    flex: 1;
    min-width: 60px;
    padding: 10px 6px;
    background: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    color: #666;
    cursor: pointer;
}

.race-tab.active {
    background: #f59e0b;
    color: white;
}

.race-content {
    display: none;
}

.race-content.active {
    display: block;
}

/* ========== BİLGİ KUTULARI ========== */
.tjk-bet-info {
    background: #e0f2fe;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #0369a1;
    border-left: 3px solid #0ea5e9;
}

.tjk-coupled-info {
    background: #fef3c7;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #92400e;
    border-left: 3px solid #f59e0b;
}

/* ========== SIRALAMA KONTROL ========== */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
}

.sort-controls span {
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.sort-btn {
    padding: 8px 14px;
    background: white;
    border: 2px solid #e5e5e5;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn.active {
    background: #8B0000;
    color: white;
    border-color: #8B0000;
}

.sort-btn:active {
    transform: scale(0.95);
}

/* ========== 4 SÜTUNLU TABLO ========== */
.tjk-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
}

.tjk-table thead {
    background: #1f2937;
    color: white;
}

.tjk-table thead th {
    padding: 12px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.tjk-table thead th:nth-child(1) { width: 15%; }
.tjk-table thead th:nth-child(2) { width: 45%; }
.tjk-table thead th:nth-child(3) { width: 15%; }
.tjk-table thead th:nth-child(4) { width: 25%; }

.tjk-table tbody tr {
    border-bottom: 1px solid #e5e5e5;
    cursor: pointer;
    transition: background 0.2s;
}

.tjk-table tbody tr:hover {
    background: #f9fafb;
}

/* ✅ SEÇİLİ SATIR RENGİ: TATLI MAVİ */
.tjk-table tbody tr.selected {
    background: #dbeafe !important;
    border-left: 4px solid #3b82f6;
}

.tjk-table tbody td {
    padding: 14px 8px;
    font-size: 15px;
    text-align: center;
}

.tjk-table tbody td:nth-child(2) {
    text-align: left;
    padding-left: 12px;
}

/* ========== AT NO ========== */
.horse-no {
    font-weight: 700;
    color: #8B0000;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* ========== AT ADI ========== */
.horse-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
    line-height: 1.4;
}

/* ✅ KAZANAN KUPA İKONU ========== */
.winner-trophy {
    display: inline-block;
    margin-left: 6px;
    font-size: 16px;
    animation: trophy-shine 2s infinite;
}

@keyframes trophy-shine {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 3px #ffd700);
    }
    50% { 
        transform: scale(1.1);
        filter: drop-shadow(0 0 8px #ffd700);
    }
}

/* ========== AGF SIRASI ========== */
.agf-rank {
    font-weight: 600;
    font-size: 16px;
    color: #6b7280;
}

.rank-1 { 
    color: #000;
    font-weight: 900;
}

/* ========== AGF ORANI ========== */
.agf {
    font-weight: 900;
    color: #10b981;
    font-size: 18px;
}

/* ========== EKÜRİ BADGE ========== */
.coupled-badge {
    display: inline-block;
    background: #f59e0b;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.coupled-badge-0 { background: #f59e0b; }
.coupled-badge-1 { background: #8b5cf6; }
.coupled-badge-2 { background: #ec4899; }
.coupled-badge-3 { background: #06b6d4; }
.coupled-badge-4 { background: #10b981; }
.coupled-badge-5 { background: #ef4444; }

/* ========== EKÜRİ GRUBU GÖRSEL ========== */
.coupled-group-row {
    background: #fffbeb !important;
    border-left: 4px solid #f59e0b !important;
}

.coupled-group-row:hover {
    background: #fef3c7 !important;
}

/* ========== EKÜRİ AGF GÖSTERİMİ ========== */
.agf-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.coupled-individual-agf {
    font-size: 12px;
    color: #92400e;
    font-weight: 600;
}

.coupled-total-agf {
    font-size: 16px;
    color: #f59e0b;
    font-weight: 900;
}

/* ========== KOŞMAZ AT ========== */
.tjk-scratch-row {
    background: #fee2e2 !important;
    opacity: 0.7;
}

.tjk-scratch-row .horse-name {
    text-decoration: line-through;
    color: #991b1b;
}

.scratch-badge {
    display: inline-block;
    background: #dc2626;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

/* ========== ✅ İKİNCİ HESAPLA BUTONU (TABLO ALTINDA) ========== */
.calc-button-inline {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    margin: 15px 0;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    display: block;
}

.calc-button-inline:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.calc-button-inline:active {
    transform: scale(0.98);
}

/* ========== HESAPLA BUTONU (SABİT - SAYFANIN ALTINDA) ========== */
.calc-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: white;
    border: none;
    border-radius: 0;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(220, 38, 38, 0.4);
    display: block !important;
}

.calc-button:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.calc-button:active {
    transform: scale(0.98);
}

.selection-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #fbbf24;
    color: #000;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ========== SONUÇ MODALI ========== */
.result-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.result-modal.active {
    display: flex;
}

.result-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.result-header {
    background: #8B0000;
    color: white;
    padding: 16px;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.result-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
}

.result-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.result-race {
    margin-bottom: 20px;
    padding: 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #8B0000;
}

.result-race h4 {
    color: #1f2937;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
}

.calc-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
}

.calc-type-badge.normal {
    background: #10b981;
    color: white;
}

.calc-type-badge.coupled {
    background: #f59e0b;
    color: white;
}

.calc-type-badge.max-agf {
    background: #8b5cf6;
    color: white;
}

/* ========== SONUÇ HORSE LİSTESİ ========== */
.result-horses {
    list-style: none;
}

.result-horses li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 15px;
    position: relative;
}

.result-horses li:last-child {
    border-bottom: none;
}

.result-horses .horse-no {
    min-width: 40px;
    font-size: 16px;
    font-weight: 700;
    color: #8B0000;
}

.result-horses .horse-name {
    flex: 1;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.result-horses .horse-agf {
    font-weight: 700;
    color: #10b981;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== SONUÇ BİLGİ PANELİ ========== */
.result-info {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* ✅ DEVİR DURUMUNDA ÖZEL STİL (SADECE UYARI) ========== */
.result-info-devir {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    padding: 30px 20px;
}

/* ✅ DEVİR UYARISI ========== */
.devir-warning {
    background: white;
    border: 3px solid #f59e0b;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    animation: devir-pulse 2s infinite;
}

@keyframes devir-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    }
    50% { 
        transform: scale(1.03);
        box-shadow: 0 8px 24px rgba(245, 158, 11, 0.6);
    }
}

.devir-icon {
    font-size: 48px;
    animation: rotate-icon 3s linear infinite;
    flex-shrink: 0;
}

@keyframes rotate-icon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.devir-text {
    flex: 1;
    color: #92400e;
    font-size: 15px;
    line-height: 1.8;
}

.devir-text strong {
    font-size: 24px;
    color: #b45309;
    display: block;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.result-info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 15px;
    border-bottom: 1px solid #dee2e6;
}

.result-info-row span:first-child {
    color: #6b7280;
    font-weight: 600;
}

.result-info-row span:last-child {
    color: #1f2937;
    font-weight: 700;
}

/* ========== MOBİL OPTİMİZASYON ========== */
@media (max-width: 768px) {
    .tjk-app {
        padding: 8px;
        padding-bottom: 90px;
    }

    .city-tab {
        min-width: 70px;
        font-size: 13px;
        padding: 10px 4px;
    }

    .race-tab {
        min-width: 55px;
        font-size: 13px;
        padding: 8px 4px;
    }

    .tjk-table thead th {
        padding: 10px 4px;
        font-size: 11px;
    }

    .tjk-table tbody td {
        padding: 12px 4px;
        font-size: 14px;
    }

    .horse-no {
        font-size: 16px;
    }

    .horse-name {
        font-size: 13px;
    }

    .agf-rank {
        font-size: 14px;
    }

    .agf {
        font-size: 16px;
    }

    .calc-button {
        font-size: 18px;
        padding: 16px;
    }

    .calc-button-inline {
        font-size: 18px;
        padding: 16px;
    }
    
    .result-horses .horse-name {
        font-size: 13px;
    }
    
    .result-horses .horse-agf {
        font-size: 14px;
    }
    
    .winner-trophy {
        font-size: 14px;
    }
    
    .devir-warning {
        flex-direction: column;
        text-align: center;
        padding: 16px;
        gap: 12px;
    }
    
    .devir-icon {
        font-size: 36px;
    }
    
    .devir-text {
        font-size: 14px;
    }
    
    .devir-text strong {
        font-size: 20px;
    }
    
    .result-info-devir {
        padding: 20px 15px;
    }
}

/* ========== KÜÇÜK MOBİL ========== */
@media (max-width: 480px) {
    .tjk-table thead th {
        padding: 8px 3px;
        font-size: 10px;
    }

    .tjk-table tbody td {
        padding: 10px 3px;
        font-size: 13px;
    }

    .horse-no {
        font-size: 15px;
    }

    .horse-name {
        font-size: 12px;
    }

    .agf-rank {
        font-size: 13px;
    }

    .agf {
        font-size: 15px;
    }
    
    .result-horses .horse-no {
        min-width: 35px;
        font-size: 14px;
    }
    
    .result-horses .horse-name {
        font-size: 12px;
    }
    
    .result-horses .horse-agf {
        font-size: 13px;
    }
    
    .winner-trophy {
        font-size: 13px;
        margin-left: 4px;
    }
}