:root {
    --primary: #0f172a;
    --accent: #d97706;
    --accent-hover: #b45309;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #334155;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background-color: var(--bg); color: var(--text); line-height: 1.5; }

.app-header { background-color: var(--primary); color: white; padding: 2rem 1rem; text-align: center; border-bottom: 4px solid var(--accent); }
.header-container h1 { cursor: pointer; font-weight: 900; letter-spacing: -0.05em; font-size: 2.2rem; }
.season-badge { background-color: var(--accent); display: inline-block; padding: 0.3rem 1rem; border-radius: 9999px; font-size: 0.85rem; font-weight: bold; margin-top: 0.5rem; letter-spacing: 0.05em; }

/* Global Autocomplete Search Style Overlays */
.search-container-box { position: relative; max-width: 550px; margin: 1.5rem auto 0 auto; }
#portal-search-bar { width: 100%; padding: 0.85rem 1.25rem; border-radius: 8px; border: 2px solid transparent; font-size: 1rem; outline: none; color: var(--primary); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); transition: all 0.2s; }
#portal-search-bar:focus { border-color: var(--accent); }
.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 0 0 8px 8px; max-height: 320px; overflow-y: auto; z-index: 9999; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15); text-align: left; margin-top: 2px; }
.search-row-item { padding: 0.75rem 1.25rem; cursor: pointer; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; transition: background 0.15s; }
.search-row-item:hover { background-color: #f1f5f9; color: var(--accent); }
.search-row-item .filter-tag { font-size: 0.7rem; background: #e2e8f0; padding: 0.2rem 0.5rem; border-radius: 4px; color: #475569; font-weight: 700; text-transform: uppercase; }
.hidden { display: none !important; }

/* Structural Pyramid Visual Layout */
.app-container { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; min-height: 75vh; }
.tree-container { display: flex; flex-direction: column; align-items: center; gap: 1.75rem; padding: 1rem 0; }
.tree-level { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; width: 100%; }
.tree-node { background: var(--surface); border: 2px solid var(--primary); border-radius: 8px; padding: 1rem; text-align: center; min-width: 260px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); cursor: pointer; transition: transform 0.2s, border-color 0.2s; }
.tree-node:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.tree-node h4 { font-size: 0.95rem; color: var(--primary); font-weight: 700; margin-top: 0.2rem; }
.tree-node p.tier-indicator { font-size: 0.75rem; font-weight: 800; color: var(--accent); text-transform: uppercase; }

/* Layout Grid Matrix */
.layout-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; margin-top: 1.5rem; }
@media (max-width: 768px) { .layout-grid { grid-template-columns: 1fr; } }
.card { background: var(--surface); padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
h2, h3 { color: var(--primary); margin-bottom: 1rem; font-weight: 800; }
.btn-back { display: inline-block; background: var(--primary); color: white; padding: 0.5rem 1.25rem; border-radius: 4px; text-decoration: none; font-size: 0.9rem; margin-bottom: 1.5rem; font-weight: 600; transition: background 0.15s; }
.btn-back:hover { background: var(--accent); }

/* High-Density Data Tables */
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.95rem; }
th { background-color: #f1f5f9; color: var(--primary); font-weight: 700; }
tr:hover { background-color: #f8fafc; }

/* Graphical Image Logo Handler Rules */
.logo-container { display: flex; align-items: center; gap: 0.85rem; }
.team-logo-img { width: 34px; height: 34px; object-fit: contain; border-radius: 4px; background: transparent; }
.club-badge-fallback { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 6px; color: white; font-weight: 800; font-size: 0.85rem; border: 1px solid rgba(0,0,0,0.1); text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.clickable-row { cursor: pointer; color: var(--primary); transition: color 0.15s; }
.clickable-row:hover { color: var(--accent); }

.empty-notice { background: #fffbeb; border-left: 4px solid var(--accent); padding: 1rem; border-radius: 4px; color: #b45309; font-size: 0.9rem; font-weight: 500; }
.sub-teams-container { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-team { background: #e2e8f0; padding: 0.4rem 0.8rem; border-radius: 999px; font-size: 0.85rem; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--primary); transition: all 0.15s; }
.tag-team:hover { background: var(--accent); color: white; }
#club-map { height: 300px; width: 100%; border-radius: 6px; border: 1px solid var(--border); margin-top: 0.5rem; }
#league-map { height: 380px; width: 100%; border-radius: 8px; border: 1px solid var(--border); margin-top: 1rem; overflow: hidden; }
.league-map-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.8fr); gap: 1rem; align-items: stretch; margin-bottom: 1.5rem; }
.league-map-card, .league-map-list-card { margin-bottom: 0; }
.league-map-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.league-map-header h3 { margin-bottom: 0.2rem; }
.league-map-header p { color: #64748b; font-size: 0.9rem; margin: 0; }
.map-count-pill { flex-shrink: 0; background: #0f172a; color: white; border-radius: 999px; padding: 0.35rem 0.7rem; font-size: 0.75rem; font-weight: 800; }
.league-map-team-list { display: grid; gap: 0.55rem; max-height: 384px; overflow-y: auto; padding-right: 0.2rem; }
.league-map-team { display: grid; gap: 0.15rem; padding: 0.65rem 0.75rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; color: var(--primary); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.league-map-team:hover { border-color: var(--accent); transform: translateY(-1px); }
.league-map-team span { color: #64748b; font-size: 0.84rem; }
.app-footer { text-align: center; padding: 2.5rem; color: #64748b; font-size: 0.85rem; border-top: 1px solid var(--border); margin-top: 5rem; }

.team-avatar { width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12); background: linear-gradient(135deg, #f8fafc, #e2e8f0); }
.team-avatar-image { width: 100%; height: 100%; object-fit: contain;}
.team-avatar-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--primary); color: white; font-size: 1.2rem; font-weight: 800; letter-spacing: 0.04em; }
.club-logo-fallback { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: var(--primary); font-weight: 800; }
.team-hero-card { background: linear-gradient(135deg, #0f172a, #1d4ed8); color: white; border-radius: 16px; padding: 1.4rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2); }
.team-hero-main { display: flex; align-items: center; gap: 1rem; }
.team-hero-main h2 { color: white; margin: 0 0 0.25rem 0; font-size: 1.5rem; }
.team-hero-main p { margin: 0; color: rgba(255,255,255,0.82); }
.hero-eyebrow { font-size: 0.77rem; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(255,255,255,0.72); margin-bottom: 0.35rem; font-weight: 700; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: flex-end; }
.info-pill { background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.2); padding: 0.45rem 0.8rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.info-pill-link { color: white; text-decoration: none; transition: background 0.15s, border-color 0.15s; }
.info-pill-link:hover { background: rgba(255,255,255,0.24); border-color: rgba(255,255,255,0.38); }
.match-list { display: grid; gap: 0.8rem; }
.team-insight-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.insight-card { background: linear-gradient(135deg, #ffffff, #f8fafc); border: 1px solid #e2e8f0; border-radius: 14px; padding: 1rem 1.1rem; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06); }
.insight-title { font-size: 0.92rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: #0f172a; margin-bottom: 0.75rem; }
.insight-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; }
.insight-metric { background: #fff; border-radius: 10px; padding: 0.8rem; border: 1px solid #e2e8f0; text-align: center; }
.insight-metric strong { display: block; font-size: 1.1rem; color: #0f172a; }
.insight-metric span { font-size: 0.78rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.06em; }
.insight-list { list-style: none; display: grid; gap: 0.55rem; color: #334155; padding: 0; }
.insight-list li { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.6rem 0.75rem; }
.schedule-list { display: grid; gap: 0.7rem; }
.schedule-stack { display: grid; gap: 0.8rem; }
.schedule-entry { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 0.9rem 1rem; }
.schedule-entry-result { border-left: 4px solid #0f766e; }
.schedule-entry-upcoming { border-left: 4px solid #d97706; }
.schedule-entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem; }
.schedule-label { font-size: 0.72rem; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 0.08em; }
.schedule-entry-body { display: flex; flex-direction: column; gap: 0.2rem; }
.schedule-entry-body strong { color: #0f172a; }
.schedule-entry-body span { color: #64748b; font-size: 0.9rem; }
.schedule-entry-score { margin-top: 0.45rem; font-weight: 800; color: #0f172a; }
.schedule-badge { display: inline-flex; align-items: center; background: #0f172a; color: white; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.schedule-badge-upcoming { background: #d97706; }
.schedule-badge-result { background: #0f766e; }
.match-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 0.9rem 1rem; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.match-card:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08); }
.match-card-highlight { border-color: #d97706; background: #fff7ed; }
.match-card-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 0.35rem; }
.match-card-meta { color: #64748b; font-size: 0.9rem; }
.match-card-score { margin-top: 0.5rem; font-weight: 800; color: #0f172a; }
.match-badge { display: inline-flex; align-items: center; background: #0f172a; color: white; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.match-badge-upcoming { background: #d97706; }
.match-detail { margin-top: 0.4rem; padding: 0.75rem 0.9rem; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; color: #334155; }
.standings-table a { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; }
@media (max-width: 768px) { .team-hero-card { flex-direction: column; align-items: flex-start; } .hero-pills { justify-content: flex-start; } .league-map-grid { grid-template-columns: 1fr; } #league-map { height: 320px; } }

/* High-Contrast Squad Registration Status Badges */
.squad-count-badge {
    display: inline-block;
    background-color: #1e293b !important; /* Rich Dark slate background */
    color: #ffffff !important;            /* Crisp white text for absolute readability */
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 0.6rem;
    letter-spacing: 0.02em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Subtle tier category alignment tweaks */
.tree-node p.tier-indicator {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
}

/* Navigation container on the profile page */
.profile-nav-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
}

/* Base style for navigation items */
.btn-nav-back, .btn-nav-club {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

/* ← Back to Table (Slightly subdued, secondary action style) */
.btn-nav-back {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.btn-nav-back:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

/* ℹ️ View Club Info (Action highlight style) */
.btn-nav-club {
    background-color: var(--primary, #0284c7);
    color: #ffffff !important;
    border: 1px solid transparent;
}
.btn-nav-club:hover {
    background-color: var(--primary-dark, #0369a1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
