/* common.css - Shared styles across the application */

/* ====== CSS Variables ====== */
:root {
    /* Greyscale Spectrum */
    --grey-50:  #FFFFFF;    /* Pure White */
    --grey-100: #F9F9F9;    /* Lightest Grey */
    --grey-200: #F0F0F0;    /* Light Grey */
    --grey-300: #E0E0E0;    /* Soft Light Grey */
    --grey-400: #C8C8C8;    /* Medium Light Grey */
    --grey-500: #A0A0A0;    /* Medium Grey */
    --grey-600: #7A7A7A;    /* Medium Dark Grey */
    --grey-700: #595959;    /* Dark Grey */
    --grey-800: #3A3A3A;    /* Darker Grey */
    --grey-900: #1E1E1E;    /* Near Black */
    --grey-950: #121212;    /* Deep Black */

    /* Semantic Color Mappings */
    --background-primary:   var(--grey-50);
    --background-secondary: var(--grey-100);
    --background-tertiary:  var(--grey-200);
    --text-primary:         var(--grey-900);
    --text-secondary:       var(--grey-700);
    --text-tertiary:        var(--grey-500);
    --border-color:         var(--grey-300);
    --shadow-color:         rgba(0,0,0,0.1);

    /* Accent and Interactive Colors */
    --hover-color:          var(--grey-200);
    --active-color:         var(--grey-300);
}

/* ====== Base Styles ====== */
body {
    background-color: var(--grey-300);
    color: var(--text-primary);
}

/* ====== Card Styles ====== */
.card {
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.card-header {
    background: var(--background-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1rem;
}

/* ====== Button Styles ====== */
.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    text-decoration: none;
}

.nav-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    text-decoration: none;
}

.nav-btn.active {
    background: #3b82f6;
    color: white;
}

/* ====== Header Styles ====== */
.gameweek-header {
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.gameweek-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.gameweek-label {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.03em;
}

.gameweek-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.03em;
}

/* Badge styling */
.status-badge {
    font-size: 0.85rem !important;
    padding: 0.25rem 0.75rem !important;
    font-weight: 700 !important;
    line-height: 1.5 !important;
    border-radius: 0.375rem !important;
    vertical-align: middle !important;
}

/* ====== Table Styles ====== */
.table {
    margin-bottom: 0;
}

.table th {
    background: var(--background-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: var(--background-secondary);
}

.table-hover tbody tr:hover {
    background-color: var(--hover-color);
    transition: background-color 0.2s ease;
}

/* Sticky column styles */
.sticky-col {
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 10;
}

/* Make table headers sticky */
thead th {
    background-color: #f8f9fa !important;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Add shadow indicators for horizontal scrolling */
.table-responsive {
    background: linear-gradient(to right, white 30%, rgba(255, 255, 255, 0)),
                linear-gradient(to right, rgba(255, 255, 255, 0), white 70%) 100% 0,
                radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)),
                radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
}

/* ====== Animation Styles ====== */
/* Score change animations */
@keyframes score-increase {
    0% {
        background-color: #28a745;  /* Green */
        transform: scale(1.1);
        color: white;
    }
    100% {
        background-color: inherit;
        transform: scale(1);
        color: inherit;
    }
}

@keyframes score-decrease {
    0% {
        background-color: #dc3545;  /* Red */
        transform: scale(1.1);
        color: white;
    }
    100% {
        background-color: inherit;
        transform: scale(1);
        color: inherit;
    }
}

/* HTMX indicator styles */
.htmx-indicator {
    opacity: 0;
    transition: opacity 500ms ease-in;
}
.htmx-request .htmx-indicator {
    opacity: 1;
}
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* ====== Team Color Box Styles ====== */
.team-color-box {
    width: 15px;
    height: 15px;
    display: inline-block;
}

/* ====== Container Styles ====== */
.fixtures-container {
    padding-bottom: 2rem;  /* 32px of padding at the bottom */
}

/* ====== Responsive Styles ====== */
@media (max-width: 768px) {
    .gameweek-header {
        padding: 0.75rem 1rem;
    }
    
    .gameweek-label {
        font-size: 1.2rem;
    }
    
    .gameweek-number {
        font-size: 1.4rem;
    }
    
    .card-header {
        padding: 0.75rem;
    }
    
    .table td, .table th {
        padding: 0.5rem 0.25rem;
    }
    
    .fixtures-container {
        padding-bottom: 1.5rem;  /* Slightly less padding on mobile */
    }
    
    /* Make badges smaller on mobile */
    .status-badge {
        font-size: 0.75rem !important;
        padding: 0.2rem 0.5rem !important;
    }
}

/* ====== Global Navbar Spacing ====== */
/* Reduce navbar bottom margin globally across all pages - Multiple selectors for maximum compatibility */
nav.navbar.navbar-expand-lg.navbar-dark.mb-4,
.navbar.navbar-expand-lg.navbar-dark.mb-4,
nav.navbar.mb-4,
.navbar.mb-4 {
    margin-bottom: 0.25rem !important;
}

/* Additional specific overrides for Bootstrap mb-4 class */
.mb-4.navbar,
.navbar.mb-4 {
    margin-bottom: 0.25rem !important;
}

/* Ensure it works on all body classes */
body nav.navbar.mb-4,
body .navbar.mb-4 {
    margin-bottom: 0.25rem !important;
}

/* Ultra-specific override for Bootstrap's default mb-4 utility class - navbar only */
nav.mb-4,
.navbar.mb-4 {
    margin-bottom: 0.25rem !important;
}

/* Direct override of Bootstrap's margin-bottom utility for navbar elements */
html body nav[class*="mb-4"],
html body .navbar[class*="mb-4"] {
    margin-bottom: 0.25rem !important;
}

/* ====== Global Main Content Spacing ====== */
/* Reduce main content top margin to close gap between navbar and content */
html body div#main-content.container-fluid.mt-4,
#main-content.container-fluid.mt-4,
.container-fluid.mt-4#main-content,
.mt-4#main-content {
    margin-top: 0.25rem !important;
}

@media (max-width: 576px) {
    /* Content container padding - not navbar */
    #main-content.container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .gameweek-title {
        gap: 0.5rem;
    }

    .gameweek-label, .gameweek-number {
        font-size: 1.1rem;
    }

    .table {
        font-size: 0.875rem;
    }
    
    .card-header {
        padding: 0.5rem 0.75rem;
    }
}