/* ============================================
   Fantasy Rugby — Premium Design System
   Multi-Tenant Dynamic Theming
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800&family=Barlow:wght@300;400;500;600&display=swap');

:root {
    /* Core Palette */
    --primary:        #0A1E4A;
    --primary-light:  #112866;
    --accent:         #C8192B;
    --accent-hover:   #E01F32;

    /* Club identity — overridden by config.js per subdomain */
    --club-primary:     #0A1E4A;
    --club-primary-rgb: 10,30,74;
    --gold:           #D4A843;
    --gold-light:     #F0C95A;

    /* Surfaces */
    --bg:             #070E1F;
    --surface-1:      rgba(255,255,255,0.04);
    --surface-2:      rgba(255,255,255,0.07);
    --surface-3:      rgba(255,255,255,0.11);
    --border:         rgba(255,255,255,0.07);
    --border-active:  rgba(255,255,255,0.15);

    /* Text */
    --text:           #EEF2FF;
    --text-secondary: #8FA3C8;
    --text-muted:     #4A5E7A;

    /* Status */
    --success:        #1DB954;
    --warning:        #F5A623;
    --danger:         #E01F32;
    --info:           #3B82F6;

    /* Legacy compat */
    --secondary:      #C8192B;
    --white:          #FFFFFF;
    --gray:           #8FA3C8;
    --muted:          #8FA3C8;
    --dark:           #070E1F;
    --light:          #EEF2FF;
    --light-gray:     rgba(255,255,255,0.06);
    --background:     #070E1F;
    --primary-blue:   #0A1E4A;
    --primary-red:    #C8192B;
    --light-blue:     #112866;
    --light-red:      #E01F32;
    --border-color:   rgba(255,255,255,0.07);

    /* Shadows */
    --shadow-sm:  0 1px 4px rgba(0,0,0,0.3);
    --shadow-md:  0 6px 24px rgba(0,0,0,0.4);
    --shadow-lg:  0 16px 48px rgba(0,0,0,0.55);
    --shadow-xl:  0 32px 80px rgba(0,0,0,0.7);
    --shadow-red: 0 8px 32px rgba(200,25,43,0.35);
    --shadow-gold:0 8px 32px rgba(212,168,67,0.35);

    /* Type */
    --font-display: 'Barlow Condensed', 'Impact', sans-serif;
    --font-body:    'Barlow', 'Segoe UI', system-ui, sans-serif;
    --font-family:  'Barlow', 'Segoe UI', system-ui, sans-serif;

    /* Layout */
    --radius:     10px;
    --radius-lg:  18px;
    --radius-xl:  28px;
    --border-radius: 10px;
    --border-radius-lg: 18px;

    --transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Reset & Base
   ============================================ */

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(10,30,74,0.9) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 100%, rgba(var(--club-primary-rgb), 0.18) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(212,168,67,0.05) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
}

/* Subtle grid texture */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 48px 48px;
    z-index: -1;
    pointer-events: none;
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.1;
}

h4, h5, h6 {
    font-family: var(--font-body);
    font-weight: 600;
    line-height: 1.3;
}

main h2 {
    color: var(--text);
    font-size: clamp(22px, 3vw, 32px);
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid rgba(var(--club-primary-rgb), 0.25);
}

main h3 { color: var(--text); font-weight: 600; }
main p  { color: var(--text-secondary); }

/* ============================================
   Layout
   ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
}

/* ============================================
   Header / Nav
   ============================================ */

header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    background: rgba(7, 14, 31, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 4px 24px rgba(0,0,0,0.5);
}

nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    padding-bottom: 14px;
}

.logo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.logo span { color: var(--club-primary); }

.nav-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(200,25,43,0.35));
}

.logo:hover { opacity: 0.85; }

.nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.02em;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav-links a.active {
    color: var(--text);
    background: var(--surface-3);
}

.nav-links .btn-logout {
    background: rgba(200,25,43,0.15);
    border: 1px solid rgba(200,25,43,0.3);
    cursor: pointer;
    color: #FF6B7A;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
    font-family: var(--font-body);
    letter-spacing: 0.02em;
}

.nav-links .btn-logout:hover {
    background: rgba(200,25,43,0.3);
    border-color: rgba(200,25,43,0.5);
    color: #fff;
}

/* Gear dropdown menu */
.nav-gear-wrapper {
    position: relative;
}

.nav-gear-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    padding: 0;
    line-height: 1;
    color: var(--text-secondary);
}

.nav-gear-btn svg {
    width: 16px;
    height: 16px;
}

.nav-gear-btn:hover {
    background: var(--surface-3);
    transform: rotate(45deg);
}

.nav-gear-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: rgba(10, 22, 55, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-lg);
    padding: 8px 0;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    list-style: none;
}

.nav-gear-menu.open {
    display: block;
    animation: fadeDown 0.2s ease;
}

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

.nav-gear-menu li { list-style: none; }

.nav-gear-menu a,
.nav-gear-menu .btn-logout {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-body);
}

.nav-gear-menu a:hover,
.nav-gear-menu .btn-logout:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav-gear-menu .btn-logout {
    color: #FF6B7A;
}

.nav-gear-menu .btn-logout:hover {
    background: rgba(200,25,43,0.15);
}


/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--surface-1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(200,25,43,0.5), transparent);
    opacity: 0;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.card:hover::before { opacity: 1; }

.card-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 0; }

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    letter-spacing: 0.04em;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255,255,255,0.08), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.btn:hover::after { opacity: 1; }

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px rgba(200,25,43,0.4);
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 24px rgba(200,25,43,0.55);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface-3);
    border-color: var(--border-active);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: #0A1E4A;
    font-weight: 700;
    box-shadow: var(--shadow-gold);
}
.btn-gold:hover {
    box-shadow: 0 10px 40px rgba(212,168,67,0.5);
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(200,25,43,0.15);
    color: #FF6B7A;
    border: 1px solid rgba(200,25,43,0.3);
}
.btn-danger:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-success {
    background: rgba(29,185,84,0.15);
    color: #1DB954;
    border: 1px solid rgba(29,185,84,0.3);
}
.btn-success:hover {
    background: #1DB954;
    color: #fff;
}

.btn-block { width: 100%; }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: 22px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select, textarea {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: var(--font-body);
    transition: var(--transition);
    background: rgba(255,255,255,0.05) !important;
    color: var(--text) !important;
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(200,25,43,0.6);
    box-shadow: 0 0 0 3px rgba(200,25,43,0.15);
    background: rgba(255,255,255,0.07) !important;
}

input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) {
    border-color: var(--border-active);
}

input:disabled { opacity: 0.4; cursor: not-allowed; }

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238FA3C8' d='M6 8L0 0h12z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding-right: 40px !important;
}

select option { background: #0A1428; color: var(--text); }

.form-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .form-row { grid-template-columns: 1fr; } }

/* ============================================
   Alerts & Badges
   ============================================ */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    border: 1px solid;
    animation: slideDown 0.3s ease;
}

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

.alert-success { background: rgba(29,185,84,0.1);  border-color: rgba(29,185,84,0.3);  color: #6EE89B; }
.alert-error,
.alert-danger   { background: rgba(200,25,43,0.1);  border-color: rgba(200,25,43,0.3);  color: #FF8A94; }
.alert-warning  { background: rgba(245,166,35,0.1); border-color: rgba(245,166,35,0.3); color: #FFC96B; }
.alert-info     { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); color: #93C5FD; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid;
}

.badge-success { background: rgba(29,185,84,0.15);  border-color: rgba(29,185,84,0.4);  color: #6EE89B; }
.badge-warning { background: rgba(245,166,35,0.15); border-color: rgba(245,166,35,0.4); color: #FFC96B; }
.badge-danger  { background: rgba(200,25,43,0.15);  border-color: rgba(200,25,43,0.4);  color: #FF8A94; }
.badge-info    { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.4); color: #93C5FD; }
.badge-secondary { background: var(--surface-2); border-color: var(--border); color: var(--text-secondary); }
.badge-gold    { background: rgba(212,168,67,0.15); border-color: rgba(212,168,67,0.4); color: var(--gold-light); }

/* ============================================
   Auth Pages
   ============================================ */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    animation: fadeUp 0.6s cubic-bezier(0.4,0,0.2,1) both;
}

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

.auth-card {
    background: rgba(10, 20, 48, 0.7);
    backdrop-filter: blur(32px) saturate(140%);
    -webkit-backdrop-filter: blur(32px) saturate(140%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04) inset;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(200,25,43,0.7), transparent);
}

.auth-card::after {
    content: '';
    position: absolute;
    bottom: -120px; right: -80px;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200,25,43,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.club-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 16px rgba(200,25,43,0.4));
}

.auth-card h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text);
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 28px;
}

.auth-tabs {
    display: flex;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 28px;
    gap: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 7px;
    transition: var(--transition);
    font-family: var(--font-body);
    letter-spacing: 0.03em;
}

.auth-tab.active {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.active) { color: var(--text); background: var(--surface-2); }

.auth-form { text-align: left; }

.auth-note {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 16px;
    line-height: 1.6;
    padding: 12px;
    background: rgba(245,166,35,0.06);
    border: 1px solid rgba(245,166,35,0.15);
    border-radius: var(--radius);
}

/* ============================================
   Tables
   ============================================ */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.leaderboard-table,
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.leaderboard-table thead,
thead {
    background: rgba(10,30,74,0.5);
}

.leaderboard-table th,
th {
    padding: 12px 10px;
    text-align: left;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.leaderboard-table td,
td {
    padding: 10px 10px;
    color: var(--text);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
    font-size: 13px;
}

.leaderboard-table tbody tr,
tbody tr {
    transition: var(--transition);
}

.leaderboard-table tbody tr:hover,
tbody tr:hover {
    background: var(--surface-2);
}

.leaderboard-table tbody tr:last-child td,
tbody tr:last-child td {
    border-bottom: none;
}

.position-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 13px;
}

.position-1 { background: linear-gradient(135deg, #D4A843, #F0C95A); color: #0A1E4A; }
.position-2 { background: linear-gradient(135deg, #9CA3AF, #D1D5DB); color: #0A1E4A; }
.position-3 { background: linear-gradient(135deg, #B45309, #D97706); color: #fff; }

/* Table responsiveness */
.table-responsive,
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

.table-responsive::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track {
    background: var(--surface-1);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--border-active);
}

/* ============================================
   Loading & Spinner
   ============================================ */

.loading {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Status Text helpers
   ============================================ */

.success  { color: #6EE89B; }
.error    { color: #FF8A94; }
.warning  { color: #FFC96B; }
.info-text{ color: #93C5FD; }
.highlight{ color: var(--gold-light); font-weight: 600; }
.muted    { color: var(--text-muted); font-style: italic; }

/* ============================================
   Dashboard Specifics
   ============================================ */

.dashboard-header {
    text-align: center;
    margin: 40px 0 32px;
    animation: fadeUp 0.5s ease both;
}

.dashboard-header h2 {
    font-size: clamp(26px, 4vw, 42px);
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: 0.05em;
    border: none;
    margin-bottom: 6px;
    padding-bottom: 0;
}

.dashboard-header p {
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 500;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 0 0 32px;
}

.dashboard-grid .card:nth-child(1) { animation: fadeUp 0.5s 0.05s ease both; }
.dashboard-grid .card:nth-child(2) { animation: fadeUp 0.5s 0.10s ease both; }
.dashboard-grid .card:nth-child(3) { animation: fadeUp 0.5s 0.15s ease both; }
.dashboard-grid .card:nth-child(4) { animation: fadeUp 0.5s 0.20s ease both; }

.quick-actions {
    margin-top: 36px;
    text-align: center;
    animation: fadeUp 0.5s 0.25s ease both;
}

.quick-actions h3 {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 14px;
}

.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.top3-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top3-list li {
    padding: 12px 14px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    transition: var(--transition);
}

.top3-list li:hover { background: var(--surface-2); }

.top3-list li:first-child {
    border-color: rgba(212,168,67,0.25);
    background: rgba(212,168,67,0.05);
}

.points { color: var(--gold-light); font-weight: 700; font-size: 13px; }

/* stat number in dashboard cards */
.stat-number {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.02em;
}

/* ============================================
   Admin Panel
   ============================================ */

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
}

.admin-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border-radius: 0;
    font-family: var(--font-body);
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.admin-tab::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 2px;
    background: transparent;
    transition: var(--transition);
}

.admin-tab.active { color: var(--text); }
.admin-tab.active::after { background: var(--accent); }
.admin-tab:hover:not(.active) { color: var(--text); background: var(--surface-1); }

.tab-content { animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================
   Rules / Scoring
   ============================================ */

.rules-section { margin-bottom: 32px; }

.rules-section h4 {
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 12px;
    margin-top: 24px;
}

.rules-section h4:first-child { margin-top: 0; }
.rules-section p { color: var(--text-secondary); line-height: 1.8; margin-bottom: 12px; }

.rules-list { list-style: none; padding: 0; margin: 16px 0; }

.rules-list li {
    color: var(--text-secondary);
    padding: 10px 0 10px 28px;
    position: relative;
    line-height: 1.6;
}

.rules-list li::before {
    content: "→";
    position: absolute; left: 0;
    color: var(--accent);
    font-weight: bold;
    font-size: 16px;
}

.rules-list li strong { color: var(--text); }

.scoring-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.scoring-item {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: var(--transition);
}

.scoring-item:hover { background: var(--surface-2); transform: translateY(-2px); }

.scoring-item.positive { border-left: 3px solid var(--success); }
.scoring-item.negative { border-left: 3px solid var(--accent); }
.scoring-item.neutral  { border-left: 3px solid var(--border); }
.scoring-item.captain  { border-left: 3px solid var(--gold); background: rgba(212,168,67,0.04); }
.scoring-item.special  { border-left: 3px solid var(--gold); background: rgba(212,168,67,0.04); }

.scoring-badge {
    min-width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    font-family: var(--font-display, 'Inter', sans-serif);
    font-weight: 800; font-size: 15px;
    flex-shrink: 0;
}
.scoring-item.positive .scoring-badge { background: rgba(29,185,84,0.12); color: var(--success); }
.scoring-item.negative .scoring-badge { background: rgba(200,25,43,0.12); color: var(--accent); }
.scoring-item.neutral  .scoring-badge { background: var(--surface-2); color: var(--text-secondary); }
.scoring-item.captain  .scoring-badge { background: rgba(212,168,67,0.15); color: var(--gold-light); }
.scoring-item.special  .scoring-badge { background: rgba(212,168,67,0.15); color: var(--gold-light); }

.scoring-icon { font-size: 28px; min-width: 36px; text-align: center; }
.scoring-details h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.scoring-details p { color: var(--text-secondary); font-size: 13px; margin: 0; line-height: 1.5; }

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.tip-card {
    background: rgba(17,40,102,0.12);
    border: 1px solid rgba(17,40,102,0.25);
    border-radius: var(--radius);
    padding: 22px;
    transition: var(--transition);
}

.tip-card:hover {
    background: rgba(17,40,102,0.2);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.tip-card h4 { color: var(--text); font-size: 15px; margin-bottom: 10px; }
.tip-card p { color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin: 0; }

.faq-item {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.faq-item:hover { background: var(--surface-2); }
.faq-item h4 { color: var(--text); font-size: 15px; margin-bottom: 8px; }
.faq-item p { color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin: 0; }

/* ============================================
   Utilities
   ============================================ */

.hidden   { display: none !important; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 968px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .picks-grid { grid-template-columns: repeat(2, 1fr); }
    .scoring-grid { grid-template-columns: repeat(2, 1fr); }
    .tips-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    /* Navigation */
    nav .container { flex-direction: row; gap: 8px; padding: 10px 12px; }
    .nav-links { flex-wrap: nowrap; justify-content: flex-end; gap: 2px; }
    .nav-links a { padding: 6px 8px; font-size: 12px; white-space: nowrap; }
    .logo { font-size: 16px; }
    .nav-logo { height: 24px; }
    .nav-gear-btn { width: 32px; height: 32px; font-size: 15px; }
    
    /* Layout */
    .container { padding: 16px 12px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .picks-grid { grid-template-columns: 1fr; }
    .scoring-grid { grid-template-columns: 1fr; }
    .tips-grid { grid-template-columns: 1fr; }
    
    /* Cards */
    .card { padding: 18px; }
    .card-header h3 { font-size: 16px; }
    .auth-card { padding: 28px 20px; max-width: 95%; }
    
    /* Tables */
    .leaderboard-table th,
    .leaderboard-table td { padding: 8px 6px; font-size: 12px; }
    table { font-size: 12px; }
    .supertry-table { table-layout: fixed; }
    .supertry-table th:nth-child(1),
    .supertry-table td:nth-child(1) { width: 28px; }
    .supertry-table th:nth-child(4),
    .supertry-table td:nth-child(4) { width: 40px; text-align: center; }
    .supertry-table th:nth-child(5),
    .supertry-table td:nth-child(5) { width: 50px; text-align: center; }
    
    /* Forms */
    .form-group label { font-size: 13px; }
    .form-group input,
    .form-group select { font-size: 14px; padding: 10px 12px; }
    
    /* Buttons */
    .btn { padding: 10px 18px; font-size: 14px; }
    .btn-lg { padding: 12px 24px; font-size: 15px; }
    
    /* Typography */
    main h2 { font-size: 22px; }
    h3 { font-size: 18px; }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .stat-number { font-size: 36px; }
    .auth-card h1 { font-size: 22px; }
    .logo { font-size: 14px; gap: 4px; }
    .nav-logo { height: 22px; }
    
    /* Navigation compact */
    .nav-links { gap: 1px; }
    .nav-links a { padding: 5px 6px; font-size: 11px; }
    .nav-gear-btn { width: 30px; height: 30px; font-size: 14px; }
    
    /* Forms compact */
    .form-row { grid-template-columns: 1fr; gap: 12px; }
    .auth-tabs { gap: 6px; }
    .auth-tab { padding: 10px 16px; font-size: 13px; }
    
    /* Tables horizontal scroll */
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 500px; }
    
    /* Buttons full width on mobile */
    .btn-block { width: 100%; }
    .quick-actions .button-group { flex-direction: column; gap: 10px; }
    .quick-actions .btn { width: 100%; }
    
    /* Header spacing */
    .dashboard-header h2 { font-size: 20px; }
    .dashboard-header p { font-size: 13px; }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .auth-card { max-width: 80%; padding: 24px; }
    .nav-links { flex-direction: row; }
}

/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .container { max-width: 90%; }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Better touch targets */
    .btn { min-height: 44px; }
    .nav-links a { min-height: 44px; display: flex; align-items: center; }
    .auth-tab { min-height: 44px; }
    
    /* Remove hover effects on touch */
    .btn:hover { transform: none; }
    
    /* Active/tap feedback */
    .btn:active { 
        transform: scale(0.97); 
        opacity: 0.9;
    }
    
    a:active, button:active {
        opacity: 0.8;
    }
    
    /* Larger form elements */
    input, select, textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* ============================================
   Cancha de Rugby - Field Visualization
   ============================================ */

.campo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin: 24px auto;
    max-width: 680px;
    padding: 0 140px 0 0;
    position: relative;
}

.campo-titulo {
    font-family: var(--font-display);
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.5;
}

/* Media cancha de rugby */
.campo {
    position: relative;
    width: 520px;
    max-width: 100%;
    aspect-ratio: 520 / 420;
    background: #2d7a2d;
    border-radius: 4px 4px 0 0;
    overflow: visible;
    box-shadow:
        0 0 0 3px rgba(255,255,255,0.05),
        0 0 0 5px var(--border),
        var(--shadow-lg);
}

/* Línea del medio (borde inferior más visible) */
.campo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.55);
}

/* Franjas de césped */
.campo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        180deg,
        transparent 0px,
        transparent 48px,
        rgba(0,0,0,0.07) 48px,
        rgba(0,0,0,0.07) 96px
    );
    pointer-events: none;
    border-radius: 4px 4px 0 0;
}

/* Líneas de la cancha */
.linea-ingoal {
    position: absolute;
    top: 14.3%;
    left: 10px;
    right: 10px;
    height: 2px;
    background: rgba(255,255,255,0.35);
}

.linea-22 {
    position: absolute;
    top: 45.2%;
    left: 10px;
    right: 10px;
    height: 1.5px;
    background: rgba(255,255,255,0.22);
}

/* Postes H de rugby */
.postes {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 160px;
    pointer-events: none;
}

.palo-izq, .palo-der {
    position: absolute;
    top: 0;
    width: 3px;
    height: 100%;
    background: rgba(255,255,255,0.78);
    border-radius: 2px;
}

.palo-izq { left: 0; }
.palo-der { right: 0; }

.travesanio {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.78);
    border-radius: 2px;
}

/* Etiquetas de zona */
.etiqueta-zona {
    position: absolute;
    right: 10px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.22);
    writing-mode: vertical-rl;
    text-transform: uppercase;
}

.etiqueta-zona.top { top: 16.7%; }
.etiqueta-zona.mid { top: 57.1%; }

/* Jugadores */
.jugador {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.jugador:hover {
    z-index: 10;
}

/* Hover específico para jugadores con centrado */
.j1:hover, .j2:hover, .j3:hover, 
.j4:hover, .j5:hover, .j6:hover {
    transform: translateX(-50%) scale(1.12) translateY(-12px);
}

.jugador svg {
    width: 52px;
    height: 58px;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.55));
}

.jugador-nombre {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    white-space: nowrap;
    background: rgba(0,0,0,0.65);
    padding: 3px 7px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
}

.jugador.empty .jugador-nombre {
    opacity: 0.4;
    font-style: italic;
}

/* Posiciones - Triángulo forwards */
.j1 { top: 17.9%;  left: 22.1%; transform: translateX(-50%); }
.j2 { top: 35.2%; left: 14.8%;  transform: translateX(-50%); }
.j3 { top: 35.2%; left: 31%; transform: translateX(-50%); }

/* Posiciones - Backs escalonados */
.j4 { top: 54.3%; left: 36.5%; transform: translateX(-50%); }
.j5 { top: 64.8%; left: 57.7%; transform: translateX(-50%); }
.j6 { top: 75.2%; left: 78.8%; transform: translateX(-50%); }

/* Posición - SuperChode (fuera de formación, esquina derecha) */
.j-superchode { 
    top: 22.6%; 
    right: 3.8%; 
    left: auto;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.j-superchode .jugador-nombre {
    background: linear-gradient(135deg, rgba(212,168,67,0.3), rgba(240,201,90,0.3));
    border: 1px solid var(--gold);
    color: var(--gold-light);
    font-weight: 800;
}

.j-superchode svg {
    filter: drop-shadow(0 3px 12px rgba(212,168,67,0.4));
}

.j-superchode:hover {
    transform: scale(1.15) translateY(-12px);
}

/* Posición - SuperTry (al lado izquierdo del SuperChode) */
.j-supertry { 
    top: 22.6%; 
    right: 18.3%;
    left: auto;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.j-supertry .jugador-nombre {
    background: linear-gradient(135deg, rgba(46,204,113,0.3), rgba(39,174,96,0.3));
    border: 1px solid #2ecc71;
    color: #2ecc71;
    font-weight: 800;
    text-shadow: 0 0 8px rgba(46,204,113,0.5);
}

.j-supertry svg {
    filter: drop-shadow(0 3px 12px rgba(46,204,113,0.4));
}

.j-supertry:hover {
    transform: scale(1.15) translateY(-12px);
}

/* Posición - SuperEquipo Badge (división elegida, derecha de cancha) */
.super-equipo-badge {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 120px;
    padding: 16px 12px;
    background: linear-gradient(135deg, rgba(52,152,219,0.15), rgba(41,128,185,0.1));
    border: 2px solid #3498db;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(52,152,219,0.3);
    z-index: 5;
}

.super-equipo-badge .badge-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    display: block;
}

.super-equipo-badge .badge-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 800;
    color: #5dade2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.super-equipo-badge .badge-team {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    color: #3498db;
    line-height: 1.2;
}

/* Responsive cancha */
@media (max-width: 860px) {
    .campo-wrapper {
        padding: 0 140px 0 0;
        max-width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 700px) {
    .campo-wrapper {
        padding: 0 8px;
        max-width: 100%;
    }

    .campo {
        width: 100%;
    }

    .campo-titulo {
        font-size: 14px;
        letter-spacing: 2px;
    }

    .jugador svg {
        width: 40px;
        height: 46px;
    }

    .jugador-nombre {
        font-size: 8px;
        padding: 2px 4px;
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Move SuperEquipo badge below the campo on mobile */
    .super-equipo-badge {
        position: static;
        width: 100%;
        margin-top: 0;
        display: flex !important;
        align-items: center;
        gap: 10px;
        padding: 12px 16px;
        transform: none;
    }

    .super-equipo-badge .badge-icon {
        font-size: 1.8rem;
        margin-bottom: 0;
    }

    .super-equipo-badge .badge-label {
        margin-bottom: 0;
    }

    .postes {
        top: -70px;
        height: 120px;
        width: 60px;
    }
}

@media (max-width: 400px) {
    .jugador svg {
        width: 32px;
        height: 36px;
    }

    .jugador-nombre {
        font-size: 7px;
        padding: 1px 3px;
        max-width: 50px;
    }

    .postes {
        top: -50px;
        height: 90px;
        width: 48px;
    }
}

/* Cancha interactivity */
.jugador-interactive {
    cursor: pointer;
}

.jugador-interactive.empty .jugador-nombre::before {
    content: '+ ';
    opacity: 0.7;
}

.jugador-tapped svg {
    animation: jersey-pulse 0.5s ease !important;
}

@keyframes jersey-pulse {
    0% { filter: drop-shadow(0 3px 8px rgba(0,0,0,0.55)); }
    35% { filter: drop-shadow(0 0 20px rgba(200,25,43,0.9)) brightness(1.35); }
    100% { filter: drop-shadow(0 3px 8px rgba(0,0,0,0.55)); }
}

.jugador-interactive.empty svg {
    animation: empty-pulse 2.5s ease-in-out infinite;
}

@keyframes empty-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.75; }
}

.super-equipo-badge[style*="cursor"] {
    transition: all 0.25s ease;
}

.super-equipo-badge[style*="cursor"]:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(52,152,219,0.5);
}

@media (max-width: 700px) {
    .super-equipo-badge[style*="cursor"]:hover {
        transform: none;
    }
}

/* ============================================
   Profile Page
   ============================================ */

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px 0 24px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(200, 25, 43, 0.35);
}

.profile-header-info h2 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.profile-team-name {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.profile-card {
    max-width: 720px;
    margin-bottom: 40px;
}

.profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.nav-user-link {
    color: var(--light);
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}

.nav-user-link:hover {
    color: var(--gold);
}

@media (max-width: 768px) {
    .profile-header {
        gap: 16px;
        padding: 24px 0 16px;
    }
    .profile-avatar {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }
    .profile-header-info h2 {
        font-size: 22px;
    }
    .profile-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .profile-avatar {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    .profile-header-info h2 {
        font-size: 20px;
    }
}

/* ============================================
   Nav — How to Play link
   ============================================ */

.nav-howto-link {
    color: var(--gold) !important;
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
    cursor: pointer;
    font-weight: 500;
}

.nav-howto-link:hover {
    color: var(--gold-light) !important;
    opacity: 0.9;
}