/* ==========================================================================
   Newcastle District Billiards & Snooker Association (NDBSA) Stylesheet
   ========================================================================== */

/* 1. Base Variables & Reset */
:root {
    --primary-green: #0B4629;
    --accent-gold: #D4AF37;
    --dark-slate: #1A202C;
    --light-grey: #F7FAFC;
    --border-grey: #E2E8F0;
    --white: #FFFFFF;
    --text-main: #2D3748;
    --text-muted: #718096;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html {
    scroll-behavior: smooth;
}

html, body {
    min-height: 100vh;
    margin: 0;
}

body {
    color: var(--text-main);
    background-color: var(--white);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* 1. Mathematically forbid the navbar and footer from stretching vertically */
.navbar, .footer {
    flex: 0 0 auto; 
}

/* 2. Force the main content to absorb ALL leftover vertical space */
.page-content {
    flex: 1 0 auto; 
    width: 100%;
    box-sizing: border-box;
    padding: 50px 20px;
}

/* Force all direct children to full width so your maps and tables never squish */
body > * {
    width: 100%;
    box-sizing: border-box;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 2. Navigation Header */
.navbar {
    background-color: var(--dark-slate);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover, 
.nav-links a.active {
    color: var(--accent-gold);
}

/* 3. Hero Section */
.hero {
    background-color: var(--primary-green);
    color: var(--white);
    padding: 80px 20px;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 12px;
    font-weight: 800;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--accent-gold);
    color: var(--dark-slate);
    border: 2px solid var(--accent-gold);
}

.btn-primary:hover {
    background-color: #c09d2e;
    border-color: #c09d2e;
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--white);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: var(--white);
    color: var(--primary-green);
}

/* 4. Layout Blocks & Grids */
.page-content {
    padding: 50px 20px;
    width: 100%;
    box-sizing: border-box;
}

.subtitle {
    margin-bottom: 25px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.section-block {
    margin-bottom: 45px;
}

.section-title {
    margin-bottom: 18px;
    color: var(--primary-green);
    font-size: 1.5rem;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    padding: 60px 20px;
}

.card {
    background-color: var(--light-grey);
    padding: 30px;
    border-radius: 8px;
    border-top: 4px solid var(--primary-green);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card h3 {
    margin-bottom: 12px;
    color: var(--primary-green);
}

.text-link {
    color: var(--primary-green);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    margin-top: 15px;
}

.text-link:hover {
    text-decoration: underline;
}

/* 5. Competitions & Switcher */
.comp-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    background-color: var(--light-grey);
    padding: 10px;
    border-radius: 8px;
}

.comp-btn {
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.comp-btn.active {
    background-color: var(--primary-green);
    color: var(--white);
}

.comp-panel {
    display: none;
}

.comp-panel.active {
    display: block;
}

/* 6. Tabs System */
.tab-buttons {
    border-bottom: 2px solid var(--border-grey);
    margin-bottom: 25px;
    display: flex;
    gap: 10px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: var(--primary-green);
    border-bottom-color: var(--accent-gold);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 7. Tables & Leaderboards */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-grey);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
}

.data-table th, 
.data-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-grey);
}

.data-table th {
    background-color: var(--dark-slate);
    color: var(--white);
    font-weight: 600;
}

.data-table tr:nth-child(even) {
    background-color: var(--light-grey);
}

.data-table tr:hover {
    background-color: #EDF2F7;
}

.break-badge {
    background-color: var(--primary-green);
    color: var(--accent-gold);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 700;
}

/* 8. Fixtures Section */
.fixture-block {
    margin-bottom: 30px;
}

.fixture-date {
    background-color: var(--dark-slate);
    color: var(--white);
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.match-card {
    background: var(--light-grey);
    padding: 14px 20px;
    margin-bottom: 8px;
    border-left: 4px solid var(--accent-gold);
    border-radius: 0 6px 6px 0;
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

.match-card .vs {
    color: var(--primary-green);
    font-weight: 700;
    margin: 0 10px;
}

/* 9. Rules Card */
.rules-card {
    background-color: var(--light-grey);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-grey);
}

.rules-card h3 {
    color: var(--primary-green);
    margin-bottom: 15px;
}

.rules-card ul {
    list-style-type: disc;
    padding-left: 20px;
}

.rules-card li {
    margin-bottom: 10px;
}

/* 10. Venues Accordion */
.accordion-item {
    border: 1px solid var(--border-grey);
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 18px 24px;
    background-color: var(--light-grey);
    border: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-green);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.accordion-header:hover {
    background-color: #EDF2F7;
}

.accordion-body {
    padding: 24px;
    display: none;
    background-color: var(--white);
    border-top: 1px solid var(--border-grey);
}

.accordion-body.show {
    display: block;
}

.map-container {
    margin-top: 18px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-grey);
}

/* 11. Footer */
.footer {
    background-color: var(--dark-slate);
    color: var(--white);
    text-align: center;
    padding: 25px 20px;
    /* The Auto-Margin Trick: This acts like a spring, permanently pushing the footer to the bottom */
    margin-top: auto; 
    font-size: 0.95rem;
}

/* 12. News Feed Section */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.news-card {
    background-color: var(--white);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-grey);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.news-date {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-card h3 {
    color: var(--primary-green);
    margin-bottom: 12px;
    font-size: 1.25rem;
    line-height: 1.3;
}

.news-card p {
    flex-grow: 1; /* Pushes the "Read More" link to the bottom evenly */
    color: var(--text-main);
    margin-bottom: 15px;
}

/* 13. Team List Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
    cursor: pointer; 
}

.dropbtn {
    /* pointer-events: none; REMOVED: This was completely blocking iOS taps */
    cursor: pointer; 
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--white);
    min-width: 260px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.1);
    z-index: 10;
    border: 1px solid var(--border-grey);
    border-radius: 4px;
    top: 100%;
    left: 0;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    border-bottom: 1px solid var(--light-grey);
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: var(--light-grey);
    color: var(--primary-green);
    font-weight: 600;
}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
    display: block;
}

/* 14. Navbar Dropdown Specific Fixes */
.nav-links .dropdown {
    display: flex;
    align-items: center;
}

.nav-links .dropdown-content {
    top: 100%; /* Pushes the menu right against the text so there is no dead zone */
    margin-top: 10px; /* Minor adjustment for visual spacing */
}

/* This creates an invisible "bridge" so your mouse never leaves the hover area */
.nav-links .dropdown-content::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
    background: transparent;
}

/* Force dropdown links back to dark text to override the white navbar text */
.nav-links .nav-dropdown-menu a {
    color: var(--text-main);
    font-weight: 400;
}

.nav-links .nav-dropdown-menu a:hover {
    color: var(--primary-green);
    font-weight: 600;
}

/* --- Player Profile Modal --- */
.modal-overlay {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.7); 
    backdrop-filter: blur(3px);
}

/* --- Player Profile Modal --- */
.modal-overlay {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.7); 
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: #fff; 
    margin: 10vh auto; 
    padding: 30px; 
    width: 90%; 
    max-width: 450px; 
    border-radius: 8px; 
    border-top: 5px solid var(--primary-green);
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.close-modal {
    color: #aaa; 
    position: absolute; 
    top: 15px; 
    right: 20px; 
    font-size: 28px; 
    font-weight: bold; 
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover { color: var(--dark-slate); }

.modal-header { margin-bottom: 20px; text-align: center; }
.modal-header h3 { margin: 0 0 5px 0; font-size: 1.8rem; color: var(--dark-slate); }
.modal-header .team-badge { font-size: 0.9rem; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

.stat-grid { display: flex; gap: 15px; justify-content: center; margin-bottom: 20px; }
.stat-box { background: var(--light-grey); padding: 15px; border-radius: 6px; text-align: center; flex: 1; border: 1px solid var(--border-grey); }
.stat-label { display: block; font-size: 0.75rem; color: #666; text-transform: uppercase; font-weight: bold; margin-bottom: 5px; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 900; color: var(--primary-green); }

.accolades-section { border-top: 1px solid var(--border-grey); padding-top: 20px; }
.accolades-section h4 { margin-top: 0; margin-bottom: 10px; color: var(--dark-slate); font-size: 1rem; text-transform: uppercase; }
.accolades-content { font-size: 0.95rem; line-height: 1.6; color: #444; }
.accolades-content a { color: var(--primary-green); text-decoration: underline; }