/* CSS Variables - Dark Mode (Default) */
:root {
    --primary: #1a472a;
    --primary-light: #2d5a3d;
    --primary-dark: #0f2d1a;
    --accent: #4ade80;
    --accent-light: #86efac;
    --secondary: #1e3a5f;
    --bg-dark: #0a0f0d;
    --bg-card: #111916;
    --bg-card-hover: #1a2420;
    --text-primary: #f0fdf4;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: #1f2f27;
    --win: #22c55e;
    --draw: #f59e0b;
    --loss: #ef4444;

    /* Percentile colors */
    --perc-low: #ef4444;
    --perc-mid: #f59e0b;
    --perc-high: #22c55e;
}

/* Light Mode */
[data-theme="light"] {
    --primary: #2d5a3d;
    --primary-light: #3d7a52;
    --primary-dark: #1a472a;
    --accent: #16a34a;
    --accent-light: #22c55e;
    --secondary: #3b82f6;
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #475569;
    --border: #e2e8f0;
    --win: #16a34a;
    --draw: #d97706;
    --loss: #dc2626;
}

/* Light mode specific overrides */
[data-theme="light"] .dashboard-header {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
}

[data-theme="light"] .header-brand h1 {
    -webkit-text-fill-color: #4ade80;
}

[data-theme="light"] .sidebar {
    background: #ffffff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .nav-item.active {
    background: linear-gradient(135deg, #16a34a 0%, #2d5a3d 100%);
    color: #ffffff;
}

[data-theme="light"] .nav-item.sub-nav.active {
    background: #2d5a3d;
    color: #4ade80;
}

[data-theme="light"] .context-card,
[data-theme="light"] .formations-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .analysis-tabs {
    background: #2d5a3d;
}

[data-theme="light"] .sub-tab-btn {
    color: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .sub-tab-btn:hover {
    color: #ffffff;
}

[data-theme="light"] .sub-tab-btn.active {
    background: #16a34a;
    color: #ffffff;
}

[data-theme="light"] .header-tagline {
    color: rgba(255, 255, 255, 0.8);
    border-left-color: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .header-btn {
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .header-btn:hover {
    background: #4ade80;
    color: #0f172a;
    border-color: #4ade80;
}

[data-theme="light"] .header-actions .lang-selector select {
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .menu-toggle span {
    background: #ffffff;
}

/* Light mode - Modal & Carousel overrides */
[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .modal-content,
[data-theme="light"] .carousel-container {
    background: #ffffff;
    border-color: var(--accent);
}

[data-theme="light"] .modal-header,
[data-theme="light"] .carousel-header {
    background: #2d5a3d;
}

[data-theme="light"] .modal-header h2,
[data-theme="light"] .carousel-header h2 {
    color: #4ade80;
}

[data-theme="light"] .modal-close,
[data-theme="light"] .carousel-close {
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="light"] .modal-close:hover,
[data-theme="light"] .carousel-close:hover {
    color: #4ade80;
}

[data-theme="light"] .modal-card,
[data-theme="light"] .carousel-slide {
    background: #f8fafc;
}

[data-theme="light"] .card-content h3,
[data-theme="light"] .carousel-slide h3 {
    color: #16a34a;
}

[data-theme="light"] .card-content p,
[data-theme="light"] .slide-body,
[data-theme="light"] .slide-intro,
[data-theme="light"] .slide-list-item {
    color: #334155;
}

[data-theme="light"] .card-content strong,
[data-theme="light"] .slide-list-item strong,
[data-theme="light"] .step-content strong,
[data-theme="light"] .takeaway-item strong {
    color: #0f172a;
}

[data-theme="light"] .card-icon {
    background: #2d5a3d;
}

[data-theme="light"] .modal-table th {
    background: #2d5a3d;
    color: #ffffff;
}

[data-theme="light"] .modal-table td {
    background: #ffffff;
    color: #334155;
}

[data-theme="light"] .modal-table tr.highlight-row td {
    background: rgba(22, 163, 74, 0.15);
    color: #16a34a;
}

[data-theme="light"] .carousel-footer {
    background: #f1f5f9;
    border-top-color: #e2e8f0;
}

[data-theme="light"] .carousel-btn {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #334155;
}

[data-theme="light"] .carousel-btn:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

[data-theme="light"] .dot {
    background: #cbd5e1;
}

[data-theme="light"] .dot.active {
    background: #16a34a;
}

[data-theme="light"] .slide-highlight,
[data-theme="light"] .insight-box,
[data-theme="light"] .slide-insight {
    background: #f0fdf4;
    border-color: #16a34a;
}

[data-theme="light"] .concept-box.overload {
    background: rgba(22, 163, 74, 0.1);
}

[data-theme="light"] .concept-box.underload {
    background: rgba(220, 38, 38, 0.1);
}

[data-theme="light"] .clue-item,
[data-theme="light"] .formation-box,
[data-theme="light"] .steps-guide .step-item,
[data-theme="light"] .takeaway-item {
    background: #f1f5f9;
}

[data-theme="light"] .clue-stat {
    background: #2d5a3d;
    color: #4ade80;
}

[data-theme="light"] .slide-tip {
    background: rgba(217, 119, 6, 0.1);
    border-color: #d97706;
    color: #b45309;
}

[data-theme="light"] .final-note {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
}

[data-theme="light"] .final-note p {
    color: #ffffff;
}

[data-theme="light"] .final-note strong {
    color: #4ade80;
}

/* Light mode - Carousel buttons text fix */
[data-theme="light"] .carousel-btn {
    background: #2d5a3d;
    border-color: #2d5a3d;
    color: #ffffff;
}

[data-theme="light"] .carousel-btn:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

/* Light mode - Slide highlight text */
[data-theme="light"] .slide-highlight {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
    border-color: #16a34a;
}

[data-theme="light"] .slide-highlight,
[data-theme="light"] .slide-highlight p {
    color: #ffffff;
}

[data-theme="light"] .highlight-icon {
    color: #4ade80;
}

/* Light mode - Formation diagram */
[data-theme="light"] .formation-box {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .formation-label {
    color: #16a34a;
}

[data-theme="light"] .formation-visual {
    color: #0f172a;
}

[data-theme="light"] .transform-arrow {
    color: #16a34a;
}

/* Light mode - Stat items */
[data-theme="light"] .stat-item.good {
    background: rgba(22, 163, 74, 0.15);
    color: #16a34a;
}

[data-theme="light"] .stat-item.bad {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626;
}

/* Light mode - Slide insight */
[data-theme="light"] .slide-insight {
    background: #2d5a3d;
}

[data-theme="light"] .slide-insight,
[data-theme="light"] .slide-insight p {
    color: #ffffff;
}

[data-theme="light"] .insight-title {
    color: #4ade80;
}

/* Light mode - Insight box */
[data-theme="light"] .insight-box {
    background: #2d5a3d;
}

[data-theme="light"] .insight-box p {
    color: #ffffff;
}

/* Light mode - Concept boxes text */
[data-theme="light"] .concept-box h4 {
    color: #0f172a;
}

[data-theme="light"] .concept-box p {
    color: #334155;
}

[data-theme="light"] .example-zone {
    background: #ffffff;
    color: #334155;
}

/* Light mode - Clue meaning */
[data-theme="light"] .clue-meaning {
    color: #0f172a;
}

/* Light mode - Steps guide */
[data-theme="light"] .step-content p {
    color: #334155;
}

/* Light mode - Takeaway items */
[data-theme="light"] .takeaway-item {
    color: #334155;
}

[data-theme="light"] .takeaway-icon {
    color: #16a34a;
}

/* Light mode - Theme toggle icon (light icon should be white in header) */
[data-theme="light"] .theme-icon.light {
    filter: invert(1);
}

/* Light mode - Active nav item icon should be white */
[data-theme="light"] .nav-item.active .svg-icon {
    filter: brightness(0) invert(1);
}

/* Light mode - Modal body fixes */
[data-theme="light"] .modal-body {
    background: #ffffff;
}

[data-theme="light"] .modal-card {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-theme="light"] .modal-card.highlight-card {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.1) 0%, #f8fafc 100%);
    border-color: #16a34a;
}

[data-theme="light"] .card-content p {
    color: #334155;
}

[data-theme="light"] .card-content em {
    color: #16a34a;
}

[data-theme="light"] .example-note {
    background: rgba(217, 119, 6, 0.1);
    color: #b45309;
}

[data-theme="light"] .steps-list .step-item {
    color: #334155;
}

[data-theme="light"] .small-text {
    color: #64748b;
}

[data-theme="light"] .text-green {
    color: #16a34a;
}

[data-theme="light"] .text-red {
    color: #dc2626;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ==================== DASHBOARD LAYOUT ==================== */
.dashboard {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: 60px 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    min-height: 100vh;
}

/* Dashboard Header */
.dashboard-header {
    grid-area: header;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Menu Toggle (Hamburger) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

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

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

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

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: var(--primary);
    border-color: var(--accent);
}

.theme-icon {
    position: absolute;
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
}

.theme-icon.light {
    opacity: 0;
    transform: translateY(20px);
    filter: invert(1);
}

.theme-icon.dark {
    opacity: 1;
    transform: translateY(0);
    filter: invert(1);
}

[data-theme="light"] .theme-icon.light {
    opacity: 1;
    transform: translateY(0);
    filter: invert(1);
}

[data-theme="light"] .theme-icon.dark {
    opacity: 0;
    transform: translateY(-20px);
    filter: none;
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
}

.header-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-left: 15px;
    border-left: 1px solid var(--border);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}

.header-btn .btn-icon {
    font-size: 1rem;
    font-weight: bold;
}

/* Language Selector */
.lang-selector {
    display: flex;
    align-items: center;
}

.lang-selector select {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.lang-selector select:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.lang-selector select:focus {
    outline: none;
    border-color: var(--accent);
}

.lang-selector select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.sidebar-section {
    padding: 0 15px;
    margin-bottom: 25px;
}

.sidebar-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 15px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    margin-bottom: 5px;
}

.nav-item:hover:not(:disabled) {
    background: rgba(74, 222, 128, 0.1);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    color: var(--bg-dark);
    font-weight: 600;
}

.nav-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-item.sub-nav {
    padding: 10px 15px;
    font-size: 0.85rem;
}

.nav-item.sub-nav.active {
    background: var(--primary);
    color: var(--accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* SVG Icon Styling */
.svg-icon {
    filter: invert(1) brightness(0.7);
    transition: filter 0.2s ease;
}

.nav-item.active .svg-icon,
.nav-item:hover .svg-icon {
    filter: invert(48%) sepia(79%) saturate(417%) hue-rotate(93deg) brightness(95%) contrast(88%);
}

/* Light mode SVG icons - keep black */
[data-theme="light"] .svg-icon {
    filter: none;
}

[data-theme="light"] .nav-item:hover .svg-icon {
    filter: invert(31%) sepia(98%) saturate(384%) hue-rotate(101deg) brightness(92%) contrast(89%);
}

[data-theme="light"] .nav-item.active .svg-icon {
    filter: brightness(0) invert(1);
}

.sidebar-footer {
    margin-top: auto;
    padding: 15px 25px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Main Content */
.main-content {
    grid-area: main;
    padding: 25px;
    overflow-y: auto;
    background: var(--bg-dark);
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

.section-header {
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

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

.section-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Context Grid */
.context-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

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

.context-card .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.context-card .card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.context-card .card-icon {
    width: 24px;
    height: 24px;
    filter: invert(1) brightness(0.8);
}

[data-theme="light"] .context-card .card-icon {
    filter: none;
}

.context-card .card-body {
    padding: 20px;
}

.opponent-card {
    border-left: 3px solid var(--loss);
}

.your-card {
    border-left: 3px solid var(--accent);
}

.form-group {
    margin-bottom: 15px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group select {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-group select:hover {
    border-color: var(--primary-light);
}

.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Formations Card */
.formations-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.formations-card .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.formations-card .card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.formations-card .card-header h3 span {
    color: var(--loss);
}

.formations-card .card-icon {
    width: 24px;
    height: 24px;
    filter: invert(1) brightness(0.8);
}

[data-theme="light"] .formations-card .card-icon {
    filter: none;
}

.formations-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--primary-dark);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 15px;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-control {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-control:hover {
    background: var(--primary);
    color: var(--text-primary);
    border-color: var(--primary);
}

.formations-card .formations-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 0;
    max-height: 400px;
    overflow-y: auto;
}

.formations-card .analyze-btn {
    margin: 0 20px 20px;
    width: calc(100% - 40px);
}

/* Analysis Tabs */
.analysis-tabs {
    background: var(--primary);
    padding: 12px 15px;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}

.analysis-tabs .sub-tabs {
    display: none;
    gap: 8px;
    flex-wrap: wrap;
}

.analysis-tabs .sub-tabs.active {
    display: flex;
}

/* Hide old parent tabs */
.parent-tabs {
    display: none;
}

.sub-tabs-container {
    display: none;
}

/* ==================== END DASHBOARD LAYOUT ==================== */

/* App Container (legacy - keep for compatibility) */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header (legacy) */
.header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 25px;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Setup Section */
.setup-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.setup-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}

.setup-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.opponent-panel {
    border-left: 3px solid var(--loss);
}

.your-panel {
    border-left: 3px solid var(--accent);
}

.setup-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.selector-group {
    flex: 1;
    min-width: 150px;
}

.selector-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

select:hover {
    border-color: var(--primary-light);
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Formation Selector */
.formation-selector {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    margin-bottom: 25px;
}

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

.selector-header h2 {
    font-size: 1.1rem;
}

.selector-header h2 span {
    color: var(--loss);
}

.selector-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-small {
    padding: 6px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: var(--primary);
    color: var(--text-primary);
    border-color: var(--primary);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.control-group select {
    width: auto;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.control-group input[type="range"] {
    width: 80px;
    cursor: pointer;
}

.control-group span {
    font-size: 0.85rem;
    color: var(--accent);
    min-width: 25px;
}

/* Formations Grid */
.formations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.formation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.formation-item:hover {
    border-color: var(--primary-light);
}

.formation-item.selected {
    border-color: var(--accent);
    background: rgba(74, 222, 128, 0.1);
}

.formation-item.low-confidence {
    opacity: 0.6;
}

.formation-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.formation-info {
    flex: 1;
}

.formation-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.formation-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.formation-meta .win-rate {
    color: var(--win);
}

.confidence-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--bg-card);
}

.confidence-badge.high {
    color: var(--win);
}

.confidence-badge.low {
    color: var(--draw);
}

/* Analyze Button */
.analyze-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    color: var(--bg-dark);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.analyze-btn .btn-icon {
    width: 20px;
    height: 20px;
    filter: none;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.3);
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Results Section */
.results-section {
    animation: fadeIn 0.4s ease;
}

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

.results-header {
    text-align: center;
    margin-bottom: 25px;
}

.results-header h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.results-header h2 span {
    color: var(--loss);
}

.results-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Chart Panel */
.chart-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    margin-bottom: 25px;
}

.chart-panel h3 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.chart-help {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.scatter-container {
    height: 350px;
    position: relative;
}

/* Parent Category Tabs */
.parent-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    background: var(--bg-card);
    padding: 12px 12px 0 12px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
}

.parent-tab-btn {
    padding: 12px 24px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    top: 1px;
}

.parent-tab-btn .tab-icon {
    font-size: 1.1rem;
}

.parent-tab-btn:hover {
    background: var(--primary-dark);
    color: var(--text-primary);
}

.parent-tab-btn.active {
    background: var(--primary);
    border-color: var(--accent);
    color: var(--accent);
    z-index: 2;
}

/* Sub-tabs Container */
.sub-tabs-container {
    background: var(--primary);
    padding: 10px 15px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    margin-bottom: 0;
}

.sub-tabs {
    display: none;
    gap: 5px;
    flex-wrap: wrap;
}

.sub-tabs.active {
    display: flex;
}

.sub-tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sub-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.sub-tab-btn.active {
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 600;
}

/* Legacy tab support - hide old tabs */
.category-tabs {
    display: none;
}

/* Tab Content */
.tab-content-container {
    background: var(--bg-card);
    border-radius: 0 0 12px 12px;
    padding: 20px;
    border: 1px solid var(--border);
    border-top: none;
}

.tab-content {
    display: none;
}

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

/* Gauge Section */
.gauge-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border);
}

.gauge-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.gauge-header label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.metric-select {
    min-width: 250px;
}

/* Gauge Container */
.gauge-container {
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 20px;
}

.gauge-wrapper {
    position: relative;
    height: 80px;
    margin-bottom: 15px;
}

.gauge-track {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(to right,
        var(--perc-low) 0%,
        var(--perc-low) 35%,
        var(--perc-mid) 35%,
        var(--perc-mid) 65%,
        var(--perc-high) 65%,
        var(--perc-high) 100%
    );
}

.gauge-inverted-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.gauge-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    text-align: center;
    transition: left 0.3s ease;
}

.gauge-marker-dot {
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border: 3px solid var(--bg-dark);
    border-radius: 50%;
    margin: 0 auto 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.gauge-marker-label {
    font-size: 0.7rem;
    color: var(--text-primary);
    white-space: nowrap;
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 3px;
}

.gauge-marker-value {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* Analysis Report */
.analysis-report {
    background: linear-gradient(135deg, var(--bg-dark) 0%, rgba(26, 71, 42, 0.2) 100%);
    border: 1px solid var(--primary-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.analysis-report h3 {
    font-size: 1.1rem;
    color: var(--accent);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-report h3::before {
    content: '📊';
}

.report-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Recommendation Card */
.recommendation-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid var(--accent);
}

.recommendation-card.warning {
    border-left-color: var(--draw);
}

.recommendation-card.danger {
    border-left-color: var(--loss);
}

.recommendation-card h4 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommendation-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.recommendation-card .highlight {
    color: var(--accent);
    font-weight: 600;
}

.recommendation-card .warning-text {
    color: var(--draw);
}

.recommendation-card .danger-text {
    color: var(--loss);
}

/* Category Insights */
.category-insights {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.insight-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px 15px;
    border-left: 3px solid var(--accent);
}

.insight-card.strength {
    border-left-color: var(--win);
}

.insight-card.weakness {
    border-left-color: var(--loss);
}

.insight-card.neutral {
    border-left-color: var(--draw);
}

.insight-card .insight-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.insight-card .insight-formation {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.insight-card .insight-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.insight-card .insight-value {
    font-weight: 600;
    color: var(--accent);
}

.insight-card.weakness .insight-value {
    color: var(--loss);
}

/* Strengths and Weaknesses List */
.sw-section {
    margin-top: 15px;
}

.sw-section h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.sw-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sw-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    background: var(--bg-card);
}

.sw-tag.strength {
    border: 1px solid var(--win);
    color: var(--win);
}

.sw-tag.weakness {
    border: 1px solid var(--loss);
    color: var(--loss);
}

.sw-tag .formation {
    font-weight: 600;
}

.sw-tag .metric {
    color: var(--text-secondary);
}

.sw-tag .perc {
    font-weight: 600;
}

/* Metric Section */
.metric-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

/* Heatmap Table */
.heatmap-container {
    overflow-x: auto;
}

.heatmap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.heatmap-table th,
.heatmap-table td {
    padding: 10px 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.heatmap-table th {
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 10;
}

.heatmap-table th.formation-col {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 20;
    min-width: 140px;
}

.heatmap-table td.formation-col {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--bg-card);
    z-index: 5;
    font-weight: 600;
}

.heatmap-table td.formation-col .sample-size {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.heatmap-table th.metric-col {
    font-size: 0.75rem;
    max-width: 100px;
    word-wrap: break-word;
}

/* Heatmap cell colors */
.heatmap-cell {
    transition: all 0.2s ease;
}

.heatmap-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

.heatmap-cell[data-level="very-low"] {
    background: rgba(239, 68, 68, 0.7);
    color: white;
}

.heatmap-cell[data-level="low"] {
    background: rgba(239, 68, 68, 0.4);
}

.heatmap-cell[data-level="mid-low"] {
    background: rgba(245, 158, 11, 0.3);
}

.heatmap-cell[data-level="mid"] {
    background: rgba(245, 158, 11, 0.5);
}

.heatmap-cell[data-level="mid-high"] {
    background: rgba(34, 197, 94, 0.3);
}

.heatmap-cell[data-level="high"] {
    background: rgba(34, 197, 94, 0.5);
}

.heatmap-cell[data-level="very-high"] {
    background: rgba(34, 197, 94, 0.7);
    color: white;
}

.cell-value {
    font-weight: 600;
}

.cell-percentile {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 13, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .setup-section {
        grid-template-columns: 1fr;
    }

    .selector-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .formations-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    /* Parent tabs mobile */
    .parent-tabs {
        flex-wrap: wrap;
        gap: 5px;
        padding: 10px 10px 0 10px;
    }

    .parent-tab-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
        flex: 1 1 calc(50% - 5px);
        justify-content: center;
    }

    .parent-tab-btn .tab-icon {
        font-size: 1rem;
    }

    /* Sub-tabs mobile */
    .sub-tabs-container {
        padding: 8px 10px;
    }

    .sub-tab-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .category-tabs {
        justify-content: center;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .gauge-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .metric-select {
        width: 100%;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.tooltip-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.tooltip-label {
    color: var(--text-secondary);
}

.tooltip-value {
    color: var(--text-primary);
}

/* Metric Tooltip Styles */
.heatmap-table th.has-tooltip {
    position: relative;
    cursor: help;
}

.heatmap-table th.has-tooltip .metric-label {
    display: inline;
}

.heatmap-table th.has-tooltip .tooltip-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    background: var(--primary-light);
    color: var(--text-secondary);
    border-radius: 50%;
    font-size: 0.65rem;
    margin-left: 4px;
    cursor: help;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.heatmap-table th.has-tooltip:hover .tooltip-icon {
    background: var(--accent);
    color: var(--bg-dark);
}

.heatmap-table th.has-tooltip .metric-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--accent);
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-primary);
    z-index: 100;
    min-width: 250px;
    max-width: 350px;
    text-align: left;
    line-height: 1.4;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    white-space: normal;
    word-wrap: break-word;
}

.heatmap-table th.has-tooltip .metric-tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--accent);
}

.heatmap-table th.has-tooltip:hover .metric-tooltip {
    display: block;
    animation: tooltipFadeIn 0.2s ease;
}

/* Mobile fix for metric tooltips - prevent overlap with formation column */
@media (max-width: 768px) {
    .heatmap-table th.has-tooltip .metric-tooltip {
        left: auto;
        right: 0;
        transform: none;
        min-width: 200px;
        max-width: 280px;
    }

    .heatmap-table th.has-tooltip .metric-tooltip::before {
        left: auto;
        right: 20px;
        transform: none;
    }
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Metric Explanation Display (below select dropdown) */
.metric-explanation {
    display: none;
    margin-top: 10px;
    padding: 12px 15px;
    background: linear-gradient(135deg, var(--bg-dark) 0%, rgba(26, 71, 42, 0.15) 100%);
    border: 1px solid var(--primary-light);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    width: 100%;
}

.metric-explanation .explanation-icon {
    color: var(--accent);
    margin-right: 8px;
    font-style: normal;
}

/* Gauge header with explanation support */
.gauge-header-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Option title for select dropdowns */
.metric-select option {
    padding: 8px;
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    color: var(--bg-dark);
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-top-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.5);
}

.scroll-top-btn.visible {
    display: flex;
}

.scroll-top-btn span {
    line-height: 1;
}

/* Help Button */
.help-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: 1px solid var(--accent);
    border-radius: 25px;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.15);
}

.help-btn:hover {
    background: linear-gradient(135deg, var(--accent) 0%, #22c55e 100%);
    border-color: var(--accent);
    color: var(--bg-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.3);
}

.help-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(74, 222, 128, 0.2);
}

.help-btn .help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--accent);
    color: var(--bg-dark);
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.help-btn:hover .help-icon {
    background: var(--bg-dark);
    color: var(--accent);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 13, 0.9);
    backdrop-filter: blur(5px);
    z-index: 2000;
    overflow-y: auto;
    padding: 30px 15px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.visible {
    visibility: visible;
    opacity: 1;
}

/* Modal Content */
.modal-content {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-content {
    transform: translateY(0);
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    background: var(--primary);
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    color: var(--accent);
    font-size: 1.2rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--accent);
}

/* Modal Body */
.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Modal Cards */
.modal-card {
    display: flex;
    gap: 15px;
    padding: 18px;
    background: var(--bg-dark);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.modal-card.highlight-card {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1) 0%, var(--bg-dark) 100%);
    border-color: var(--accent);
}

.card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: 10px;
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-content h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.card-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.card-content strong {
    color: var(--text-primary);
}

.card-content em {
    color: var(--accent);
    font-style: normal;
}

/* Example Table */
.example-table-wrapper {
    margin: 12px 0;
    overflow-x: auto;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.modal-table th,
.modal-table td {
    padding: 10px 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.modal-table th {
    background: var(--primary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.8rem;
}

.modal-table td {
    color: var(--text-secondary);
    background: var(--bg-card);
}

.modal-table tr.highlight-row td {
    background: rgba(74, 222, 128, 0.15);
    color: var(--accent);
    font-weight: 600;
}

.example-note {
    margin-top: 10px !important;
    padding: 10px;
    background: rgba(234, 179, 8, 0.1);
    border-radius: 6px;
    font-size: 0.85rem !important;
    color: var(--draw) !important;
}

/* Steps List */
.steps-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.step-num {
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: var(--bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    flex-shrink: 0;
}

.step-item strong {
    color: var(--text-primary);
}

/* Insight Box */
.insight-box {
    background: var(--primary);
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
}

.insight-box p {
    margin: 6px 0 !important;
    font-size: 0.85rem !important;
}

.text-green {
    color: var(--win);
    font-weight: 600;
}

.text-red {
    color: var(--loss);
    font-weight: 600;
}

.small-text {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    margin-top: 8px !important;
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 15px 10px;
    }

    .modal-header {
        padding: 15px 18px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-card {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }

    .card-icon {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }

    .modal-table th,
    .modal-table td {
        padding: 8px;
        font-size: 0.8rem;
    }
}

/* Donut Charts Grid */
.donut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

/* Extended Donut Grid with Strengths/Weaknesses */
.donut-grid-extended {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.donut-card-extended {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.donut-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--primary);
    border-bottom: 1px solid var(--border);
}

.donut-header .donut-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0;
}

.donut-matches-badge {
    background: var(--bg-dark);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.donut-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    padding: 20px;
}

.donut-chart-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.donut-card-extended .donut-wrapper {
    width: 140px;
    height: 140px;
}

.donut-win-rate {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--win);
    line-height: 1;
}

.donut-sw-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.sw-column {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 15px;
    max-height: 350px;
    overflow-y: auto;
}

.sw-column.strengths {
    border-left: 3px solid var(--win);
}

.sw-column.weaknesses {
    border-left: 3px solid var(--loss);
}

.sw-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.sw-category {
    margin-bottom: 12px;
}

.sw-category:last-child {
    margin-bottom: 0;
}

.sw-category-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.sw-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sw-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.sw-item.strength {
    background: rgba(34, 197, 94, 0.15);
    color: var(--win);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.sw-item.weakness {
    background: rgba(239, 68, 68, 0.15);
    color: var(--loss);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.sw-perc {
    font-weight: 600;
    opacity: 0.8;
}

.sw-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* Skill/Metric Tooltips */
.sw-item.has-tooltip {
    position: relative;
    cursor: help;
}

.sw-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    transform: none;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-primary);
    z-index: 9999;
    min-width: 220px;
    max-width: 300px;
    text-align: left;
    line-height: 1.4;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    white-space: normal;
    word-wrap: break-word;
}

.sw-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--accent);
}

.sw-item.has-tooltip:hover .sw-tooltip {
    display: block;
    animation: tooltipFadeIn 0.2s ease;
}

/* Responsive for extended donut cards */
@media (max-width: 900px) {
    .donut-content {
        grid-template-columns: 1fr;
    }

    .donut-chart-section {
        flex-direction: row;
        justify-content: center;
        gap: 25px;
    }

    .donut-sw-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .donut-chart-section {
        flex-direction: column;
    }

    .donut-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

.donut-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.donut-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.donut-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 15px;
}

.donut-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 15px;
}

.donut-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.donut-matches {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.donut-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.donut-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-item.win .legend-color {
    background: var(--win);
}

.legend-item.draw .legend-color {
    background: var(--draw);
}

.legend-item.loss .legend-color {
    background: var(--loss);
}

.legend-value {
    color: var(--text-primary);
    font-weight: 600;
}

.legend-label {
    color: var(--text-muted);
}

.legend-text {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Donut Charts Responsive */
@media (max-width: 768px) {
    .donut-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
    }

    .donut-card {
        padding: 15px;
    }

    .donut-title {
        font-size: 1rem;
    }

    .donut-wrapper {
        width: 130px;
        height: 130px;
    }

    .donut-matches {
        font-size: 1.4rem;
    }

    .donut-legend {
        gap: 10px;
    }

    .legend-item {
        font-size: 0.75rem;
    }
}

/* Guide Button in Header */
.guide-btn {
    margin-top: 15px;
}

/* Carousel Modal Styles */
.carousel-container {
    width: 100%;
    max-width: 700px;
    margin: 30px auto;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.carousel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    background: var(--primary);
    border-bottom: 1px solid var(--border);
}

.carousel-header h2 {
    color: var(--accent);
    font-size: 1.3rem;
    margin: 0;
}

.carousel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.carousel-close:hover {
    color: var(--accent);
}

.carousel-content {
    position: relative;
    min-height: 400px;
}

.carousel-slide {
    display: none;
    padding: 30px;
    animation: slideFadeIn 0.3s ease;
}

.carousel-slide.active {
    display: block;
}

@keyframes slideFadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 15px;
}

.carousel-slide h3 {
    color: var(--accent);
    font-size: 1.4rem;
    text-align: center;
    margin: 0 0 20px 0;
}

.slide-body {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.slide-intro {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1rem;
}

.slide-intro strong {
    color: var(--accent);
}

.slide-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.slide-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 15px;
    background: var(--bg-dark);
    border-radius: 8px;
}

.list-bullet {
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1;
}

.slide-highlight {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15) 0%, var(--bg-dark) 100%);
    border: 1px solid var(--accent);
    border-radius: 10px;
    margin-top: 15px;
}

.highlight-icon {
    font-size: 1.5rem;
}

/* Formation Diagrams */
.formation-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.formation-box {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    min-width: 180px;
}

.formation-label {
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 10px;
    font-weight: 600;
}

.formation-visual {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    white-space: pre;
}

.transform-arrow {
    font-size: 2rem;
    color: var(--accent);
    font-weight: bold;
}

.slide-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.stat-item {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.stat-item.good {
    background: rgba(34, 197, 94, 0.15);
    color: var(--win);
}

.stat-item.bad {
    background: rgba(239, 68, 68, 0.15);
    color: var(--loss);
}

.slide-insight {
    background: var(--primary);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    text-align: center;
}

.insight-title {
    color: var(--accent);
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

/* Concept Boxes */
.concept-box {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.concept-box.overload {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--win);
}

.concept-box.underload {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--loss);
}

.concept-box h4 {
    color: var(--text-primary);
    margin: 0 0 8px 0;
    font-size: 1rem;
}

.concept-box p {
    margin: 0 0 10px 0;
}

.example-zone {
    font-size: 0.85rem;
    padding: 8px 12px;
    background: var(--bg-dark);
    border-radius: 6px;
}

.example-zone strong {
    color: var(--text-primary);
}

/* Stat Clues */
.stat-clues {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

.clue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-dark);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.clue-stat {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--accent);
    background: var(--primary);
    padding: 4px 8px;
    border-radius: 4px;
}

.clue-meaning {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.slide-tip {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--draw);
    padding: 12px 15px;
    border-radius: 8px;
    color: var(--draw);
    font-size: 0.9rem;
    margin-top: 15px;
}

/* Steps Guide */
.steps-guide {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.steps-guide .step-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: var(--bg-dark);
    border-radius: 10px;
    border-left: 3px solid var(--accent);
}

.steps-guide .step-num {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: var(--bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 5px;
}

.step-content p {
    margin: 0;
    font-size: 0.9rem;
}

/* Takeaways */
.takeaway-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.takeaway-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: var(--bg-dark);
    border-radius: 8px;
}

.takeaway-icon {
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: bold;
}

.takeaway-item strong {
    color: var(--accent);
}

.final-note {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    margin-top: 10px;
}

.final-note p {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.final-note strong {
    color: var(--accent);
    font-size: 1.2rem;
}

/* Carousel Footer */
.carousel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    background: var(--bg-dark);
    border-top: 1px solid var(--border);
}

.carousel-btn {
    padding: 10px 20px;
    background: var(--primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.carousel-btn:hover {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}

.carousel-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    background: var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dot:hover {
    background: var(--primary-light);
}

.dot.active {
    background: var(--accent);
    transform: scale(1.2);
}

/* Carousel Responsive */
@media (max-width: 768px) {
    .carousel-container {
        margin: 15px auto;
    }

    .carousel-header {
        padding: 15px 20px;
    }

    .carousel-header h2 {
        font-size: 1.1rem;
    }

    .carousel-slide {
        padding: 20px;
    }

    .carousel-slide h3 {
        font-size: 1.2rem;
    }

    .slide-icon {
        font-size: 2.5rem;
    }

    .formation-diagram {
        flex-direction: column;
    }

    .transform-arrow {
        transform: rotate(90deg);
    }

    .carousel-footer {
        padding: 15px;
        flex-wrap: wrap;
        gap: 15px;
        justify-content: center;
    }

    .carousel-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .clue-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Dashboard Responsive */
@media (max-width: 900px) {
    .dashboard {
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    /* Show hamburger menu */
    .menu-toggle {
        display: flex;
    }

    /* Mobile Nav Overlay */
    .mobile-nav-overlay {
        display: block;
        pointer-events: none;
    }

    .mobile-nav-overlay.active {
        pointer-events: auto;
    }

    /* Slide-out sidebar */
    .sidebar {
        position: fixed;
        top: 60px;
        left: -260px;
        width: 250px;
        height: calc(100vh - 60px);
        z-index: 95;
        flex-direction: column;
        padding: 20px 0;
        border-right: 1px solid var(--border);
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-section {
        flex-direction: column;
        align-items: stretch;
        padding: 0 15px;
        margin-bottom: 25px;
    }

    .sidebar-title {
        display: block;
    }

    .nav-item {
        padding: 12px 15px;
        margin-bottom: 5px;
    }

    .sidebar-footer {
        display: block;
    }

    .main-content {
        padding: 15px;
    }

    .header-tagline {
        display: none;
    }

    .header-btn span:not(.btn-icon) {
        display: none;
    }

    .header-btn {
        padding: 8px 12px;
    }
}

@media (max-width: 600px) {
    .dashboard-header {
        padding: 0 15px;
    }

    .header-brand h1 {
        font-size: 1.2rem;
    }

    .context-grid {
        grid-template-columns: 1fr;
    }

    .formations-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-left,
    .controls-right {
        justify-content: center;
    }

    .section-header h2 {
        font-size: 1.3rem;
    }
}
