/**
 * HVA Match Statistics - Stylesheet
 * Theme: Dark/Gold/Compact
 */

:root {
    --primary-dark: #1a1a1a;
    --secondary-dark: #2d2d2d;
    --tertiary-dark: #3a3a3a;
    --gold: #d4af37;
    --gold-light: #f4d03f;
    --gold-dark: #b8941e;
    --text-light: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #404040;
    --success: #2ecc71;
    --warning: #e74c3c;
    --info: #3498db;
}

.hva-match-stats-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    background: var(--primary-dark);
    color: var(--text-light);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* File Selector */
.hva-file-selector {
    background: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.hva-file-selector h3 {
    color: var(--gold);
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hva-file-select-wrapper {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hva-file-select-wrapper select {
    flex: 1;
    min-width: 250px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95em;
    background-color: var(--tertiary-dark);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hva-file-select-wrapper select:hover {
    border-color: var(--gold);
}

.hva-file-select-wrapper select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.hva-load-button {
    padding: 10px 24px;
    background: var(--gold);
    color: var(--primary-dark);
    border: none;
    border-radius: 4px;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hva-load-button:hover {
    background: var(--gold-light);
    transform: translateY(-1px);
}

.hva-load-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading Spinner */
.hva-loading {
    display: none;
    text-align: center;
    padding: 30px;
    background: var(--secondary-dark);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.hva-loading.active {
    display: block;
}

.hva-spinner {
    border: 3px solid var(--tertiary-dark);
    border-top: 3px solid var(--gold);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: hva-spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes hva-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.hva-error {
    background: var(--warning);
    color: white;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
    font-size: 0.95em;
}

.hva-error.active {
    display: block;
}

/* Stats Container */
.hva-stats-display {
    display: none;
}

.hva-stats-display.active {
    display: block;
}

/* Filter System */
.hva-filter-bar {
    background: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.hva-filter-label {
    color: var(--gold);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

.hva-filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hva-filter-btn {
    padding: 8px 20px;
    background: var(--tertiary-dark);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hva-filter-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.hva-filter-btn.active {
    background: var(--gold);
    color: var(--primary-dark);
    border-color: var(--gold);
}

/* Collapsible Sections */
.hva-collapsible-header {
    background: var(--secondary-dark);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s ease;
}

.hva-collapsible-header:hover {
    background: var(--tertiary-dark);
    border-color: var(--gold);
}

.hva-collapsible-header.collapsed {
    border-radius: 6px;
    margin-bottom: 12px;
}

.hva-collapsible-title {
    font-weight: 600;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hva-collapsible-arrow {
    color: var(--gold);
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.hva-collapsible-header.active .hva-collapsible-arrow {
    transform: rotate(180deg);
}

.hva-collapsible-content {
    display: none;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    margin-bottom: 12px;
    overflow: hidden;
}

.hva-collapsible-content.active {
    display: block;
}

/* Player Modal */
.hva-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: auto;
}

.hva-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hva-modal-content {
    background: var(--secondary-dark);
    border: 2px solid var(--gold);
    border-radius: 8px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.hva-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--text-muted);
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.hva-modal-close:hover {
    color: var(--gold);
}

.hva-modal-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.hva-modal-header h3 {
    color: var(--gold);
    font-size: 1.5em;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hva-modal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.hva-modal-stat {
    background: var(--tertiary-dark);
    padding: 15px;
    border-radius: 6px;
    border-left: 3px solid var(--gold);
    text-align: center;
}

.hva-modal-stat-label {
    font-size: 0.75em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.hva-modal-stat-value {
    font-size: 1.8em;
    color: var(--gold);
    font-weight: bold;
}

/* Shot Pattern Layout in Modal */
.hva-shot-pattern-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 15px;
}

.hva-shot-pattern-grid {
    flex-shrink: 0;
}

.hva-shot-pattern-legend {
    flex: 1;
    background: var(--tertiary-dark);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 600px) {
    .hva-shot-pattern-container {
        flex-direction: column;
    }
    
    .hva-shot-pattern-grid {
        width: 100%;
    }
    
    .hva-goal-grid {
        max-width: 100% !important;
    }
}

/* Charts */
.hva-chart-container {
    background: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.hva-chart-wrapper {
    position: relative;
    height: 300px;
    margin-top: 15px;
}

.hva-chart-wrapper.large {
    height: 400px;
}

.hva-chart-wrapper canvas {
    max-height: 100%;
}

.hva-chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.hva-chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.hva-chart-legend-color {
    width: 20px;
    height: 12px;
    border-radius: 2px;
}

.hva-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* Momentum Bar */
.hva-momentum-bar {
    height: 40px;
    background: var(--tertiary-dark);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    margin: 15px 0;
}

.hva-momentum-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: bold;
    color: var(--primary-dark);
    transition: all 0.3s ease;
}

.hva-momentum-segment:hover {
    opacity: 0.8;
}

.hva-momentum-home {
    background: var(--gold);
}

.hva-momentum-away {
    background: var(--text-light);
}

.hva-momentum-neutral {
    background: var(--text-muted);
}

/* Activity Bars */
.hva-activity-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.hva-activity-label {
    min-width: 80px;
    font-size: 0.9em;
    color: var(--text-light);
}

.hva-activity-bar-fill {
    flex: 1;
    height: 30px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-weight: bold;
    color: var(--primary-dark);
    transition: width 0.5s ease;
}

/* Timeline Events Visual */
.hva-event-timeline {
    height: 60px;
    background: var(--tertiary-dark);
    border-radius: 6px;
    position: relative;
    margin: 15px 0;
    overflow: hidden;
}

.hva-event-marker {
    position: absolute;
    width: 4px;
    height: 100%;
    background: var(--gold);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hva-event-marker:hover {
    width: 6px;
    background: var(--gold-light);
}

.hva-event-marker.goal {
    background: var(--gold);
}

.hva-event-marker.card {
    background: #f39c12;
}

.hva-event-marker.techfout {
    background: var(--warning);
}

.hva-event-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary-dark);
    border: 1px solid var(--gold);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    margin-bottom: 5px;
}

.hva-event-marker:hover .hva-event-tooltip {
    opacity: 1;
}

/* Match Header - Compact */
.hva-match-header {
    background: var(--secondary-dark);
    border: 2px solid var(--gold);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.hva-match-header h2 {
    font-size: 1.6em;
    margin: 0 0 10px 0;
    color: var(--gold);
    font-weight: 700;
}

.hva-match-score {
    font-size: 3em;
    font-weight: bold;
    margin: 10px 0;
    color: var(--text-light);
}

.hva-match-header p {
    font-size: 0.9em;
    color: var(--text-muted);
    margin: 3px 0;
}

/* Stats Grid - Compact */
.hva-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.hva-stat-card {
    background: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--gold);
    padding: 15px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.hva-stat-card:hover {
    border-left-color: var(--gold-light);
    transform: translateX(3px);
}

.hva-stat-card-clickable {
    cursor: pointer;
    position: relative;
}

.hva-stat-card-clickable::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.2s ease;
}

.hva-stat-card-clickable.active {
    border-color: var(--gold);
    border-left-width: 4px;
    background: var(--tertiary-dark);
    transform: translateX(5px);
}

.hva-stat-card-clickable.active::after {
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold);
}

.hva-stat-card-clickable:hover {
    border-color: var(--gold);
}

.hva-stat-card h3 {
    font-size: 0.75em;
    color: var(--text-muted);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.hva-stat-card .value {
    font-size: 2em;
    font-weight: bold;
    color: var(--gold);
    line-height: 1;
}

/* Section Headers */
.hva-section {
    margin-bottom: 20px;
}

.hva-section-title {
    color: var(--gold);
    margin: 0 0 12px 0;
    font-size: 1.2em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

/* Tables */
.hva-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--secondary-dark);
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.hva-table thead {
    background: var(--tertiary-dark);
}

.hva-table th {
    color: var(--gold);
    padding: 10px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gold);
}

.hva-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
}

.hva-table tr:last-child td {
    border-bottom: none;
}

.hva-table tr:hover {
    background: var(--tertiary-dark);
}

.hva-table td.center {
    text-align: center;
}

.hva-table td.right {
    text-align: right;
}

.hva-table .highlight-gold {
    color: var(--gold);
    font-weight: 700;
}

.hva-player-number {
    cursor: pointer;
    color: var(--gold);
    font-weight: 700;
    transition: all 0.2s ease;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.hva-player-number:hover {
    color: var(--gold-light);
    text-decoration-style: solid;
}

.hva-stat-note {
    font-size: 0.75em;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 5px;
}

/* Goal Grid Visualization */
.hva-goal-grid-container {
    background: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.hva-goal-grids {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 900px) {
    .hva-goal-grids {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

.hva-goal-grid-wrapper {
    text-align: center;
}

.hva-goal-grid-wrapper h4 {
    color: var(--gold);
    margin: 0 0 10px 0;
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hva-goal-grid-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.85em;
}

.hva-goal-grid-stat {
    color: var(--text-muted);
}

.hva-goal-grid-stat strong {
    color: var(--text-light);
}

.hva-goal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 280px;
    margin: 0 auto;
    background: var(--tertiary-dark);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.hva-goal-cell {
    aspect-ratio: 1;
    background: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1em;
    color: var(--text-muted);
    transition: all 0.2s ease;
    position: relative;
    padding: 5px;
}

.hva-goal-cell.has-goals {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: var(--primary-dark);
    border-color: var(--gold-light);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.hva-goal-cell.has-misses {
    background: linear-gradient(135deg, #5a5a5a, #7a7a7a);
    color: var(--text-light);
    border-color: var(--text-muted);
}

.hva-goal-cell .label {
    position: absolute;
    top: 3px;
    left: 5px;
    font-size: 0.65em;
    opacity: 0.5;
}

.hva-goal-cell .stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hva-goal-cell .goals {
    font-size: 1.6em;
    font-weight: 900;
}

.hva-goal-cell .misses {
    font-size: 0.8em;
    opacity: 0.8;
}

/* Collapsible Timeline */
.hva-timeline-toggle {
    background: var(--secondary-dark);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px;
    margin-bottom: 0;
    transition: all 0.2s ease;
}

.hva-timeline-toggle:hover {
    background: var(--tertiary-dark);
    border-color: var(--gold);
}

.hva-timeline-toggle-text {
    font-weight: 600;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hva-timeline-toggle-arrow {
    color: var(--gold);
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.hva-timeline-toggle.active .hva-timeline-toggle-arrow {
    transform: rotate(180deg);
}

.hva-timeline-content {
    display: none;
    background: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.hva-timeline-content.active {
    display: block;
}

/* Custom Scrollbar */
.hva-timeline-content::-webkit-scrollbar {
    width: 8px;
}

.hva-timeline-content::-webkit-scrollbar-track {
    background: var(--tertiary-dark);
}

.hva-timeline-content::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 4px;
}

.hva-timeline-content::-webkit-scrollbar-thumb:hover {
    background: var(--gold-light);
}

.hva-timeline-event {
    padding: 8px 12px;
    margin-bottom: 6px;
    border-left: 3px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.85em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.hva-timeline-event:hover {
    background: var(--tertiary-dark);
}

.hva-timeline-event.goal {
    border-left-color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
}

.hva-timeline-event.techfout {
    border-left-color: var(--warning);
    background: rgba(231, 76, 60, 0.05);
}

.hva-timeline-event.card {
    border-left-color: #f39c12;
    background: rgba(243, 156, 18, 0.05);
}

.hva-timeline-event.gemist {
    border-left-color: var(--text-muted);
}

.hva-timeline-event.sub {
    border-left-color: var(--info);
}

.hva-timeline-message {
    flex: 1;
    color: var(--text-light);
}

.hva-timeline-time {
    color: var(--text-muted);
    font-size: 0.9em;
    white-space: nowrap;
    margin-left: 10px;
    font-weight: 600;
}

/* Badge Styles */
.hva-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 5px;
}

.hva-badge-gold {
    background: var(--gold);
    color: var(--primary-dark);
}

.hva-badge-success {
    background: var(--success);
    color: white;
}

.hva-badge-warning {
    background: var(--warning);
    color: white;
}

.hva-badge-info {
    background: var(--info);
    color: white;
}

/* Efficiency Bar */
.hva-efficiency-bar {
    height: 6px;
    background: var(--tertiary-dark);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
}

.hva-efficiency-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
    transition: width 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hva-match-stats-container {
        padding: 10px;
    }
    
    .hva-file-select-wrapper {
        flex-direction: column;
    }
    
    .hva-file-select-wrapper select,
    .hva-load-button {
        width: 100%;
    }
    
    .hva-match-header h2 {
        font-size: 1.3em;
    }
    
    .hva-match-score {
        font-size: 2.5em;
    }
    
    .hva-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .hva-table {
        font-size: 0.8em;
    }
    
    .hva-table th,
    .hva-table td {
        padding: 8px 6px;
    }
    
    .hva-goal-grids {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hva-match-header {
        padding: 15px;
    }
    
    .hva-match-header h2 {
        font-size: 1.1em;
    }
    
    .hva-match-score {
        font-size: 2em;
    }
    
    .hva-stat-card .value {
        font-size: 1.8em;
    }
}
