/**
 * LiigaPredictor - Custom Styles
 * Version: 1.0
 * Date: 2025-10-25
 */

/* ============================================================================
 * Variables
 * ========================================================================= */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754; /* Bootstrap green - WCAG AA compliant */
    --success-text-color: #0d7a4a; /* Darker green for better contrast on white (5.2:1) */
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --dark-color: #212529;
    --light-gray: #f8f9fa;
}

/* ============================================================================
 * Global Styles
 * ========================================================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
}

/* ============================================================================
 * Navigation - Sticky
 * ========================================================================= */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Settings/gear icon styling */
.navbar .bi-gear-fill {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.navbar .bi-gear-fill:hover {
    transform: rotate(90deg);
}

/* User icon styling */
.navbar .bi-person-circle {
    font-size: 1.1rem;
}

/* ============================================================================
 * Hero Section
 * ========================================================================= */
.hero {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
 * Cards
 * ========================================================================= */
.card {
    border: none;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
}

/* ============================================================================
 * Tables
 * ========================================================================= */
#predictions-table tbody tr,
#teams-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#predictions-table tbody tr:hover,
#teams-table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    color: #6c757d;
}

/* ============================================================================
 * Prediction Styles
 * ========================================================================= */
.team-name {
    font-weight: 600;
    color: var(--dark-color);
}

.elo-rating {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.prediction-prob {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Better contrast for success text on white background */
.text-success {
    color: var(--success-text-color) !important;
}

/* Confidence-based winner styles */
/* High confidence = green background */
.prediction-winner.prediction-winner-high {
    background-color: rgba(25, 135, 84, 0.15);
    border-left: 4px solid #198754;
    padding: 8px;
    border-radius: 4px;
}

/* Medium confidence = yellow background */
.prediction-winner.prediction-winner-medium {
    background-color: rgba(255, 193, 7, 0.15);
    border-left: 4px solid #ffc107;
    padding: 8px;
    border-radius: 4px;
}

/* Low confidence = gray background */
.prediction-winner.prediction-winner-low {
    background-color: rgba(108, 117, 125, 0.12);
    border-left: 4px solid #6c757d;
    padding: 8px;
    border-radius: 4px;
}

.prediction-loser {
    opacity: 0.7;
}

/* ============================================================================
 * Badges
 * ========================================================================= */
.badge {
    padding: 0.5em 0.75em;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.confidence-high {
    background-color: var(--success-color) !important;
}

.confidence-medium {
    background-color: var(--warning-color) !important;
    color: #000 !important;
}

.confidence-low {
    background-color: #6c757d !important;
}

/* ============================================================================
 * Recent Form Display
 * ========================================================================= */
.recent-form-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    margin: 0 2px;
}

.form-w {
    background-color: var(--success-color);
    color: white;
}

.form-l {
    background-color: var(--danger-color);
    color: white;
}

.form-d {
    background-color: var(--warning-color);
    color: #000;
}

/* ============================================================================
 * Chart Styles
 * ========================================================================= */
#elo-chart {
    min-height: 300px;
    max-height: 400px;
}

#elo-comparison-chart {
    min-height: 300px;
    max-height: 500px;
}

/* Mobile chart adjustments */
@media (max-width: 768px) {
    #elo-chart,
    #elo-comparison-chart {
        min-height: 250px;
        max-height: 350px;
    }
}

@media (max-width: 576px) {
    #elo-chart,
    #elo-comparison-chart {
        min-height: 200px;
        max-height: 300px;
    }
}

/* ============================================================================
 * Team Checkbox Styles (Elo Comparison Page)
 * ========================================================================= */
.team-checkbox {
    cursor: pointer;
    padding: 8px 12px;
    margin: 4px;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    transition: all 0.2s;
}

.team-checkbox:hover {
    background-color: #f8f9fa;
}

.team-checkbox input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.team-checkbox.checked {
    border-color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
}

.quick-select-btn {
    margin: 4px;
}

/* ============================================================================
 * Loading & Error States
 * ========================================================================= */
#loading {
    min-height: 300px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* ============================================================================
 * Responsive Styles
 * ========================================================================= */
@media (max-width: 768px) {
    /* Hero section - smaller on tablets */
    .hero h1 {
        font-size: 2rem;
    }

    .hero .lead {
        font-size: 1rem;
    }

    .display-4 {
        font-size: 2.5rem;
    }

    .display-5 {
        font-size: 2rem;
    }

    .display-6 {
        font-size: 1.5rem;
    }

    /* Tables - more compact */
    .table {
        font-size: 0.875rem;
    }

    /* Hide Elo ratings on mobile for cleaner look */
    .elo-rating {
        display: none;
    }

    /* Card adjustments */
    .card-header h4,
    .card-header h5 {
        font-size: 1.1rem;
    }

    /* Navbar brand smaller */
    .navbar-brand {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    /* Hero section - even smaller on mobile */
    .hero h1 {
        font-size: 1.5rem;
    }

    .hero .lead {
        font-size: 0.95rem;
    }

    /* Stack team names vertically on very small screens */
    #predictions-table td {
        padding: 0.5rem 0.25rem;
    }

    .team-name {
        font-size: 0.875rem;
    }

    /* Make badges smaller and more readable */
    .badge {
        font-size: 0.7rem;
        padding: 0.35em 0.5em;
    }

    /* Compact table headers */
    .table th {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }

    /* Team checkboxes stack better */
    .team-checkbox {
        padding: 6px 10px;
        margin: 2px;
        font-size: 0.875rem;
    }

    /* Quick select buttons smaller */
    .quick-select-btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.75rem;
    }

    /* Filter buttons in results page */
    .btn-group-sm > .btn,
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Stats cards on results page */
    .card .card-body h3 {
        font-size: 1.5rem;
    }

    /* Make sure value bet badges are visible */
    .prediction-winner,
    .prediction-loser {
        font-size: 0.85rem;
    }

    /* Enhanced context badges are visible on mobile - they provide important info */

    /* Remove container padding on mobile - let tables go to edges */
    .container {
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: 100% !important;
    }

    /* Remove card margins on mobile */
    .card {
        border-radius: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Table cards should span full width */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Column padding removal for full width */
    .col-lg-12,
    .col-md-4,
    .col-md-3,
    .col-6,
    [class*="col-"] {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Main content area */
    main.container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Specific hero/header sections can keep minimal padding for text readability */
    .hero .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Modal adjustments - larger text for better readability */
    .modal-body {
        font-size: 0.95rem;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    .modal-body h5,
    .modal-body h6 {
        font-size: 1rem;
    }

    .modal-body .h5,
    .modal-body .h6 {
        font-size: 1rem;
    }

    /* Modal stats more readable */
    .modal-body .text-primary,
    .modal-body .text-success {
        font-size: 1rem;
    }

    /* Info boxes more compact */
    .card-body {
        padding: 1rem;
    }

    /* Teams page - hide "Toiminnot" column on mobile (row is clickable anyway) */
    #teams-table th:nth-child(5),
    #teams-table td:nth-child(5) {
        display: none;
    }

    /* Team details page - hide "Tulos" badge column on mobile (row color shows result) */
    #recent-matches td:nth-child(5) {
        display: none;
    }

    /* Also hide the header for that column */
    #recent-matches thead th:nth-child(5),
    table:has(#recent-matches) thead th:nth-child(5) {
        display: none;
    }

    /* Team details page - stats cards side by side (2 per row) instead of stacked */
    .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Team details page - compact stats cards */
    .card-body i.fs-1 {
        font-size: 2rem !important;
    }

    .card-body h5 {
        font-size: 0.9rem;
    }

    .card-body .display-6 {
        font-size: 1.25rem !important;
    }

    /* League selector - more compact on mobile */
    .league-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    /* Hide team count badge on mobile */
    .card-header .badge.bg-primary {
        display: none;
    }

    /* Info box list - smaller text */
    .card-body ul li {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
}

/* ============================================================================
 * Utility Classes
 * ========================================================================= */
.text-muted-light {
    color: rgba(255, 255, 255, 0.7);
}

.fw-semibold {
    font-weight: 600;
}

.cursor-pointer {
    cursor: pointer;
}

/* ============================================================================
 * Animations
 * ========================================================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ============================================================================
 * Footer
 * ========================================================================= */
footer a {
    text-decoration: none;
    transition: opacity 0.2s ease;
}

footer a:hover {
    opacity: 0.8;
}

/* ============================================================================
 * Live Game Animation
 * ========================================================================= */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}
