:root {
    --bg-dark: #ffffff;
    --bg-card: #f8f9fa;
    --bg-card-hover: #ffffff;
    --border-color: rgba(18, 24, 34, 0.1);
    
    --primary: #121822;
    --primary-hover: #2a364a;
    --secondary: #6ea4e6;
    --tertiary: #99daff;
    --accent-color: #99daff;
    
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: rgba(18, 24, 34, 0.1);
    --btn-secondary-hover: rgba(18, 24, 34, 0.2);
    
    --text-main: #121822;
    --text-muted: #5a6b82;

    --navbar-bg: rgba(255, 255, 255, 0.8);
    --navbar-bg-scrolled: rgba(255, 255, 255, 0.95);
    
    --hero-overlay: linear-gradient(to right, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.3) 100%);
    --cta-bg: linear-gradient(135deg, rgba(18,24,34,0.05) 0%, rgba(110,164,230,0.1) 100%);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;
    
    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="dark"] {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --border-color: rgba(255, 255, 255, 0.1);
    
    --primary: #6ea4e6;
    --primary-hover: #93c5fd;
    --secondary: #99daff;
    --tertiary: #99daff;
    --accent-color: #99daff;
    
    --btn-primary-text: #0f172a;
    --btn-secondary-bg: rgba(255, 255, 255, 0.1);
    --btn-secondary-hover: rgba(255, 255, 255, 0.15);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --navbar-bg: rgba(15, 23, 42, 0.8);
    --navbar-bg-scrolled: rgba(15, 23, 42, 0.95);
    
    --hero-overlay: linear-gradient(to right, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.7) 40%, rgba(15, 23, 42, 0.1) 100%);
    --cta-bg: linear-gradient(135deg, rgba(30, 41, 59, 1) 0%, rgba(15, 23, 42, 1) 100%);
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-family: var(--font-body);
    color: var(--text-main);
    background-color: var(--bg-dark);
}

body {
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

.section-padding {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 3rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-header h2 span {
    color: var(--primary);
}

.section-header .subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-top: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--btn-primary-text);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--primary);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #ffffff;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    background: var(--navbar-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: var(--navbar-bg-scrolled);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 120px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.logo img {
    height: 100px;
    width: 100px;
    object-fit: contain;
    border-radius: 50%;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-links a:not(.btn) {
    font-weight: 500;
    position: relative;
}

.nav-links a:not(.btn)::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-links a:not(.btn):hover::after,
.nav-links a:not(.btn).active::after {
    width: 100%;
}

.theme-toggle {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.mobile-controls {
    display: none;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.menu-toggle span {
    width: 30px;
    height: 2px;
    background: var(--primary);
    transition: 0.3s;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Hero Section */
.hero {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--hero-overlay);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 0 auto;
}

.hero-title-img {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
}

.hero p {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 600px;
}

.hero-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* About Grid */
.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.about-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.about-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-10px);
    border-color: rgba(18, 24, 34, 0.2);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.about-card .icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.about-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--primary);
}

.about-card p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Tournaments */
.tournament-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.tournament-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 20px 30px;
    transition: var(--transition);
}

.tournament-card:hover {
    background: var(--bg-card-hover);
    transform: translateX(10px);
}

.date-badge {
    text-align: center;
    padding-right: 30px;
    border-right: 1px solid var(--border-color);
}

.date-badge .day {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.date-badge .month {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.tournament-card .info {
    flex-grow: 1;
    padding: 0 30px;
}

.tournament-card h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.tournament-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.open {
    background: rgba(153, 218, 255, 0.15);
    color: var(--secondary);
    border: 1px solid var(--secondary);
}

.badge.upcoming {
    background: rgba(160, 160, 165, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
}

.badge.passed {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid #dc3545;
}

.tournament-card.passed {
    opacity: 0.6;
}

.cta-container {
    background: var(--cta-bg);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 80px 40px;
    text-align: center;
}

.cta-container h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 20px;
}

.cta-container p {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 40px;
}

/* Footer */
.footer {
    background: var(--bg-card);
    padding: 80px 0 30px;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

.footer-logo {
    height: 120px;
    margin-bottom: 20px;
    border-radius: 50%;
}

.footer-brand p {
    color: var(--text-muted);
    max-width: 300px;
}

.footer-links h4, .footer-contact h4 {
    font-size: 1.2rem;
    margin-bottom: 25px;
    color: var(--primary);
}

.footer-links ul li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-contact p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.footer-contact p a {
    color: var(--primary);
}

.socials {
    display: flex;
    gap: 15px;
}

.social-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.social-icon svg {
    width: 20px;
    height: 20px;
}

.social-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(18,24,34,0.1);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Animations */
.fade-in {
    opacity: 0;
    transition: opacity 1s ease;
}

.fade-in.appear {
    opacity: 1;
}

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-up.appear {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 900px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: var(--bg-dark);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 40px;
        transition: right 0.4s ease;
        z-index: 90;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.5rem;
    }
    
    .mobile-controls {
        display: flex;
        z-index: 101;
    }

    .menu-toggle {
        display: flex;
    }
    
    #themeToggle {
        display: none;
    }
    
    .hero-title-img {
        max-height: 200px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .tournament-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .date-badge {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 15px;
        width: 100%;
        text-align: left;
    }
    
    .tournament-card .info {
        padding: 0;
    }
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 99;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background-color: var(--primary-hover);
    transform: translateY(-5px);
    color: #ffffff;
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
}

/* Hero Countdown */
.hero-countdown {
    margin-bottom: 40px;
    padding: 25px 40px;
    background: var(--bg-card);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    color: var(--text-main);
}

.hero-countdown > span {
    display: block;
    margin-bottom: 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--secondary);
    font-weight: 800;
}

.countdown-timer {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.time-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    background: transparent;
    min-width: auto;
    padding: 0;
}

.time-box:not(:last-child)::after {
    content: ':';
    position: absolute;
    right: -18px;
    top: 0px;
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-muted);
    opacity: 0.3;
}

.time-box span {
    font-size: 3rem;
    font-weight: 300;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
}

.time-box small {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 10px;
    color: var(--text-muted);
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.gallery-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 20px;
    transition: var(--transition);
}

.gallery-img:hover {
    transform: scale(1.03);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* FAQ */
.faq-accordion {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
}

.faq-item summary {
    padding: 20px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--primary);
    transition: var(--transition);
}

.faq-item[open] summary::after {
    content: '-';
    transform: rotate(180deg);
}

.faq-content {
    padding: 0 30px 20px;
    color: var(--text-muted);
    line-height: 1.6;
}

@media (max-width: 900px) {
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* Logo dark mode switching (Navbar and Footer) */
.logo .logo-dark,
.footer-logo-dark {
    display: none;
}

[data-theme="dark"] .logo .logo-light,
[data-theme="dark"] .footer-logo-light {
    display: none;
}

[data-theme="dark"] .logo .logo-dark,
[data-theme="dark"] .footer-logo-dark {
    display: block;
}

[data-theme="dark"] .hero-title-img {
    filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(255,255,255,0.15));
    transition: filter 0.3s ease;
}

/* Mobile Fixes for New Elements */
@media (max-width: 900px) {
    .section-padding {
        padding: 50px 0;
    }
    .hero-title-img {
        max-height: 120px !important;
    }
    .hero p {
        font-size: 1.1rem;
        margin-bottom: 25px;
    }
    .nav-links {
        gap: 25px !important;
    }
    .hero-countdown {
        padding: 15px 10px;
        margin-bottom: 25px;
        width: 100%;
        box-sizing: border-box;
    }
    .countdown-timer {
        gap: 10px;
        width: 100%;
        justify-content: space-evenly;
    }
    .time-box span {
        font-size: 1.6rem;
    }
    .time-box:not(:last-child)::after {
        right: -6px;
        font-size: 1.2rem;
        top: 2px;
    }
    .time-box small {
        font-size: 0.55rem;
    }
    .hero-actions {
        flex-direction: column;
        width: 100%;
        gap: 15px;
    }
    .hero-actions .btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    .faq-item summary {
        padding: 15px 20px;
        font-size: 1.1rem;
    }
    .faq-content {
        padding: 0 20px 15px;
    }
}

/* Newsletter Section */
.newsletter-container {
    background: var(--cta-bg);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.newsletter-content h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 15px;
}

.newsletter-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.newsletter-form {
    display: flex;
    gap: 15px;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto;
}

.newsletter-input {
    flex-grow: 1;
    padding: 15px 25px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--bg-dark);
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.newsletter-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(110, 164, 230, 0.2);
}

[data-theme="dark"] .newsletter-input {
    background: var(--bg-card);
}

@media (max-width: 600px) {
    .newsletter-form {
        flex-direction: column;
    }
    .newsletter-input, .newsletter-btn {
        width: 100%;
    }
}

/* Ripple Effect */
.btn {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    background-color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.btn-outline .ripple, .btn-secondary .ripple {
    background-color: rgba(18, 24, 34, 0.2);
}

[data-theme="dark"] .btn-outline .ripple, [data-theme="dark"] .btn-secondary .ripple {
    background-color: rgba(255, 255, 255, 0.2);
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.bounce-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 50%;
    animation: bounce 0.8s cubic-bezier(0.28, 0.84, 0.42, 1) infinite alternate;
}

[data-theme="dark"] .bounce-logo {
    filter: brightness(0) invert(1);
}

@keyframes bounce {
    0% { transform: translateY(0); }
    20% { transform: translateY(-30px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

/* === TERRAIN EN FILIGRANE (Court Background) === */
.court-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -10;
    pointer-events: none;
    fill: none;
    stroke: var(--primary, #121822);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.10;
    transform: translateZ(0);
}
[data-theme="dark"] .court-bg {
    stroke: #ffffff;
}

#courtLines {
    will-change: transform;
}

/* Base styles for paths (to be animated via JS) */
#courtLines path,
#courtLines circle,
#courtLines rect,
#courtLines line {
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
}

#court-accent {
    fill: currentColor;
    opacity: 0;
    transition: opacity 0.5s ease;
}
#court-accent.show {
    opacity: 0.15;
}

/* Fallback & Mobile */
.no-js .court-bg path,
.no-js .court-bg circle,
.no-js .court-bg rect,
.no-js .court-bg line,
@media (prefers-reduced-motion: reduce) {
    #courtLines path,
    #courtLines circle,
    #courtLines rect,
    #courtLines line {
        stroke-dashoffset: 0 !important;
    }
}

@media (max-width: 1023px) {
    #courtLines path,
    #courtLines circle,
    #courtLines rect,
    #courtLines line {
        stroke-dashoffset: 0 !important;
    }
}

.court-halo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -9;
    pointer-events: none;
    background: radial-gradient(circle 600px at var(--halo-x, 50%) var(--halo-y, 50%), rgba(255,255,255,0.04), transparent 80%);
    opacity: 0;
    transition: opacity 1s ease;
}
[data-theme="dark"] .court-halo {
    background: radial-gradient(circle 600px at var(--halo-x, 50%) var(--halo-y, 50%), rgba(255,255,255,0.04), transparent 80%);
}
.court-halo.active {
    opacity: 1;
}
@media (max-width: 1023px), (prefers-reduced-motion: reduce) {
    .court-halo { display: none !important; }
}
