/* assets/css/match_detail.css */

/* =======================================================================
   1. SPECIFIC LAYOUT & CARDS
   ======================================================================= */
.card {
    background: #0f172a; 
    border: 1px solid rgba(16, 185, 129, 0.3); 
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.1); 
    border-radius: 12px;
    padding: 0; 
    overflow: hidden;
    position: relative;
    margin-bottom: 30px;
}

.card-header { 
    background: rgba(255,255,255,0.03); 
    padding: 12px 20px; 
    border-bottom: 1px solid var(--border); 
    font-size: 0.85rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    color: var(--text-muted); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    letter-spacing: 1px;
    border-top: 1px solid var(--border);
}
.card-header:first-child { border-top: none; }

/* =======================================================================
   2. HERO & SCOREBOARD
   ======================================================================= */
.match-hero { 
    padding: 40px 20px; 
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.1) 0%, rgba(15, 23, 42, 0.0) 70%); 
    text-align: center; 
    border-bottom: 1px solid var(--border); 
}

.score-board { 
    display: flex; 
    align-items: flex-start; 
    justify-content: center; 
    gap: 15px; 
}

.sb-team-col { 
    width: 140px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 10px; 
}

.sb-name-chip { 
    font-weight: 800; 
    font-size: 0.9rem; 
    line-height: 1.2; 
    text-align: center; 
    padding: 8px 12px; 
    border-radius: 8px; 
    width: 100%; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); 
    border: 1px solid rgba(255,255,255,0.2); 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    background-color: #334155; /* Fallback */
    color: #fff;
}

.score-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 5px;
}

.sb-score { 
    font-size: 3.5rem; 
    font-weight: 800; 
    letter-spacing: -2px; 
    line-height: 1; 
    color: var(--text-main); 
    text-shadow: 0 0 30px rgba(255,255,255,0.1);
}

.match-meta { 
    margin-top: 15px; 
    display: flex; 
    flex-direction: column; 
    gap: 4px;
    font-size: 0.85rem; 
    color: var(--text-muted); 
    font-weight: 500; 
}

@keyframes text-pulse-red { 
    0% { opacity: 1; text-shadow: 0 0 10px rgba(239, 68, 68, 0.8); } 
    50% { opacity: 0.6; text-shadow: 0 0 0 rgba(239, 68, 68, 0); } 
    100% { opacity: 1; text-shadow: 0 0 10px rgba(239, 68, 68, 0.8); } 
}
.live-text-pulse {
    color: #ef4444; 
    font-weight: 900; 
    letter-spacing: 2px;
    animation: text-pulse-red 1.5s infinite; 
    text-transform: uppercase; 
    font-size: 14px; 
    margin-top: 5px;
}

/* =======================================================================
   3. GOALS & EVENTS
   ======================================================================= */
.match-goals-timeline {
    width: 100%;
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px;
    box-sizing: border-box;
}

.goal-row {
    display: flex;
    align-items: center;
    width: 100%;
    font-size: 0.95rem;
    font-weight: 700;
    color: #4ade80; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.goal-row.home { justify-content: flex-start; text-align: left; }
.goal-row.away { justify-content: flex-end; text-align: right; }

.g-time {
    font-family: 'Courier New', monospace; 
    font-weight: 700;
    font-size: 0.9rem;
    opacity: 0.9;
    min-width: 40px;
    text-align: center;
    color: #fff;
}

.g-icon {
    font-size: 1.1rem;
    color: #4ade80; 
    margin: 0 10px;
    display: flex;
    align-items: center;
    filter: drop-shadow(0 0 5px rgba(74, 222, 128, 0.4));
}

.g-name { color: #4ade80; }
.g-assist { color: #94a3b8; font-weight: 400; font-size: 0.85em; margin: 0 6px; }

/* =======================================================================
   4. PITCH / SPIELFELD
   ======================================================================= */
.pitch-container {
    position: relative;
    width: 100%;
    height: 480px; 
    /* Grass Texture Effect */
    background: 
        linear-gradient(rgba(0,0,0,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.1) 1px, transparent 1px),
        linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    background-size: 20px 20px, 20px 20px, 100% 100%;
    
    border-radius: 8px;
    border: 3px solid rgba(255,255,255,0.15);
    margin: 0 0 20px 0;
    overflow: hidden;
    display: flex;
}

.pitch-lines { position: absolute; top: 12px; left: 12px; right: 12px; bottom: 12px; border: 2px solid rgba(255,255,255,0.3); pointer-events: none; }
.pitch-half-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: rgba(255,255,255,0.3); transform: translateX(-50%); }
.pitch-circle { position: absolute; top: 50%; left: 50%; width: 100px; height: 100px; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; transform: translate(-50%, -50%); }
.pitch-box-left { position: absolute; top: 25%; bottom: 25%; left: 0; width: 8%; border: 2px solid rgba(255,255,255,0.3); border-left: none; }
.pitch-box-right { position: absolute; top: 25%; bottom: 25%; right: 0; width: 8%; border: 2px solid rgba(255,255,255,0.3); border-right: none; }

.pitch-team-area { flex: 1; position: relative; height: 100%; }

.pitch-player {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    cursor: pointer;
    z-index: 10;
    width: 80px;
    transition: transform 0.2s;
    /* DESKTOP: X = Left, Y = Top */
    left: var(--x);
    top: var(--y);
}
.pitch-player:hover { transform: translate(-50%, -50%) scale(1.15); z-index: 20; }

.pp-dot {
    width: 32px; height: 32px; border-radius: 50%; margin: 0 auto 3px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #fff;
    box-shadow: 0 3px 6px rgba(0,0,0,0.5);
    border: 2px solid #fff;
}
.pp-name {
    font-size: 11px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    background: rgba(0,0,0,0.6); padding: 2px 6px; border-radius: 4px;
    display: inline-block; max-width: 100%;
}

/* =======================================================================
   5. SPLIT LAYOUT & MOMENTUM
   ======================================================================= */
.split-container { display: flex; }
.split-card { flex: 1; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.split-card.home { border-right: 1px solid var(--border); background: linear-gradient(to bottom, rgba(255,255,255,0.02), transparent); }
.split-card.away { background: linear-gradient(to bottom, rgba(255,255,255,0.02), transparent); }

.split-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--primary); font-weight: 800; margin-bottom: 5px; }
.split-name { font-size: 1.1rem; font-weight: 800; text-align: center; color: var(--text-main); margin-bottom: 5px; }

.big-rating-box { 
    width: 50px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; 
    font-weight: 800; font-size: 1.4rem; color: #fff; border: 1px solid rgba(255,255,255,0.1); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); margin: 5px 0 10px 0; 
}

/* Momentum / Dominance Bars */
.momentum-section { padding: 20px; }
.mom-row { display: flex; flex-direction: column; margin-bottom: 15px; }
.mom-label { text-align: center; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; font-weight:700; letter-spacing:1px; }
.mom-bar-wrap { display: flex; height: 24px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); }
.mom-bar-home { height: 100%; display: flex; align-items: center; justify-content: flex-start; padding-left: 8px; font-size: 0.75rem; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); transition: width 1s ease-in-out; }
.mom-bar-away { height: 100%; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 0.75rem; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); transition: width 1s ease-in-out; }

/* =======================================================================
   6. OFFIZIELLE & TIMELINE
   ======================================================================= */
.off-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.off-row:last-child { border-bottom: none; }
.off-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 2px; color: #fff; }
.off-role { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.timeline-container { padding: 30px 10px; position: relative; background: #0f172a; }
.timeline-container::before { content:''; position: absolute; left: 50%; top: 20px; bottom: 20px; width: 2px; background: var(--border); transform: translateX(-50%); }

.event-row { display: flex; align-items: center; margin-bottom: 25px; position: relative; width: 100%; }
.event-time-badge { position: absolute; left: 50%; transform: translateX(-50%); background: var(--bg-dark); border: 2px solid var(--border); color: var(--text-muted); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 800; z-index: 2; }
.event-content { width: 42%; display: flex; align-items: center; gap: 12px; font-size: 0.9rem; font-weight: 500; }
.event-content.home { margin-right: auto; justify-content: flex-end; text-align: right; }
.event-content.away { margin-left: auto; justify-content: flex-start; text-align: left; }

.timeline-separator { display: flex; align-items: center; justify-content: center; margin: 30px 0; position: relative; width: 100%; z-index: 2; }
.ht-badge { background: var(--bg-dark); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; font-weight: 700; padding: 6px 16px; border-radius: 20px; text-transform: uppercase; letter-spacing: 1px; }

.goal-pill { border: 1px solid var(--primary); color: var(--primary); padding: 1px 6px; border-radius: 4px; font-weight: 700; font-size: 0.85rem; }
.sub-text { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 2px; font-weight: 400; }
.card-icon { width: 12px; height: 16px; border-radius: 2px; display: inline-block; vertical-align: middle; box-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.card-icon.yellow { background: var(--warning); }
.card-icon.red { background: var(--danger); }

/* =======================================================================
   7. LISTS
   ======================================================================= */
.stat-row { display: flex; align-items: center; padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 0.85rem; }
.stat-row:last-child { border-bottom: none; }
.stat-val { width: 40px; text-align: center; font-weight: 800; font-size: 1rem; color: #fff; }
.stat-bar-container { flex: 1; display: flex; align-items: center; gap: 10px; margin: 0 20px; height: 100%; }
.bar { flex: 1; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; position: relative; overflow: hidden; }
.bar-fill { height: 100%; display: block; border-radius: 4px; }
.bar-fill.home { background-color: var(--primary); margin-left: auto; }
.bar-fill.away { background-color: var(--accent-blue); }
.stat-label { width: 120px; text-align: center; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; }

.lineups-grid { display: grid; grid-template-columns: 1fr 1fr; position: relative; }
.lineups-grid::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border); transform: translateX(-50%); }
.team-section h4 { text-align: center; font-size: 0.9rem; text-transform: uppercase; color: #fff; margin: 20px 0 15px 0; font-weight: 800; letter-spacing: 0.5px; }
.section-separator { background: rgba(255,255,255,0.05); color: var(--text-muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; text-align: center; padding: 8px 0; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); }

.player-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 15px; border-bottom: 1px solid var(--border); min-height: 52px; }
.player-row:last-child { border-bottom: none; }
.p-left-group { display: flex; align-items: center; gap: 15px; height: 100%; }
.kit { color: var(--text-muted); font-size: 0.9rem; width: 24px; text-align: center; font-weight: 700; font-family: monospace; }
.p-info { display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.name { font-weight: 600; font-size: 0.95rem; line-height: 1.1; color: #f1f5f9; }
.captain-c { color: var(--warning); font-weight: 900; font-size: 0.75rem; margin-left: 5px; cursor: help; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.badge-mini { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; background: var(--border); color: var(--text-muted); line-height: 1; cursor: help; }
.badge-mini.success { background: rgba(16, 185, 129, 0.15); color: var(--primary); }
.badge-mini.danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-mini:hover { filter: brightness(1.2); }

.rating-box { width: 34px; height: 30px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; color: #fff; border: 1px solid rgba(255,255,255,0.1); background: #334155; }

/* Perfect 10 Animation */
@keyframes rainbow-border {
    0% { border-color: #ef4444; box-shadow: 0 0 10px #ef4444; }
    25% { border-color: #eab308; box-shadow: 0 0 10px #eab308; }
    50% { border-color: #22c55e; box-shadow: 0 0 10px #22c55e; }
    75% { border-color: #3b82f6; box-shadow: 0 0 10px #3b82f6; }
    100% { border-color: #a855f7; box-shadow: 0 0 10px #a855f7; }
}
.perfect-10 { background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%) !important; animation: rainbow-border 4s linear infinite; font-weight: 900; letter-spacing: -1px; }

/* =======================================================================
   8. MODAL
   ======================================================================= */
.player-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); z-index: 9999; backdrop-filter: blur(8px); align-items: center; justify-content: center; }
.player-modal { background: #0f172a; border: 1px solid #1e293b; border-radius: 16px; width: 90%; max-width: 450px; padding: 0; position: relative; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5); overflow: hidden; animation: modalFadeIn 0.2s ease-out; }
@keyframes modalFadeIn { from {opacity: 0; transform: scale(0.95);} to {opacity: 1; transform: scale(1);} }
.pm-header { padding: 25px 20px; text-align: center; color: #fff; position: relative; }
.pm-close { position: absolute; top: 15px; right: 15px; background: rgba(0,0,0,0.2); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.pm-close:hover { background: rgba(0,0,0,0.4); }
.pm-kit { font-size: 40px; font-weight: 900; opacity: 0.2; position: absolute; top: 10px; left: 20px; font-family: sans-serif; }
.pm-name { font-size: 24px; font-weight: 700; margin-bottom: 8px; text-shadow: 0 2px 4px rgba(0,0,0,0.3); line-height: 1.2; }
.pm-meta { display: flex; justify-content: center; gap: 15px; font-size: 14px; opacity: 0.95; align-items: center; flex-wrap: wrap; }
.pm-flag { height: 14px; width: auto; border-radius: 2px; vertical-align: middle; margin-right: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.pm-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.pm-ratings-row { display: flex; justify-content: space-between; margin-bottom: 20px; background: #020617; padding: 15px; border-radius: 12px; border: 1px solid #1e293b; }
.pm-rating-box { text-align: center; flex: 1; }
.pm-rb-label { font-size: 10px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.5px; margin-bottom: 5px; font-weight: 600; }
.pm-rb-val { font-size: 18px; font-weight: 700; color: #f8fafc; }
.pm-stars { color: #f59e0b; font-size: 11px; }
.pm-medals { color: #8b5cf6; font-size: 12px; }
.pm-section-title { font-size: 12px; text-transform: uppercase; color: #94a3b8; font-weight: 700; margin-bottom: 10px; margin-top: 15px; letter-spacing: 0.5px; }
.pm-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pm-stat-item { background: #020617; padding: 12px 15px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; border: 1px solid #1e293b; }
.pm-stat-label { font-size: 13px; color: #94a3b8; }
.pm-stat-val { font-size: 14px; font-weight: 700; color: #f8fafc; }

/* =======================================================================
   9. RESPONSIVE (MOBILE PITCH ROTATION)
   ======================================================================= */
@media (max-width: 900px) {
    .score-board { gap: 10px; }
    .sb-team-col { width: 100px; }
    .sb-name-chip { font-size: 0.75rem; padding: 5px 8px; }
    .sb-score { font-size: 2.5rem; }
    
    .lineups-grid { grid-template-columns: 1fr; }
    .lineups-grid::after { display: none; }
    
    .split-container { flex-direction: column; }
    .split-card.home { border-right: none; border-bottom: 1px solid var(--border); }
    
    .stat-bar-container { flex-direction: column; gap: 4px; align-items: stretch; margin: 0 10px; height: auto; }
    .bar { height: 6px; }
    .stat-label { width: auto; padding: 4px 0; }
    
    .event-content { width: 40%; font-size: 0.8rem; }
    .goal-row { font-size: 0.85rem; }

    /* --- MOBILE PITCH STYLES --- */
    .pitch-container {
        height: 720px; /* Mehr Höhe für vertikale Ansicht */
        flex-direction: column;
    }
    
    /* Rotate Lines */
    .pitch-half-line {
        top: 50%; left: 0; right: 0; width: auto; height: 2px; transform: none;
    }
    /* Home Goal (Bottom) */
    .pitch-box-left { 
        left: 20%; width: 60%; height: 6%; 
        top: auto; bottom: 0; 
        border: 2px solid rgba(255,255,255,0.3); border-bottom: none; border-left: 2px solid rgba(255,255,255,0.3);
    }
    /* Away Goal (Top) */
    .pitch-box-right { 
        left: 20%; width: 60%; height: 6%; 
        top: 0; bottom: auto; 
        border: 2px solid rgba(255,255,255,0.3); border-top: none; border-right: 2px solid rgba(255,255,255,0.3);
    }

    /* MAPPING CSS VARS (Rotation) */
    .pitch-player {
        /* Desktop X (0=Left, 100=Right) 
           Desktop Y (0=Top, 100=Bottom)
           
           Mobile Wunsch:
           Home (X=High) -> Bottom (Y=High)
           Away (X=Low) -> Top (Y=Low)
           
           Also: top = var(--x)
           Und left = var(--y)
        */
        left: var(--y) !important;
        top: var(--x) !important;
        
        width: 60px; 
    }
    
    .pp-dot { 
        width: 24px; height: 24px; font-size: 10px; 
        margin-bottom: 2px; 
        box-shadow: 0 2px 4px rgba(0,0,0,0.6);
    }
    .pp-name { 
        font-size: 9px; padding: 1px 4px; 
        line-height: 1.1;
        background: rgba(0,0,0,0.7);
    }
}