/* ===== Golf League — Custom Styles ===== */

/* ---------- Background hero images ---------- */
/* Each page category gets a different famous-hole photo via Unsplash */
:root {
    --glass-bg: rgba(255, 255, 255, 0.82);
    --glass-border: rgba(255, 255, 255, 0.45);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --nav-height: 4rem;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

/* Gradient overlay on every page */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(160deg, rgba(20, 83, 45, 0.88) 0%, rgba(6, 78, 59, 0.72) 30%, rgba(15, 23, 42, 0.65) 100%);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -3;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.6s ease;
}

/* Background image is set randomly via inline <script> in base.html */

/* ---------- Glassmorphism Cards ---------- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Override Tailwind's bg-white cards to use glass effect */
.bg-white {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--glass-shadow) !important;
}

/* ---------- Navigation ---------- */
nav.site-nav {
    background: rgba(20, 83, 45, 0.65);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 50;
}

nav.site-nav a {
    transition: color 0.2s ease, transform 0.15s ease;
}

nav.site-nav a:hover {
    transform: translateY(-1px);
}

/* ---------- Content area text ---------- */
/* Page titles and text should be light against the dark gradient bg */
main h1, main h2.page-title {
    color: #fff !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

main > p.subtitle {
    color: rgba(255,255,255,0.8) !important;
}

/* ---------- Smooth page transitions ---------- */
main {
    animation: fadeSlideIn 0.4s ease-out;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Cards & interactive elements ---------- */
.bg-white,
.card {
    border-radius: 1rem !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bg-white:hover,
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}

/* Don't hover-lift table rows or inline elements */
tr.bg-white:hover,
thead.bg-white:hover,
tbody.bg-white:hover,
div.bg-white table .bg-white:hover {
    transform: none;
    box-shadow: var(--glass-shadow) !important;
}

/* ---------- Buttons ---------- */
.btn-primary {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    color: white;
    font-weight: 600;
    border-radius: 0.75rem;
    padding: 0.625rem 1.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(21, 128, 61, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(21, 128, 61, 0.45);
}

/* Green buttons get the gradient treatment */
.bg-green-700 {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%) !important;
    box-shadow: 0 4px 14px rgba(21, 128, 61, 0.3);
    transition: all 0.2s ease;
}

.bg-green-700:hover {
    box-shadow: 0 6px 20px rgba(21, 128, 61, 0.45) !important;
    transform: translateY(-1px);
}

/* ---------- Form Inputs ---------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(209, 213, 219, 0.6) !important;
    border-radius: 0.625rem !important;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

input:focus,
select:focus,
textarea:focus {
    border-color: #15803d !important;
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06) !important;
    outline: none;
}

/* ---------- Tier Colors (slightly more refined) ---------- */
.tier-1 { background: linear-gradient(135deg, rgba(253,224,71,0.25), rgba(234,179,8,0.15)) !important; }
.tier-2 { background: linear-gradient(135deg, rgba(147,197,253,0.25), rgba(59,130,246,0.15)) !important; }
.tier-3 { background: linear-gradient(135deg, rgba(134,239,172,0.25), rgba(34,197,94,0.15)) !important; }
.tier-4 { background: linear-gradient(135deg, rgba(216,180,254,0.25), rgba(168,85,247,0.15)) !important; }

/* ---------- Score colors ---------- */
.score-under { color: #dc2626; font-weight: 600; }
.score-over  { color: #2563eb; font-weight: 600; }
.score-even  { color: #6b7280; }

/* ---------- Status badges ---------- */
.status-badge {
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    font-size: 0.65rem;
}

/* ---------- Footer ---------- */
footer.site-footer {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

footer.site-footer a {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s;
}

footer.site-footer a:hover {
    color: white;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(21, 128, 61, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(21, 128, 61, 0.6);
}

/* ---------- Flash messages ---------- */
.flash-message {
    backdrop-filter: blur(12px);
    border-radius: 0.75rem;
    animation: flashSlideIn 0.3s ease-out;
}

@keyframes flashSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Tables inside glass cards ---------- */
.bg-white table {
    border-collapse: separate;
    border-spacing: 0;
}

.bg-white thead {
    background: rgba(249, 250, 251, 0.7) !important;
    backdrop-filter: none;
    border: none !important;
    box-shadow: none !important;
}

.bg-white thead:hover {
    transform: none !important;
}

.bg-white tbody tr {
    transition: background 0.15s ease;
}

.bg-white tbody tr:hover {
    background: rgba(21, 128, 61, 0.04);
}

/* ---------- Responsive mobile ---------- */
@media (max-width: 640px) {
    /* Tighter main content padding */
    main {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Smaller headings */
    main h1 {
        font-size: 1.4rem !important;
    }

    /* Make cards less rounded on mobile for more space */
    .bg-white, .card {
        border-radius: 0.75rem !important;
    }

    /* Reduce card hover effect on mobile (touch) */
    .bg-white:hover, .card:hover {
        transform: none;
    }
}

/* ---------- Home page hero ---------- */
.hero-section {
    padding: 4rem 0 3rem;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 800;
    color: white !important;
    text-shadow: 0 2px 12px rgba(0,0,0,0.3);
    line-height: 1.15;
}

.hero-section p {
    color: rgba(255,255,255,0.85);
    font-size: 1.2rem;
    line-height: 1.6;
}

@media (max-width: 640px) {
    .hero-section {
        padding: 2rem 0 1.5rem;
    }
    .hero-section h1 {
        font-size: 2rem;
    }
    .hero-section p {
        font-size: 1rem;
    }
}

/* ---------- Loading indicator ---------- */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

/* ========================================
   Masters-style PGA Leaderboard
   ======================================== */

.masters-board {
    background: #1a472a !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 3px solid #0d2818 !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1) !important;
}

.masters-board:hover {
    transform: none !important;
}

.masters-header {
    background: linear-gradient(180deg, #f5f0e1 0%, #e8dcc8 100%);
    padding: 0.875rem 1.5rem;
    text-align: center;
    border-bottom: 3px solid #0d2818;
    position: relative;
}

.masters-header::before,
.masters-header::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: #f5f0e1;
    border-radius: 50%;
    border: 2px solid #0d2818;
}

.masters-header::before { left: 12px; }
.masters-header::after { right: 12px; }

.masters-title {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a472a;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

.masters-table {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
}

.masters-thead-row {
    background: #0d2818;
}

.masters-thead-row .masters-cell {
    color: #e8dcc8;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.625rem 0.5rem;
    border-bottom: 2px solid #2d5a3d;
    white-space: nowrap;
}

.masters-cell {
    padding: 0.5rem 0.375rem;
    font-size: 0.85rem;
    border-right: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
    vertical-align: middle;
}

.masters-cell:last-child {
    border-right: none;
}

.masters-cell-pos {
    width: 3.5rem;
    text-align: center;
    font-weight: 700;
    color: #fff;
    font-size: 0.85rem;
}

.masters-cell-score {
    width: 5rem;
    text-align: center;
    font-weight: 800;
    font-size: 1rem;
}

.masters-cell-name {
    text-align: left;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    padding-left: 0.75rem;
}

.masters-cell-round {
    width: 3rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.masters-cell-total {
    width: 3rem;
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.masters-cell-thru {
    width: 5.5rem;
    text-align: center;
    color: #c8e6c0;
    font-size: 0.8rem;
    font-weight: 500;
}

.masters-row {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: background 0.15s ease;
}

.masters-row-odd {
    background: rgba(255,255,255,0.04);
}

.masters-row-even {
    background: transparent;
}

.masters-row:hover {
    background: rgba(255,255,255,0.1) !important;
}

/* ---------- Score Card Tiles ---------- */
/* Each number looks like a physical card/tile on the Masters scoreboard */
.score-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.6rem;
    padding: 0 0.25rem;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
    border: 1px solid rgba(0,0,0,0.2);
}

/* Under par — RED card with white text */
.score-card-under {
    background: linear-gradient(180deg, #e53e3e 0%, #c53030 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    border-color: #9b2c2c;
}

/* Even par — GREEN card with white text */
.score-card-even {
    background: linear-gradient(180deg, #38a169 0%, #2f855a 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    border-color: #276749;
}

/* Over par — BLACK/dark card with white text */
.score-card-over {
    background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    border-color: #171923;
}

/* Neutral card for round scores (cream/white tile) */
.score-card-neutral {
    background: linear-gradient(180deg, #fefcf3 0%, #f5f0e1 100%);
    color: #1a202c;
    border-color: #d4c9a8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.8);
}

/* Empty/dash card */
.score-card-empty {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.1);
    box-shadow: none;
}

/* Score colors for TO PAR column — large format */
.masters-score-card {
    min-width: 2.5rem;
    height: 1.85rem;
    font-size: 0.95rem;
    font-weight: 800;
}

/* Responsive: mobile Masters board */
@media (max-width: 640px) {
    /* Remove fixed layout on mobile so columns auto-size */
    .masters-table {
        table-layout: auto;
    }

    /* Hide round columns on mobile — show POS, SCORE, NAME, THRU */
    .masters-hide-mobile {
        display: none;
    }

    .masters-header {
        padding: 0.625rem 1rem;
    }

    .masters-title {
        font-size: 1.1rem;
        letter-spacing: 0.2em;
    }

    .masters-header::before,
    .masters-header::after {
        width: 7px;
        height: 7px;
    }

    .masters-cell {
        padding: 0.5rem 0.375rem;
        font-size: 0.8rem;
    }

    .masters-cell-pos {
        width: 2.5rem;
        font-size: 0.75rem;
    }

    .masters-cell-score {
        width: auto;
    }

    .masters-cell-name {
        font-size: 0.75rem;
        padding-left: 0.5rem;
        letter-spacing: 0.02em;
    }

    .masters-cell-thru {
        font-size: 0.7rem;
        width: auto;
    }

    .masters-thead-row .masters-cell {
        font-size: 0.6rem;
        padding: 0.5rem 0.375rem;
    }

    .score-card {
        min-width: 1.5rem;
        height: 1.4rem;
        font-size: 0.75rem;
    }

    .masters-score-card {
        min-width: 2.1rem;
        height: 1.55rem;
        font-size: 0.8rem;
    }
}

/* ========================================
   Hole-by-hole Scorecard (expandable)
   ======================================== */

.masters-row-clickable {
    cursor: pointer;
}

.scorecard-chevron {
    display: inline-block;
    font-size: 0.6rem;
    margin-left: 0.35rem;
    color: #c8e6c0;
    transition: transform 0.2s ease;
    vertical-align: middle;
}

.scorecard-chevron-open {
    transform: rotate(180deg);
}

.scorecard-row {
    background: #0d2818 !important;
}

.scorecard-row:hover {
    background: #0d2818 !important;
    transform: none !important;
}

.scorecard-row td {
    padding: 0 !important;
    border: none !important;
}

.scorecard-container {
    padding: 0.75rem 1rem 1rem;
}

.scorecard-player-name {
    font-family: 'Georgia', serif;
    font-size: 0.7rem;
    color: #c8e6c0;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.scorecard-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.scorecard-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 500px;
}

.scorecard-header-row {
    background: rgba(255,255,255,0.08);
}

.scorecard-back-row {
    border-top: 2px solid rgba(255,255,255,0.1);
}

.scorecard-header-row th,
.scorecard-par-row td,
.scorecard-score-row td {
    padding: 0.3rem 0;
    text-align: center;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.scorecard-label {
    width: 2.5rem;
    text-align: left !important;
    padding-left: 0.25rem !important;
    font-weight: 700;
    color: #c8e6c0;
    font-size: 0.65rem !important;
    letter-spacing: 0.05em;
}

.scorecard-hole-num {
    color: #e8dcc8;
    font-weight: 700;
    font-size: 0.65rem !important;
    width: calc((100% - 2.5rem - 2.5rem) / 9);
}

.scorecard-out-in {
    width: 2.5rem;
    font-weight: 700;
    color: #e8dcc8;
    font-size: 0.7rem !important;
    border-left: 1px solid rgba(255,255,255,0.1);
}

.scorecard-par-row {
    background: rgba(255,255,255,0.04);
}

.scorecard-hole-par-num {
    color: #c8e6c0;
    font-weight: 600;
}

.scorecard-score-row {
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* Hole score color coding */
.scorecard-hole {
    color: #fff;
    font-weight: 600;
    position: relative;
}

.scorecard-hole-eagle {
    color: #fbbf24;
    font-weight: 800;
}

.scorecard-hole-birdie {
    color: #f87171;
    font-weight: 700;
}

.scorecard-hole-par {
    color: #c8e6c0;
}

.scorecard-hole-bogey {
    color: #94a3b8;
}

.scorecard-hole-dbl {
    color: #64748b;
}

.scorecard-hole-empty {
    color: rgba(255,255,255,0.15);
}

.scorecard-empty {
    padding: 1rem;
    color: #c8e6c0;
    font-size: 0.8rem;
    text-align: center;
    opacity: 0.7;
}
