/**
 * css/tournament-match-history-critical.css - Kritische Match History Styles
 * Pfad: /css/tournament-match-history-critical.css
 * 
 * Funktionen:
 * - KRITISCHE Styles für Match History Timeline
 * - Goldene/Silberne/Bronze Hervorhebungen für Platz 1, 2, 3
 * - Bootstrap-optimierte Team Badges
 * - Timeline mit visuellen Verbindungen
 * - Responsive Grid-Layout
 * 
 * WICHTIG: Diese Datei MUSS NACH Bootstrap und allen anderen CSS-Dateien geladen werden!
 */

/* ==========================================
   MATCH HISTORY CONTAINER & TIMELINE
   ========================================== */

.match-history-container {
    background: linear-gradient(135deg, #ffffff, #f8f9ff);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    margin: 2rem 0;
    padding: 0;
    overflow: hidden;
    position: relative;
}

.match-history-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--tennis-blue), var(--gold), var(--tennis-blue));
    z-index: 1;
}

.match-timeline {
    padding: 2rem;
    position: relative;
}

.match-timeline::before {
    content: '';
    position: absolute;
    left: 50px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--tennis-blue), var(--gold), var(--tennis-blue));
    border-radius: 2px;
    z-index: 1;
}

.time-slot {
    margin-bottom: 3rem;
    position: relative;
    z-index: 2;
}

.time-slot:last-child {
    margin-bottom: 0;
}

/* ==========================================
   TIME HEADER MIT TIMELINE-PUNKT
   ========================================== */

.time-header {
    position: relative;
    margin-bottom: 1.5rem;
    padding-left: 80px;
}

.time-header::before {
    content: '';
    position: absolute;
    left: 34px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--tennis-blue), var(--tennis-blue-dark));
    border: 6px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--tennis-blue-light), 0 4px 15px rgba(0,0,0,0.2);
    z-index: 3;
}

.time-header h4 {
    margin: 0;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--tennis-blue), var(--tennis-blue-dark));
    color: white;
    border-radius: 15px;
    font-size: 1.4rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(59, 130, 196, 0.3);
    position: relative;
}

.time-header h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), #ffed4e, var(--gold));
}

.time-header i {
    margin-right: 0.75rem;
    color: var(--gold);
    font-size: 1.2rem;
}

/* ==========================================
   MATCHES GRID (BOOTSTRAP OPTIMIERT)
   ========================================== */

.matches-in-slot {
    padding-left: 80px;
}

/* Bootstrap Grid für Match Cards verwenden */
.matches-in-slot .row {
    margin: 0;
}

.matches-in-slot .col-lg-6 {
    padding: 0.75rem;
}

/* ==========================================
   MATCH HISTORY CARDS
   ========================================== */

.match-history-card {
    background: linear-gradient(135deg, #ffffff, #fafbff);
    border: 3px solid #e9ecef;
    border-radius: 15px;
    padding: 1.5rem;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    height: 100%;
}

.match-history-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: #e9ecef;
    transition: all 0.4s ease;
}

.match-history-card:hover {
    border-color: var(--gold);
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(255, 215, 0, 0.4);
}

.match-history-card:hover::before {
    background: linear-gradient(90deg, var(--gold), #ffed4e);
}

.match-history-card.finished {
    border-color: #28a745;
    background: linear-gradient(135deg, #ffffff, #f0fff4);
}

.match-history-card.finished::before {
    background: linear-gradient(90deg, #28a745, var(--gold));
}

.match-history-card.pending {
    border-color: #ffc107;
    background: linear-gradient(135deg, #ffffff, #fffef7);
}

.match-history-card.pending::before {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

/* ==========================================
   MATCH CARD COMPONENTS
   ========================================== */

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.match-number {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--tennis-blue-dark);
    background: var(--tennis-blue-light);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 2px solid var(--tennis-blue);
}

.court-info {
    background: linear-gradient(135deg, var(--tennis-blue), var(--tennis-blue-dark));
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(59, 130, 196, 0.3);
}

.match-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin: 1.5rem 0;
}

.team-side {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.4s ease;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ==========================================
   GEWINNER HERVORHEBUNGEN (PLATZ 1, 2, 3)
   ========================================== */

/* PLATZ 1 - GOLDENE HERVORHEBUNG */
.team-side.winner {
    background: linear-gradient(135deg, var(--gold), #ffed4e) !important;
    border: 4px solid var(--gold) !important;
    color: #8b6914 !important;
    transform: scale(1.08) !important;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4) !important;
    font-weight: bold !important;
    position: relative;
    z-index: 5;
}

.team-side.winner::before {
    content: '👑';
    position: absolute;
    top: -15px;
    right: -10px;
    font-size: 2rem;
    z-index: 10;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.team-side.winner::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, var(--gold), #ffed4e, var(--gold));
    border-radius: 15px;
    z-index: -1;
    animation: golden-pulse 3s infinite;
}

@keyframes golden-pulse {
    0%, 100% { 
        opacity: 0.8;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.02);
    }
}

/* PLATZ 2 - SILBERNE HERVORHEBUNG */
.team-side.place-2 {
    background: linear-gradient(135deg, var(--silver), #e8e8e8) !important;
    border: 3px solid var(--silver) !important;
    color: #555 !important;
    transform: scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(192, 192, 192, 0.4) !important;
    font-weight: bold !important;
}

.team-side.place-2::before {
    content: '🥈';
    position: absolute;
    top: -12px;
    right: -8px;
    font-size: 1.8rem;
    z-index: 10;
}

/* PLATZ 3 - BRONZE HERVORHEBUNG */
.team-side.place-3 {
    background: linear-gradient(135deg, var(--bronze), #daa520) !important;
    border: 3px solid var(--bronze) !important;
    color: #5d4e00 !important;
    transform: scale(1.03) !important;
    box-shadow: 0 5px 18px rgba(205, 127, 50, 0.4) !important;
    font-weight: bold !important;
}

.team-side.place-3::before {
    content: '🥉';
    position: absolute;
    top: -12px;
    right: -8px;
    font-size: 1.8rem;
    z-index: 10;
}

/* MATCH WINNER (nur für einzelnes Match) */
.team-side.match-winner {
    background: linear-gradient(135deg, #d4edda, #e8f5e9) !important;
    border: 2px solid #28a745 !important;
    transform: scale(1.05) !important;
}

/* UNENTSCHIEDEN */
.team-side.draw {
    background: linear-gradient(135deg, #fff3cd, #ffeeba) !important;
    border: 2px solid #ffc107 !important;
    color: #856404 !important;
    transform: scale(1.02) !important;
}

/* ==========================================
   VS SECTION & SCORE DISPLAY
   ========================================== */

.vs-section {
    text-align: center;
    position: relative;
    z-index: 5;
}

.vs-text {
    font-weight: bold;
    font-size: 1.3rem;
    color: var(--tennis-blue);
    background: white;
    padding: 0.75rem;
    border-radius: 50%;
    border: 3px solid var(--gold);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.score-display {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 25px;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    position: relative;
}

.score-display::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #28a745, var(--gold), #28a745);
    border-radius: 27px;
    z-index: -1;
}

.score-large {
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* ==========================================
   BOOTSTRAP-OPTIMIERTE TEAM BADGES
   ========================================== */

/* Verwende Bootstrap Badge-Klassen als Basis */
.team-badge {
    margin-bottom: 0.5rem;
    font-size: 1rem !important;
    padding: 0.6rem 1.2rem !important;
    border-radius: 25px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15) !important;
    border: 2px solid !important;
    display: inline-block !important;
}

.team-badge:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25) !important;
    text-decoration: none !important;
}

/* Spieler-Names mit Bootstrap Small-Klasse */
.players-badge {
    font-style: italic;
    color: #666;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    display: block;
}

/* ==========================================
   MATCH STATUS BADGES (BOOTSTRAP)
   ========================================== */

.match-status {
    text-align: center;
    margin-top: 1.5rem;
}

.match-status .badge {
    font-size: 1rem !important;
    padding: 0.6rem 1.2rem !important;
    border-radius: 25px !important;
    font-weight: 600 !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2) !important;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

/* Tablet Landscape (1024px and down) */
@media (max-width: 1024px) {
    .matches-in-slot {
        padding-left: 70px;
    }
    
    .match-timeline::before {
        left: 40px;
    }
    
    .time-header {
        padding-left: 70px;
    }
    
    .time-header::before {
        left: 24px;
        width: 28px;
        height: 28px;
    }
    
    .match-history-card {
        padding: 1.25rem;
    }
    
    .score-large {
        font-size: 1.6rem;
    }
}

/* Tablet Portrait (768px and down) */
@media (max-width: 768px) {
    .match-timeline {
        padding: 1.5rem;
    }
    
    .match-timeline::before {
        left: 25px;
        width: 3px;
    }
    
    .time-header {
        padding-left: 55px;
    }
    
    .time-header::before {
        left: 11px;
        width: 24px;
        height: 24px;
        border-width: 4px;
    }
    
    .time-header h4 {
        font-size: 1.2rem;
        padding: 0.75rem 1.5rem;
    }
    
    .matches-in-slot {
        padding-left: 55px;
    }
    
    /* Verwende Bootstrap Klassen für Mobile */
    .matches-in-slot .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .match-teams {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .vs-section {
        order: -1;
        margin-bottom: 1rem;
    }
    
    .vs-text {
        width: 60px;
        height: 60px;
        font-size: 1.2rem;
    }
    
    .team-side {
        padding: 1rem;
        min-height: 100px;
    }
    
    .team-badge {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.8rem !important;
    }
    
    .score-large {
        font-size: 1.4rem;
    }
}

/* Mobile (480px and down) */
@media (max-width: 480px) {
    .match-history-container {
        margin: 1rem -15px;
        border-radius: 0;
    }
    
    .match-timeline {
        padding: 1rem;
    }
    
    .match-timeline::before {
        left: 15px;
    }
    
    .time-header {
        padding-left: 45px;
    }
    
    .time-header::before {
        left: 3px;
        width: 20px;
        height: 20px;
    }
    
    .time-header h4 {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    
    .matches-in-slot {
        padding-left: 45px;
    }
    
    .match-history-card {
        padding: 1rem;
        border-radius: 10px;
    }
    
    .match-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .match-number {
        font-size: 1rem;
        padding: 0.4rem 0.8rem;
    }
    
    .court-info {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }
    
    .team-side {
        padding: 0.75rem;
        min-height: 80px;
    }
    
    .team-badge {
        font-size: 0.75rem !important;
        padding: 0.3rem 0.6rem !important;
        margin: 0.1rem !important;
    }
    
    .vs-text {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    
    .score-large {
        font-size: 1.2rem;
    }
    
    .team-side.winner::before,
    .team-side.place-2::before,
    .team-side.place-3::before {
        font-size: 1.5rem;
        top: -10px;
        right: -5px;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .match-history-container {
        box-shadow: none;
        border: 2px solid #333;
        page-break-inside: avoid;
        background: white !important;
    }
    
    .match-history-container::before {
        display: none;
    }
    
    .match-timeline::before {
        background: #333 !important;
    }
    
    .time-header h4 {
        background: #f8f9fa !important;
        color: #333 !important;
        border: 1px solid #333;
    }
    
    .time-header::before {
        background: #333 !important;
        border-color: white !important;
    }
    
    .match-history-card {
        border: 2px solid #333 !important;
        box-shadow: none;
        background: white !important;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .team-side.winner {
        background: #f0f0f0 !important;
        border: 3px solid #333 !important;
        color: #000 !important;
    }
    
    .team-side.winner::before {
        content: '[1.] ';
        font-size: 1rem;
        position: static;
    }
    
    .team-side.place-2::before {
        content: '[2.] ';
        font-size: 1rem;
        position: static;
    }
    
    .team-side.place-3::before {
        content: '[3.] ';
        font-size: 1rem;
        position: static;
    }
    
    .score-display {
        background: #f8f9fa !important;
        color: #333 !important;
        border: 1px solid #333;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .match-history-card,
    .team-badge,
    .team-side {
        transition: none;
    }
    
    .match-history-card:hover,
    .team-badge:hover {
        transform: none;
    }
    
    .team-side.winner::after {
        animation: none;
    }
    
    .golden-pulse {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .match-history-card {
        border-width: 4px;
    }
    
    .team-badge {
        border-width: 3px;
        font-weight: bold;
    }
    
    .team-side.winner {
        border-width: 5px;
        font-weight: bold;
    }
    
    .score-display {
        background: #000 !important;
        color: #fff !important;
    }
}

/* Focus states für Tastatur-Navigation */
.match-history-card:focus,
.team-badge:focus {
    outline: 4px solid var(--gold);
    outline-offset: 2px;
}

/* Hover-Effekte für Touch-Geräte deaktivieren */
@media (hover: none) and (pointer: coarse) {
    .match-history-card:hover,
    .team-badge:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
}