/* ==================== SWIMBENCH GLOBAL STYLES ==================== */

:root {
    --primary: #0a1628;
    --accent: #00d4ff;
    --accent-warm: #ff6b35;
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
    --surface: #0f1f35;
    --text: #ffffff;
    --text-muted: #8fa3bf;
    --error: #ff6b6b;
    --gradient-blue: linear-gradient(135deg, #00d4ff 0%, #0066ff 100%);
    --gradient-warm: linear-gradient(135deg, #ff6b35 0%, #ff3366 100%);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--primary);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
    min-height: 100vh;
}

/* Background - simple static gradient (no animations = battery friendly) */
.water-bg { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: -1; 
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
}
.wave { display: none; }

/* Pause animations when page is hidden (for landing page elements) */
.page-hidden .stopwatch-ring,
.page-hidden .stopwatch-hand,
.page-hidden .medal,
.page-hidden .bubble {
    animation-play-state: paused !important;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .stopwatch-ring,
    .stopwatch-hand,
    .medal,
    .bubble {
        animation: none !important;
    }
}

/* Utility classes */
.hidden { display: none !important; }

/* Logo */
.logo { font-family: 'Bebas Neue', sans-serif; font-size: 3rem; line-height: 1.3; letter-spacing: 0.1em; background: var(--gradient-blue); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-decoration: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.875rem 1.75rem; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.9rem; letter-spacing: 0.05em; text-decoration: none; border: none; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.3s ease; }
.btn-primary { background: var(--gradient-blue); color: var(--primary); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3); }
.btn-secondary { background: rgba(255, 255, 255, 0.1); color: var(--text); border: 1px solid rgba(0, 212, 255, 0.3); }
.btn-secondary:hover { background: rgba(0, 212, 255, 0.1); border-color: var(--accent); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid rgba(255, 255, 255, 0.2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-large { padding: 1.125rem 2.5rem; font-size: 1rem; }
.btn-small { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #ff5252; }

a { color: var(--accent); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: #33e0ff; }
.manage-link { color: var(--accent); font-weight: 500; }

/* Landing Header */
.landing-header { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; padding: 1rem 2rem; background: rgba(10, 22, 40, 0.8); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(0, 212, 255, 0.1); }
.header-content { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem; }
.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: 0.9rem; letter-spacing: 0.05em; }
.nav-links a:hover { color: var(--accent); }

/* Hero Section */
.hero { min-height: 100vh; display: flex; align-items: center; padding: 8rem 2rem 4rem; position: relative; }
.hero-content { max-width: 1200px; margin: 0 auto; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; padding: 0 1.5rem; }
.hero-text h1 { font-family: 'Bebas Neue', sans-serif; font-size: clamp(3.5rem, 8vw, 7rem); line-height: 0.95; letter-spacing: 0.02em; margin-bottom: 1.5rem; }
.hero-text h1 span { display: block; }
.hero-text h1 .accent { background: var(--gradient-blue); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-text p { font-size: 1.25rem; color: var(--text-muted); max-width: 500px; margin-bottom: 2rem; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-visual { position: relative; display: flex; justify-content: center; align-items: center; }

/* Stopwatch */
.stopwatch { width: 320px; height: 320px; position: relative; }
.stopwatch-ring { position: absolute; border-radius: 50%; border: 2px solid rgba(0, 212, 255, 0.2); }
.stopwatch-ring:nth-child(1) { width: 100%; height: 100%; top: 0; left: 0; animation: pulse 3s ease-in-out infinite; }
.stopwatch-ring:nth-child(2) { width: 85%; height: 85%; top: 7.5%; left: 7.5%; animation: pulse 3s ease-in-out infinite 0.5s; }
.stopwatch-ring:nth-child(3) { width: 70%; height: 70%; top: 15%; left: 15%; border-color: var(--accent); animation: pulse 3s ease-in-out infinite 1s; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.7; } }
.stopwatch-face { position: absolute; width: 60%; height: 60%; top: 20%; left: 20%; background: var(--surface); border-radius: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.stopwatch-time { font-family: 'Bebas Neue', sans-serif; font-size: 2.5rem; color: var(--accent); letter-spacing: 0.05em; transition: opacity 0.3s ease; }
.stopwatch-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.stopwatch-hand { position: absolute; width: 2px; height: 35%; background: var(--accent-warm); top: 15%; left: 50%; transform-origin: bottom center; animation: sweep 4s linear infinite; box-shadow: 0 0 10px var(--accent-warm); }
@keyframes sweep { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Medals */
.floating-medals { position: absolute; width: 100%; height: 100%; pointer-events: none; }
.medal { position: absolute; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); animation: float 4s ease-in-out infinite; font-family: 'Bebas Neue', sans-serif; font-size: 1rem; color: #1a1a1a; }
.medal-gold { background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%); top: 10%; right: 10%; }
.medal-silver { background: linear-gradient(135deg, #e0e0e0 0%, #a0a0a0 100%); bottom: 20%; right: 5%; animation-delay: 1s; }
.medal-bronze { background: linear-gradient(135deg, #cd7f32 0%, #8b4513 100%); top: 30%; left: 5%; animation-delay: 2s; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-15px) rotate(5deg); } }

.swimmer-trail { position: absolute; width: 100%; height: 100%; pointer-events: none; }
.bubble { position: absolute; width: 8px; height: 8px; background: rgba(0, 212, 255, 0.3); border-radius: 50%; animation: bubble-rise 3s ease-in-out infinite; }
@keyframes bubble-rise { 0% { transform: translateY(0) scale(1); opacity: 0.8; } 100% { transform: translateY(-100px) scale(0); opacity: 0; } }

/* Section Headers */
.section-header { text-align: center; max-width: 800px; margin: 0 auto 5rem; }
.section-tag { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--accent); margin-bottom: 1rem; display: block; }
.section-title { font-family: 'Bebas Neue', sans-serif; font-size: clamp(2.5rem, 5vw, 4rem); margin-bottom: 1rem; letter-spacing: 0.02em; }
.section-subtitle { font-size: 1.125rem; color: var(--text-muted); }

/* Features */
.features { padding: 8rem 2rem; }
.features-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.feature-card { background: var(--surface); border: 1px solid rgba(0, 212, 255, 0.1); border-radius: var(--radius-md); padding: 2.5rem; transition: all 0.4s ease; position: relative; overflow: hidden; }
.feature-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: var(--gradient-blue); transform: scaleX(0); transform-origin: left; transition: transform 0.4s ease; }
.feature-card:hover { transform: translateY(-5px); border-color: rgba(0, 212, 255, 0.3); box-shadow: var(--shadow-lg); }
.feature-card:hover::before { transform: scaleX(1); }
.feature-icon { width: 60px; height: 60px; border-radius: var(--radius-md); background: rgba(0, 212, 255, 0.1); display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; color: var(--accent); }
.feature-card h3 { font-family: 'Bebas Neue', sans-serif; font-size: 1.5rem; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.feature-card p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.7; }

/* How It Works */
.how-it-works { padding: 8rem 2rem; background: rgba(15, 31, 53, 0.3); }
.steps-container { max-width: 1000px; margin: 0 auto; position: relative; }
.steps-line { position: absolute; left: 40px; top: 60px; bottom: 60px; width: 2px; background: linear-gradient(to bottom, var(--accent), rgba(0, 212, 255, 0.2)); }
.step { display: flex; gap: 3rem; margin-bottom: 4rem; position: relative; }
.step:last-child { margin-bottom: 0; }
.step-number { width: 80px; height: 80px; flex-shrink: 0; background: var(--surface); border: 2px solid var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: 'Bebas Neue', sans-serif; font-size: 2rem; color: var(--accent); position: relative; z-index: 1; }
.step-content h3 { font-family: 'Bebas Neue', sans-serif; font-size: 1.75rem; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.step-content p { color: var(--text-muted); font-size: 1rem; line-height: 1.7; max-width: 500px; }

/* Testimonial */
.testimonial { padding: 8rem 2rem; text-align: center; }
.testimonial-content { max-width: 900px; margin: 0 auto; }
.testimonial-quote { font-family: 'Bebas Neue', sans-serif; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.3; margin-bottom: 2rem; letter-spacing: 0.02em; }
.testimonial-author { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.author-avatar { width: 60px; height: 60px; border-radius: 50%; background: var(--gradient-blue); display: flex; align-items: center; justify-content: center; font-family: 'Bebas Neue', sans-serif; font-size: 1.5rem; color: var(--primary); }
.author-info { text-align: left; }
.author-name { font-weight: 600; font-size: 1rem; }
.author-title { color: var(--text-muted); font-size: 0.875rem; }

/* CTA */
.cta { padding: 8rem 2rem; text-align: center; position: relative; overflow: hidden; }
.cta-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.1) 0%, transparent 70%); pointer-events: none; }
.cta-content { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }
.cta h2 { font-family: 'Bebas Neue', sans-serif; font-size: clamp(2.5rem, 5vw, 4rem); margin-bottom: 1rem; letter-spacing: 0.02em; }
.cta p { font-size: 1.25rem; color: var(--text-muted); margin-bottom: 2rem; }
.cta-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Footer */
.landing-footer { padding: 3rem 2rem; border-top: 1px solid rgba(0, 212, 255, 0.1); }
.footer-content { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.footer-logo { font-family: 'Bebas Neue', sans-serif; font-size: 1.5rem; letter-spacing: 0.1em; color: var(--text-muted); }
.footer-links { display: flex; gap: 2rem; }
.footer-links a { color: var(--text-muted); font-size: 0.875rem; }
.footer-links a:hover { color: var(--accent); }

/* Scroll Animations */
.animate-on-scroll { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.animate-on-scroll.visible { opacity: 1; transform: translateY(0); }

/* ==================== APP DASHBOARD ==================== */

.app-header { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; padding: 1rem 2rem; background: rgba(10, 22, 40, 0.95); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(0, 212, 255, 0.1); }
.logo-group { display: flex; align-items: center; gap: 1rem; }
.subheader { font-size: 1.1rem; color: var(--text-muted); white-space: nowrap; }
.auth-section { display: flex; align-items: center; gap: 1rem; }
.header-nav { display: flex; align-items: center; gap: 1rem; }
.nav-link { color: var(--text); text-decoration: none; font-weight: 500; padding: 0.5rem 1rem; border-radius: var(--radius-md); transition: all 0.3s ease; }
.nav-link:hover { color: var(--accent); background: rgba(0, 212, 255, 0.1); }

/* User Menu */
.user-menu { position: relative; }
.user-menu-btn { display: flex; align-items: center; gap: 0.5rem; background: rgba(255, 255, 255, 0.1); color: white; border: 1px solid rgba(0, 212, 255, 0.3); padding: 0.5rem 1rem; border-radius: 50px; cursor: pointer; font-family: inherit; font-weight: 500; backdrop-filter: blur(10px); transition: all 0.3s ease; }
.user-menu-btn:hover { background: rgba(255, 255, 255, 0.15); border-color: var(--accent); }
.user-menu-dropdown { display: none; position: absolute; top: 100%; right: 0; margin-top: 0.5rem; background: #ffffff; border: 1px solid #e0e0e0; border-radius: var(--radius-md); min-width: 200px; z-index: 1000; box-shadow: var(--shadow-lg); overflow: hidden; }
.user-menu-dropdown.show { display: block; }
.user-menu-dropdown a { display: block; padding: 0.75rem 1rem; color: #333; text-decoration: none; }
.user-menu-dropdown a:hover { background: #f5f5f5; color: #333; }
.user-menu-dropdown .divider { height: 1px; background: #e0e0e0; margin: 0.25rem 0; }
.login-btn { background: var(--gradient-blue); color: var(--primary); border: none; padding: 0.75rem 1.5rem; border-radius: 50px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(0, 212, 255, 0.3); }

/* Mobile/Desktop visibility */
.desktop-only { display: block; }
.desktop-only.header-nav, .desktop-only.user-menu { display: flex; }
table.desktop-only { display: table; }
.mobile-only { display: none; }

/* Hamburger Button */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 8px;
}
.hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--text);
    transition: all 0.3s ease;
}
.hamburger-btn.active .hamburger-line:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger-btn.active .hamburger-line:nth-child(2) { opacity: 0; }
.hamburger-btn.active .hamburger-line:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    min-width: 200px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.mobile-menu.show { display: block; }
.mobile-menu a { display: block; padding: 0.875rem 1.25rem; color: #333; text-decoration: none; font-weight: 500; }
.mobile-menu a:hover { background: #f5f5f5; }
.mobile-menu .divider { height: 1px; background: #e0e0e0; margin: 0.25rem 0; }

/* Responsive breakpoint */
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    .hamburger-btn { display: flex; }
    
    .header-content { padding: 0 1rem; }
    .logo { font-size: 2rem; }
    .logo-group { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
    .subheader { font-size: 0.9rem; }
    
    .app-container { padding: 5rem 1rem 2rem; }
    
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .page-header h1 { font-size: 2rem; }
    
    .swimmers-grid { grid-template-columns: 1fr; }
    
    .dialog-content { margin: 1rem; padding: 1.5rem; max-height: calc(100vh - 2rem); }
    .dialog-content-wide { max-width: none; }
    
    /* League table/cards responsive */
    .league-table { display: none !important; }
    .league-cards { display: block !important; }
    
    .league-actions { flex-direction: column; }
    .league-actions .btn { width: 100%; }
    .league-actions .split-button { width: 100%; }
    .league-actions .split-button .btn { width: 100%; }
    
    .dialog-footer { flex-direction: column-reverse; }
    .dialog-footer .btn { width: 100%; }
}

/* Hide subheader on narrow screens where it would overlap nav */
@media (min-width: 769px) and (max-width: 950px) {
    .subheader { display: none; }
}

/* App Container */
.app-container { position: relative; z-index: 10; max-width: 1200px; margin: 0 auto; padding: 7rem 1.5rem 2rem; }

/* Dashboard Sections */
.section { background: rgba(15, 31, 53, 0.8); backdrop-filter: blur(10px); border-radius: var(--radius-lg); padding: 2rem; margin-bottom: 2rem; border: 1px solid rgba(0, 212, 255, 0.15); }
.section h2 { font-family: 'Bebas Neue', sans-serif; color: var(--accent); font-size: 1.75rem; letter-spacing: 0.05em; margin-bottom: 1.5rem; }
.section h3 { color: var(--text); font-size: 1.25rem; margin-bottom: 1rem; }

/* Select Dropdown */
#swimmerSelect { width: 100%; padding: 1rem; background: #ffffff; border: 1px solid #e0e0e0; border-radius: var(--radius-md); color: #333; font-family: inherit; font-size: 1rem; cursor: pointer; transition: border-color 0.3s ease; }
#swimmerSelect:hover, #swimmerSelect:focus { border-color: var(--accent); outline: none; }
#swimmerSelect option { background: #ffffff; color: #333; }

/* Stroke Tabs */
.stroke-tabs { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.stroke-tab { padding: 0.875rem 1.5rem; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(0, 212, 255, 0.2); border-radius: var(--radius-md); color: var(--text); cursor: pointer; transition: all 0.3s ease; font-family: inherit; font-size: 1rem; font-weight: 500; }
.stroke-tab:hover { background: rgba(0, 212, 255, 0.1); border-color: rgba(0, 212, 255, 0.4); }
.stroke-tab.active { background: var(--gradient-blue); color: var(--primary); border-color: transparent; font-weight: 600; }

/* Times Table */
.times-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.times-table th, .times-table td { padding: 1rem; text-align: left; border-bottom: 1px solid rgba(0, 212, 255, 0.1); }
.times-table th { color: var(--accent); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.times-table td { color: var(--text); }
.times-table td strong { color: var(--accent); font-family: 'Bebas Neue', sans-serif; font-size: 1.25rem; letter-spacing: 0.05em; }
.times-table tr:hover { background: rgba(0, 212, 255, 0.05); }

/* Action Buttons */
.action-buttons { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }

/* Results Section */
.results-section { display: none; }
.results-section.active { display: block; }
#resultsContent { line-height: 1.8; }
#resultsContent p { margin-bottom: 1rem; }

/* Empty State */
.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-state h3 { font-family: 'Bebas Neue', sans-serif; font-size: 2rem; color: var(--accent); margin-bottom: 1rem; }
.empty-state p { color: var(--text-muted); font-size: 1.1rem; }

/* Messages */
.empty-message { color: var(--text-muted); font-style: italic; }
.loading-message { color: var(--accent); }
.error-message { color: var(--error); }

/* ==================== MODAL DIALOGS ==================== */

.dialog-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10, 22, 40, 0.95); backdrop-filter: blur(5px); z-index: 1000; align-items: center; justify-content: center; }
.dialog-overlay.active { display: flex; }
.dialog-content { background: var(--surface); border: 1px solid rgba(0, 212, 255, 0.3); border-radius: var(--radius-lg); padding: 2rem; max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto; }
.dialog-header { font-family: 'Bebas Neue', sans-serif; color: var(--accent); font-size: 1.5rem; margin-bottom: 1.5rem; font-weight: 600; }
.dialog-body { margin-bottom: 1.5rem; }
.dialog-footer { display: flex; gap: 1rem; justify-content: flex-end; }

/* Login Dialog */
.login-dialog { max-width: 450px; }
.login-description { font-size: 0.95rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 2rem; text-align: center; }
.login-description strong { color: var(--accent); }
.login-options { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.login-option { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 1rem 1.5rem; background: white; border: 2px solid #e0e0e0; border-radius: 6px; color: #333; text-decoration: none; transition: all 0.25s ease; font-family: inherit; font-size: 1rem; font-weight: 500; cursor: pointer; }
.login-option:hover { background: #f5f5f5; border-color: #d0d0d0; transform: translateY(-1px); box-shadow: var(--shadow-sm); color: #333; }
.login-option svg { width: 20px; height: 20px; flex-shrink: 0; }
.login-dialog-footer { display: flex; justify-content: center; margin-top: 1rem; }

/* Form Groups */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; color: var(--text); margin-bottom: 0.5rem; font-weight: 500; }
.form-group .required { color: var(--error); }
.tooltip-icon { display: inline-block; margin-left: 0.5rem; width: 18px; height: 18px; border-radius: 50%; background: rgba(0, 212, 255, 0.2); color: var(--accent); font-size: 0.75rem; text-align: center; line-height: 18px; cursor: help; font-weight: 600; }
.tooltip-icon:hover { background: rgba(0, 212, 255, 0.3); }
.form-group input, .form-group select { 
    width: 100%; 
    padding: 0.875rem; 
    background: #ffffff; 
    border: 1px solid #e0e0e0; 
    border-radius: var(--radius-md); 
    color: #333; 
    font-family: inherit; 
    font-size: 1rem; 
    transition: border-color 0.3s ease; 
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent); }
.form-group input::placeholder { color: #999; }
.checkbox-label { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; color: var(--text); font-weight: 500; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.form-error { color: var(--error); font-size: 0.9rem; margin-bottom: 1rem; padding: 0.75rem; background: rgba(255, 107, 107, 0.1); border-radius: var(--radius-sm); }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

/* Roster Table Filters */
.filter-row td { padding: 0.25rem 0.5rem; background: rgba(0, 212, 255, 0.05); }
.roster-filter { padding: 0.4rem 0.5rem; background: rgba(15, 31, 53, 0.8); border: 1px solid rgba(0, 212, 255, 0.2); border-radius: var(--radius-sm); color: var(--text); font-size: 0.85rem; width: 100%; }
.roster-filter:focus { outline: none; border-color: var(--accent); }
.roster-filter option { background: var(--surface); color: var(--text); }
.sortable-header { cursor: pointer; user-select: none; }
.sortable-header:hover { color: var(--accent); }
.sortable-header.sorted { color: var(--accent); }

/* ==================== OTHER PAGES (swimmers.html etc) ==================== */

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.page-header h1 { font-family: 'Bebas Neue', sans-serif; color: var(--accent); font-size: 2.5rem; letter-spacing: 0.05em; margin: 0; }
.page-header h2 { font-family: 'Bebas Neue', sans-serif; color: var(--accent); font-size: 2rem; letter-spacing: 0.05em; margin: 0; }
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Dashboard Coach Tabs */
.dashboard-tabs { display: flex; align-items: center; gap: 0.5rem; }
.dashboard-tab { font-family: 'Bebas Neue', sans-serif; color: var(--text-muted); font-size: 2.5rem; letter-spacing: 0.05em; margin: 0; background: none; border: none; cursor: pointer; padding: 0 0.25rem 0.25rem; border-bottom: 2px solid transparent; transition: all 0.2s ease; }
.dashboard-tab:hover { color: var(--accent); }
.dashboard-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.dashboard-tab-separator { font-family: 'Bebas Neue', sans-serif; color: var(--text-muted); font-size: 2.5rem; margin: 0 0.5rem; opacity: 0.4; }

.back-link { display: none; margin-bottom: 1rem; color: var(--accent); }
@media (max-width: 768px) { .back-link { display: inline-block; } }

/* Swimmer Cards */
.swimmer-card { background: rgba(15, 31, 53, 0.8); backdrop-filter: blur(10px); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1rem; border: 1px solid rgba(0, 212, 255, 0.15); transition: all 0.3s ease; }
.swimmer-card:hover { border-color: rgba(0, 212, 255, 0.3); }
.swimmer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.swimmer-header h3 { font-family: 'Bebas Neue', sans-serif; color: var(--accent); font-size: 1.5rem; letter-spacing: 0.05em; }
.swimmer-details { color: var(--text-muted); margin-bottom: 1rem; }
.swimmer-details p { margin: 0.5rem 0; }
.swimmer-actions { display: flex; gap: 0.5rem; }

/* Badges */
.badge { padding: 0.25rem 0.75rem; border-radius: 50px; font-size: 0.85rem; font-weight: 600; }
.badge.active { background: #4caf50; color: white; }
.badge.inactive { background: #999; color: white; }
.badge.free { background: #E5DDD5; color: var(--primary); }
.badge.premium { background: var(--gold); color: var(--primary); }

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1024px) {
    .hero-content { grid-template-columns: 1fr; text-align: center; gap: 3rem; }
    .hero-text p { margin: 0 auto 2rem; }
    .hero-cta { justify-content: center; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .hero { padding: 6rem 1.5rem 3rem; }
    .hero-text h1 { font-size: 3rem; }
    .stopwatch { width: 250px; height: 250px; }
    .features-grid { grid-template-columns: 1fr; }
    .step { flex-direction: column; gap: 1.5rem; padding-left: 100px; }
    .step-number { position: absolute; left: 0; width: 60px; height: 60px; font-size: 1.5rem; }
    .steps-line { left: 29px; }
    .footer-content { flex-direction: column; gap: 1.5rem; text-align: center; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .swimmer-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .action-buttons { flex-direction: column; }
    .stroke-tabs { flex-direction: column; }
}

@media (max-width: 480px) {
    .hero-text h1 { font-size: 2.5rem; }
    .btn-large { padding: 1rem 2rem; width: 100%; }
    .hero-cta { flex-direction: column; width: 100%; }
    .cta-buttons { flex-direction: column; }
    .cta-buttons .btn { width: 100%; }
    .medal { width: 40px; height: 40px; font-size: 0.8rem; }
    .app-container { padding: 5rem 1rem 1rem; }
    .section { padding: 1.5rem; }
}

/* ==================== SWIMMERS PAGE SPECIFIC ==================== */

.swimmers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .swimmers-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .swimmers-grid { grid-template-columns: 1fr; }
}

/* Kebab Menu */
.kebab-menu { position: relative; }
.kebab-btn {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.kebab-btn:hover { background: rgba(0, 212, 255, 0.1); }

.kebab-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    min-width: 180px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.kebab-dropdown.show { display: block; }
.kebab-dropdown button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: #333;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
    font-family: inherit;
}
.kebab-dropdown button:hover { background: #f5f5f5; }
.kebab-dropdown button.danger { color: var(--error); }
.kebab-dropdown button.danger:hover { background: #fff5f5; }
.kebab-dropdown .divider { height: 1px; background: #e0e0e0; margin: 0.25rem 0; }

/* League Table */
.league-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
.league-table th, .league-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}
.league-table th {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.league-table td { color: var(--text); }
.league-table input, .league-table select {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-sm);
    color: #333;
    padding: 0.5rem;
    width: 100%;
    font-size: 0.9rem;
    font-family: inherit;
}
.league-table input::placeholder { color: #999; }
.league-table input:focus, .league-table select:focus { outline: none; border-color: var(--accent); }

/* Mobile League Cards */
.league-cards { display: none; }
.no-leagues-mobile {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}
.league-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
}
.league-card.new-league {
    border-color: rgba(0, 212, 255, 0.4);
    background: rgba(0, 212, 255, 0.05);
}
.league-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 0.5rem;
}
.league-card-header input {
    flex: 1;
    min-width: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-sm);
    color: #333;
    padding: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
}
.league-card-header input::placeholder { color: #999; }
.league-card-delete {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid var(--error);
    color: var(--error);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.league-card-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.league-card-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.league-card-field label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.league-card-field select {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-sm);
    color: #333;
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    width: 100%;
    min-width: 0;
}

/* Wide dialog for leagues */
.dialog-content-wide { max-width: 1000px; }

/* League Actions */
.league-actions { display: flex; gap: 1rem; margin-top: 1rem; align-items: center; }

/* Split Button */
.split-button { position: relative; display: inline-block; }
.split-main { display: flex; align-items: center; gap: 0.5rem; }
.split-arrow { font-size: 0.75rem; margin-left: 0.25rem; }
.split-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    min-width: 180px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.split-dropdown.show { display: block; }
.split-dropdown button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: #333;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
    font-family: inherit;
}
.split-dropdown button:hover { background: #f5f5f5; }

/* Disabled Button */
.btn.disabled, .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn.disabled:hover, .btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Icon Buttons */
.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1.2rem;
    transition: transform 0.2s;
}
.icon-btn:hover { transform: scale(1.1); }
.icon-btn.danger:hover { filter: brightness(1.2); }

/* League Status Badge */
.league-status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.league-status-badge.active { background: #4caf50; color: white; }
.league-status-badge.inactive { background: #999; color: white; }
.league-status-badge.archived { background: #ff9800; color: white; }

/* Confirmation Input */
.confirmation-input { margin: 1rem 0; }
.confirmation-input label {
    display: block;
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.confirmation-input input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 107, 107, 0.5);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}
.confirmation-input input:focus { outline: none; border-color: var(--error); }

/* Fix old variable references */
.dialog-header { color: var(--accent) !important; }
.dialog-content p { color: var(--text); }

/* ==================== SWIMMER TILES ==================== */

.swimmer-tile {
    background: rgba(15, 31, 53, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid rgba(0, 212, 255, 0.15);
    transition: all 0.3s ease;
}

.swimmer-tile:hover {
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: var(--shadow-md);
}

.swimmer-tile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.swimmer-tile-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: var(--accent);
    letter-spacing: 0.05em;
    margin: 0;
}

.swimmer-tile-details {
    margin-bottom: 1rem;
}

.swimmer-tile-details p {
    margin: 0.5rem 0;
    color: var(--text);
    font-size: 0.95rem;
}

.swimmer-tile-details strong {
    color: var(--text-muted);
}

.swimmer-tile-footer {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 212, 255, 0.1);
}

/* ==================== AVATAR EDITOR ==================== */

/* Upload Zone */
.avatar-upload-zone {
    border: 2px dashed rgba(0, 212, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.avatar-upload-zone:hover,
.avatar-upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(0, 212, 255, 0.05);
}

.avatar-upload-zone .upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.avatar-upload-zone p {
    color: var(--text-muted);
    margin: 0.5rem 0;
}

.avatar-upload-zone .upload-or {
    font-size: 0.85rem;
    margin: 1rem 0;
}

.avatar-upload-zone .upload-btn {
    margin: 0.5rem 0;
}

.avatar-upload-zone .upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* Cropper Area */
.avatar-cropper-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.avatar-cropper-wrapper {
    position: relative;
    width: 100%;
    max-height: 350px;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.avatar-cropper-wrapper img {
    display: block;
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
}

/* Cropper.js customization - circular crop overlay */
.cropper-view-box,
.cropper-face {
    border-radius: 50%;
}

.cropper-view-box {
    box-shadow: 0 0 0 1px var(--accent);
    outline: none;
}

.cropper-line,
.cropper-point {
    background-color: var(--accent);
}

.cropper-modal {
    background-color: rgba(10, 22, 40, 0.8);
}

/* Avatar Controls */
.avatar-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.avatar-controls .control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar-controls .control-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.avatar-controls input[type="range"] {
    width: 120px;
    accent-color: var(--accent);
}

.avatar-controls .control-buttons {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.avatar-controls .control-buttons .btn {
    padding: 0.4rem 0.75rem;
    font-size: 1rem;
}

/* Replace image link */
.replace-image {
    text-align: center;
    padding-top: 0.5rem;
}

.replace-link {
    color: var(--accent);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
}

.replace-link:hover {
    color: #33e0ff;
}

/* Avatar display in dashboard table */
.swimmer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Avatar in detail page header */
.detail-header-with-avatar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
    flex-shrink: 0;
}

.detail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.detail-swimmer-name-inline {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.5rem;
    color: var(--accent);
    letter-spacing: 0.05em;
    margin: 0;
}

/* Mobile adjustments for avatar editor */
@media (max-width: 768px) {
    .avatar-cropper-wrapper {
        max-height: 280px;
    }
    
    .avatar-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .avatar-controls .control-group {
        justify-content: space-between;
    }
    
    .avatar-controls input[type="range"] {
        flex: 1;
    }
    
    .avatar-controls .control-buttons {
        margin-left: 0;
        justify-content: center;
    }
}

/* ==================== TEAM ASSOCIATIONS (My Swimmers) ==================== */
.team-association-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.team-association-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.team-association-info strong {
    color: var(--accent);
}

.team-association-info .team-name {
    color: var(--text);
}

.team-association-info .team-name::before {
    content: "›";
    margin-right: 0.5rem;
    color: var(--text-muted);
}

.team-association-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.team-association-item:hover .team-association-actions {
    opacity: 1;
}

@media (max-width: 768px) {
    .team-association-actions {
        opacity: 1;
    }
}
