/* 
    UK Soccer Leagues - Master Theme
    Consolidated Design System for Light & Dark Mode
    Standardized: 2026-05-02
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@400;600;700;800&display=swap');

:root {
    /* Color Palette - Midnight League (Emerald & Indigo) */
    --primary: #10b981; /* Emerald 500 */
    --primary-hover: #059669;
    --secondary: #6366f1; /* Indigo 500 */
    --secondary-hover: #4f46e5;
    
    /* Default Dark Mode */
    --bg-main: #0f172a; /* Slate 900 */
    --bg-surface: rgba(30, 41, 59, 0.7); /* Slate 800 with transparency */
    --bg-card: rgba(15, 23, 42, 0.8);
    
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #cbd5e1; /* Lighter Slate for better dark mode contrast */
    --text-on-primary: #ffffff;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(16, 185, 129, 0.3);
    
    --glass-blur: blur(10px);
    --shadow-premium: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* Semantic Colors - Dark Mode */
    --danger: #ef4444;
    --danger-subtle: rgba(239, 68, 68, 0.15);
    --ft-bg: rgba(255, 255, 255, 0.05);
    --ft-text: #94a3b8;
    --ft-border: rgba(255, 255, 255, 0.1);

    /* RGB Values for transparency usage */
    --primary-rgb: 16, 185, 129;
    --secondary-rgb: 99, 102, 241;
    --danger-rgb: 239, 68, 68;

    /* Theme Variable Aliases for legacy/adhoc usage */
    --bg-body: var(--bg-main);
    --bg-card-header: var(--bg-surface);

    /* Secondary Header - Dark Mode (Muted Slate Blue) */
    --bg-secondary-header: #1e293b; 
    --text-secondary-header: #f8fafc;
    --border-secondary-header: #334155;
}

/* Light Mode Overrides */
html[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-surface: rgba(255, 255, 255, 0.9);
    --bg-card: rgba(255, 255, 255, 0.95);
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;
    
    --border-color: rgba(0, 0, 0, 0.1);
    --border-accent: rgba(16, 185, 129, 0.4);
    
    --shadow-premium: 0 4px 16px -4px rgba(0, 0, 0, 0.1), 0 2px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Semantic Colors - Light Mode */
    --danger-subtle: #fee2e2;
    --ft-bg: #f1f5f9;
    --ft-text: #64748b;
    --ft-border: #e2e8f0;

    /* Secondary Header - Light Mode (Pale Blue) */
    --bg-secondary-header: #e0f2fe;
    --text-secondary-header: #000000;
    --border-secondary-header: #bae6fd;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.1) 0%, transparent 40%);
    background-attachment: fixed;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Global Typography - Overriding legacy web.css Navy colors */
h1, h2, h3, h4, h5, h6, b, strong, li {
    color: var(--text-main) !important;
    font-family: 'Outfit', 'Inter', sans-serif;
}

/* Ensure common text elements respect theme in legacy containers */
p, span:not(.badge-form):not(.soccer-spinner), div:not(.card):not(.modern-card):not(.spinner-overlay) {
    color: inherit;
}

/* Global Typography & Links Overrides */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

html[data-theme="dark"] a {
    color: #34d399; /* Brighter Emerald for Dark Mode */
}

html[data-theme="dark"] .text-muted, 
html[data-theme="dark"] .num-cell,
html[data-theme="dark"] .pos-cell {
    color: var(--text-muted) !important;
}

/* AJAX Calendar Modern Styling for Light & Dark Modes */
.ajax__calendar_container {
    background-color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow-premium) !important;
    color: #0f172a !important;
    z-index: 20000 !important;
    padding: 8px !important;
    width: 210px !important;
}
.ajax__calendar_body {
    height: 185px !important;
    width: 100% !important;
}
html[data-theme="dark"] .ajax__calendar_container {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}
.ajax__calendar_container table {
    width: 100% !important;
    table-layout: fixed !important;
    border-spacing: 0 !important;
    border-collapse: separate !important;
}
.ajax__calendar_header {
    background: transparent !important;
    border-bottom: 1px solid var(--border-color) !important;
    margin-bottom: 5px !important;
    height: 25px !important;
}
.ajax__calendar_title {
    color: var(--primary) !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
}
.ajax__calendar_footer {
    border-top: 1px solid var(--border-color) !important;
    margin-top: 5px !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
    height: 25px !important;
    line-height: 25px !important;
    font-size: 0.75rem !important;
}
.ajax__calendar_dayname {
    color: var(--text-muted) !important;
    font-weight: 700 !important;
    text-align: center !important;
    font-size: 0.7rem !important;
    padding-bottom: 3px !important;
}
.ajax__calendar_day, .ajax__calendar_month, .ajax__calendar_year {
    color: inherit !important;
    text-align: center !important;
    padding: 0 !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    font-size: 0.7rem !important;
    width: 22px !important;
    height: 22px !important;
    line-height: 22px !important;
}
.ajax__calendar_day:hover {
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--primary) !important;
}
.ajax__calendar_active .ajax__calendar_day {
    background-color: var(--primary) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}
.ajax__calendar_today .ajax__calendar_day {
    border: 1px solid var(--secondary) !important;
    color: var(--secondary) !important;
    font-weight: 800 !important;
}

/* Prevent DetailsView/modal table styles from bleeding into CalendarExtender popups */
.modern-detailsview .ajax__calendar_container td,
.modern-detailsview .ajax__calendar_container th,
.modern-details .ajax__calendar_container td,
.modern-details .ajax__calendar_container th {
    padding: 0 !important;
    border-bottom: none !important;
    color: inherit !important;
    font-size: inherit !important;
    background: transparent !important;
}

.modern-detailsview .ajax__calendar_container tr,
.modern-detailsview .ajax__calendar_container tr:nth-child(even),
.modern-details .ajax__calendar_container tr,
.modern-details .ajax__calendar_container tr:nth-child(even) {
    background: transparent !important;
}

/* Force all text in cards to respect theme, EXCEPT colored icons */
.card, .modern-card, .card *:not(.card-icon-wrap):not([class*="icon-"]), .modern-card *:not(.card-icon-wrap):not([class*="icon-"]) {
    color: inherit;
}

.card, .modern-card {
    color: var(--text-main) !important;
}

/* Layout Containers */
.page-container, .admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Modern Card */
.card, .modern-card {
    background: var(--bg-surface) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-premium);
    padding: 1rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.3s ease;
}

.card:hover, .modern-card:hover {
    border-color: var(--border-accent) !important;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Card Collapse Functionality */
.card-toggle {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.card-toggle:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.card-toggle i {
    transition: transform 0.3s ease;
}

.modern-card.collapsed {
    padding-bottom: 0.75rem !important;
}

.modern-card.collapsed .card-title {
    margin-bottom: 0 !important;
}

.modern-card.collapsed .card-toggle i {
    transform: rotate(-90deg);
}

.modern-card.collapsed > *:not(.card-title) {
    display: none !important;
}

html[data-theme="light"] .card-toggle {
    background: rgba(0, 0, 0, 0.03);
}

/* Layout & Admin Headers */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Admin headers use a compact row-based layout to maximize vertical space */
.admin-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
    padding-bottom: 1rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    margin-bottom: 1rem !important;
}

.header-main-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    gap: 1rem !important;
}

.mode-close-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.admin-header h1 {
    font-size: 1.75rem;
    font-family: 'Outfit', sans-serif;
    margin: 0;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logged-details {
    display: flex !important;
    gap: 0.35rem !important;
    flex-wrap: wrap !important;
}

.logged-details > div, .theme-toggle {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 0.6rem;
    color: var(--text-muted);
    height: 30px; /* Reduced from 38px */
    display: flex;
    align-items: center;
    white-space: nowrap;
    font-size: 0.7rem;
}

.logged-details strong {
    color: var(--text-main);
    margin-right: 0.25rem;
}

.theme-toggle {
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    outline: none;
    width: auto;
    padding: 0 0.75rem;
    gap: 0.5rem;
    justify-content: center;
    color: var(--text-main) !important;
}

.theme-toggle:not(.btn-close-window):not(.btn-guide)::before {
    content: none !important;
}

html[data-theme="light"] .theme-toggle:not(.btn-close-window):not(.btn-guide)::before {
    content: none !important;
}

.theme-toggle i {
    margin-left: 0.5rem;
    font-size: 0.85rem;
}

.theme-toggle .fa-sun {
    color: #f59e0b !important;
}

.theme-toggle .fa-moon {
    color: #a855f7 !important;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.theme-toggle.btn-close-window {
    background: var(--danger) !important;
    color: #ffffff !important;
    border-color: var(--danger) !important;
    width: 38px !important;
    justify-content: center;
    padding: 0;
}

.theme-toggle.btn-close-window::before {
    content: "\f00d" !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    color: #ffffff !important;
}

.theme-toggle.btn-guide::before {
    content: "Guide" !important;
}

.theme-toggle.btn-close-window:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.theme-toggle.btn-close-window i {
    display: none !important; /* Use the pseudo-element icon for better alignment with "Mode" buttons */
}

html[data-theme="light"] .theme-toggle:not(.btn-close-window) { 
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-main) !important; 
}

/* Override theme toggle color inside blue navbars to always remain white/light with high contrast */
.navbar .theme-toggle {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

.navbar .theme-toggle i {
    color: #ffffff !important;
}

html[data-theme="light"] .navbar .theme-toggle {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

html[data-theme="light"] .navbar .theme-toggle i {
    color: #ffffff !important;
}

.navbar .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: #ffffff !important;
}

html[data-theme="light"] .logged-details > div {
    background: rgba(0, 0, 0, 0.03);
}

/* Forms & Inputs */
.modern-input, select, .modern-dropdown,
input.modern-input, textarea.modern-input {
    background: rgba(15, 23, 42, 0.5) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 0.5rem 0.75rem !important;
    color: var(--text-main) !important;
    font-size: 1rem !important;
    width: 100%;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

/* Force dark backgrounds on native inputs in dark mode */
html[data-theme="dark"] input:not([type="submit"]):not([type="button"]):not([type="reset"]),
html[data-theme="dark"] input.modern-input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background: rgba(15, 23, 42, 0.6) !important;
    color: var(--text-main) !important;
    color-scheme: dark;
}

html[data-theme="light"] .modern-input, 
html[data-theme="light"] select, 
html[data-theme="light"] .modern-dropdown,
html[data-theme="light"] input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]),
html[data-theme="light"] textarea {
    background: #ffffff !important;
    color: #0f172a !important;
    color-scheme: light;
}

.modern-input:focus, select:focus, .modern-dropdown:focus,
input.modern-input:focus, textarea.modern-input:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
}

/* Buttons */
.btn-primary {
    background: var(--primary) !important;
    color: white !important;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
}

.btn-primary:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: var(--danger) !important;
    color: white !important;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
}

.btn-danger:hover {
    background: #dc2626 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Spinners (Gold Standard - Standardized Action Feedback) */
.spinner-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 100000;
}

.spinner-panel {
    background: var(--bg-card) !important;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-premium);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.spinner-icon-large {
    width: 60px;
    height: 60px;
    background: url('../images/UKSL_logo_small.png') no-repeat center center;
    background-size: contain;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { transform: scale(0.92); opacity: 0.8; }
    50% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(0.92); opacity: 0.8; }
}

.spinner-message {
    font-weight: 600;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Alert Overlay (injected by admin-core.js) */
.alert-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

#AlertDiv {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    min-width: 320px;
    max-width: 500px;
    box-shadow: var(--shadow-premium);
    color: var(--text-main);
}

/* Results Specific Components */
.result-row-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}

.result-row-card:hover {
    border-color: var(--border-accent) !important;
}

.result-date-header {
    color: var(--text-secondary-header) !important;
    background: var(--bg-secondary-header) !important;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: normal;
    margin: 1rem 0 0.5rem 0;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem !important;
    border-radius: 6px !important;
    border: 1px solid var(--border-secondary-header) !important;
}

.result-date-header::before {
    display: none !important; /* Hide legacy blue strip */
}

.score {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

/* Tables / GridViews */
table.modern-gridview,
.modern-gridview {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* DetailsView Modernization */
table.modern-detailsview,
.modern-detailsview {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.modern-detailsview tr {
    border-bottom: 1px solid var(--border-color);
}

/* Header style */
.modern-detailsview th, 
.modern-detailsview .details-header {
    background: #1e293b !important;
    color: var(--primary) !important;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem !important;
    border-bottom: 2px solid var(--border-color) !important;
    text-align: center !important;
}

html[data-theme="light"] .modern-detailsview th,
html[data-theme="light"] .modern-detailsview .details-header {
    background: var(--primary) !important;
    color: var(--text-on-primary) !important;
}

/* Field Header (Left column) */
.modern-detailsview td:first-child,
.modern-detailsview .field-header {
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-muted) !important;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem !important;
    width: 160px;
    border-right: 1px solid var(--border-color);
    white-space: nowrap;
}

html[data-theme="light"] .modern-detailsview td:first-child,
html[data-theme="light"] .modern-detailsview .field-header {
    background: rgba(0, 0, 0, 0.02) !important;
}

/* Data Cell (Right column) */
.modern-detailsview td:last-child,
.modern-detailsview .field-value {
    padding: 0.85rem 1rem !important;
    font-size: 0.9rem;
    color: var(--text-main);
    background: transparent !important;
}

.modern-detailsview tr:last-child,
.modern-detailsview tr:last-child td {
    border-bottom: none;
}

/* Form controls within DetailsView */
.modern-detailsview input[type="text"],
.modern-detailsview textarea,
.modern-detailsview select {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px;
    padding: 0.6rem 0.85rem !important;
    color: var(--text-main) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.85rem !important;
    transition: all 0.2s ease;
}

html[data-theme="light"] .modern-detailsview input[type="text"],
html[data-theme="light"] .modern-detailsview textarea,
html[data-theme="light"] .modern-detailsview select {
    background: #ffffff !important;
}

.modern-detailsview input[type="text"]:focus,
.modern-detailsview textarea:focus,
.modern-detailsview select:focus {
    border-color: var(--primary) !important;
    background: rgba(16, 185, 129, 0.05) !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.modern-detailsview .command-row td {
    background: rgba(255, 255, 255, 0.02) !important;
    padding: 1.25rem !important;
    text-align: center !important;
}

html[data-theme="light"] .modern-detailsview .command-row td {
    background: rgba(0, 0, 0, 0.01) !important;
}

/* Specific templates */
.details-footer {
    padding: 1.5rem !important;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.modern-gridview th {
    background: #1e293b !important; /* Dark Slate Header for Contrast */
    color: var(--primary) !important; /* Emerald Text */
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.5rem !important;
    border-bottom: 2px solid var(--border-color) !important;
    text-align: right !important;
}

html[data-theme="light"] .modern-gridview th {
    background: var(--primary) !important;
    color: var(--text-on-primary) !important;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1) !important;
}

.modern-gridview td {
    padding: 0.5rem 0.5rem !important;
    font-size: 0.85rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    vertical-align: top !important;
    text-align: right !important;
    background: transparent !important;
}

html[data-theme="light"] .modern-gridview td {
    color: var(--text-main) !important;
}

/* Specific Alignment for Club and Form Headers/Cells */
.modern-gridview th:nth-child(2),
.modern-gridview td:nth-child(2),
.modern-gridview th:last-child,
.modern-gridview td:last-child {
    text-align: left !important;
}

.modern-gridview tr,
.modern-gridview tbody tr,
.modern-gridview tbody tr:nth-child(even) {
    background: transparent !important;
}

.modern-gridview tr:last-child td {
    border-bottom: none;
}

.modern-gridview tr:hover td {
    background: rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="light"] .modern-gridview tr:hover td {
    background: rgba(0, 0, 0, 0.03) !important;
}

/* ToggleButtonExtender images must stay clickable */
.modern-gridview td img { cursor: pointer; }

/* Buttons inside gridview cells */
.modern-gridview td input[type="button"],
.modern-gridview td input[type="submit"] {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary) !important;
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: 5px;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.modern-gridview td input[type="button"]:hover,
.modern-gridview td input[type="submit"]:hover {
    background: rgba(var(--primary-rgb), 0.22);
}

html[data-theme="light"] .modern-gridview td input[type="button"],
html[data-theme="light"] .modern-gridview td input[type="submit"] {
    background: rgba(var(--primary-rgb), 0.08);
}

/* Pager row */
.modern-gridview tr.gridview-pager td {
    background: rgba(255, 255, 255, 0.03) !important;
    border-top: 1px solid var(--border-color) !important;
    border-bottom: none !important;
    padding: 0.6rem 0.75rem !important;
    text-align: center !important;
    font-size: 0.82rem !important;
}

html[data-theme="light"] .modern-gridview tr.gridview-pager td {
    background: rgba(0, 0, 0, 0.02) !important;
}

.modern-gridview tr.gridview-pager a {
    color: var(--text-muted) !important;
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.modern-gridview tr.gridview-pager a:hover {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary) !important;
    text-decoration: none;
}

.modern-gridview tr.gridview-pager span {
    color: var(--primary) !important;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
}

/* Selected row */
.modern-gridview tr.gridview-selected td {
    background: rgba(var(--primary-rgb), 0.12) !important;
    border-bottom: none !important;
    border-left: none !important;
}

.modern-gridview tr.gridview-selected td:first-child {
    border-left: 3px solid var(--primary) !important;
}

/* Left-aligned headers/cells variant (for data grids, not league tables) */
.modern-gridview.headers-left th,
.modern-gridview.headers-left td { text-align: left !important; }

/* Top-aligned cells variant */
.modern-gridview.valign-top td { vertical-align: top !important; }

/* League Table Specific Cell Styles */
.pos-cell {
    font-weight: 700;
    color: var(--text-muted);
    width: 40px !important;
    text-align: right !important;
}

.club-cell {
    font-weight: 600;
    text-align: left !important;
}

.num-cell {
    width: 35px !important;
    text-align: right !important;
}

.pts-cell {
    width: 45px !important;
    font-weight: 600;
    text-align: right !important;
}

.pa-cell {
    width: 45px !important;
    color: var(--danger);
    text-align: right !important;
}

.ap-cell {
    width: 55px !important;
    font-weight: 800;
    color: var(--primary) !important;
    background: rgba(16, 185, 129, 0.05) !important;
    text-align: right !important;
}

.micro-badge {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    object-fit: contain;
    border-radius: 4px;
}

/* Form Badges Styling */
.form-badges {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: flex-start;
}

.badge-form {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}

.badge-form-w { background-color: #10b981; } /* Emerald 500 */
.badge-form-d { background-color: #94a3b8; } /* Slate 400 */
.badge-form-l { background-color: #ef4444; } /* Red 500 */

.club-link {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.club-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Home/Away Analysis Headers */
.modern-gridview th.home-header-bg, .home-header-bg { background-color: #065f46 !important; }
.modern-gridview th.away-header-bg, .away-header-bg { background-color: #1e40af !important; }
.modern-gridview td.home-cell-bg, .home-cell-bg { background-color: rgba(16, 185, 129, 0.15) !important; }
.modern-gridview td.away-cell-bg, .away-cell-bg { background-color: rgba(59, 130, 246, 0.15) !important; }


/* High Specificity Overrides for Headers */
.modern-gridview th.comp-header-row,
.comp-header-row, .comp-header-row td, .comp-header-row th {
    background: var(--bg-secondary-header) !important;
    color: var(--text-secondary-header) !important;
    font-weight: 700 !important;
    text-transform: none !important;
    font-size: 0.85rem !important;
    border-bottom: 1px solid var(--border-secondary-header) !important;
    padding: 0.5rem 1rem !important;
}

.modern-gridview th.date-header-row,
.date-header-row, .date-header-row td, .date-header-row th {
    background: #10b981 !important; /* Solid Emerald Green as requested */
    color: #ffffff !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    font-size: 0.9rem !important;
    padding: 0.6rem 1rem !important;
}

.expunged-caption {
    color: var(--danger) !important;
    font-size: 0.85rem;
    font-weight: 700;
    display: block;
    margin-bottom: 1rem;
    text-align: center;
}

/* ==========================================================================
   Administrative & specialized Components (Merged from admin-theme.css)
   ========================================================================== */

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--primary);
    border-radius: 50%;
    color: var(--primary);
    text-decoration: none !important;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.icon-btn.disabled {
    opacity: 0.35 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

.icon-btn:hover {
    background: var(--primary);
    color: var(--text-on-primary);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--secondary);
    color: var(--secondary);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--secondary);
    color: white;
}

.modern-details {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text-main) !important;
}

.modern-details tr {
    border-bottom: 1px solid var(--border-color);
}

.modern-details td, .modern-details th {
    padding: 1.25rem 1rem;
    background: transparent !important;
    border: none !important;
    color: var(--text-main) !important;
}

.modern-details .header-row {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 700;
}

.modern-details .field-header {
    width: 200px;
    font-weight: 600;
    color: var(--text-muted) !important;
    font-size: 0.9rem;
}

.club-name-prominent {
    color: var(--primary) !important;
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    display: block;
    margin-bottom: 0.5rem;
}

.validation-summary {
    background-color: rgba(255, 107, 107, 0.1);
    border-left: 4px solid var(--danger);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-md);
    color: var(--danger);
    font-size: 0.9rem;
}

.section-divider {
    background: var(--border-accent) !important;
    color: var(--primary) !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem !important;
}

.details-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.details-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.details-item label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-layout {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    align-items: flex-start;
}

.results-sidebar {
    flex: 0 0 350px;
    position: sticky;
    top: 2rem;
}

.results-main {
    flex: 1;
}

.fixture-card {
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.fixture-card:hover {
    border-color: var(--primary);
}

.fixture-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.fixture-body {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2rem;
    margin: 1.5rem 0;
}

.score-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
    background: var(--primary);
    color: var(--text-on-primary);
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.score-input {
    width: 60px !important;
    text-align: center;
    font-size: 1.5rem !important;
    font-weight: 700;
}

.pen-input {
    width: 50px !important;
    text-align: center;
    font-size: 0.9rem !important;
    border-color: var(--secondary) !important;
}

/* Modern Calendar Styling */
.modern-calendar {
    border: none !important;
    background: transparent !important;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

[data-theme="dark"] .modern-calendar,
[data-theme="dark"] .modern-calendar a,
[data-theme="dark"] .modern-calendar span {
    color: var(--text-main) !important;
}

.modern-calendar a {
    text-decoration: none !important;
}

.modern-calendar td {
    padding: 0.25rem !important;
}

.modern-calendar.dimmed-calendar {
    opacity: 0.25;
    filter: grayscale(60%);
}

.modern-calendar.dimmed-calendar:hover {
    opacity: 0.6;
    filter: grayscale(20%);
}

.calendar-matchday, .calendar-matchday a {
    background-color: #166534 !important; /* Muted Forest Green */
    color: #ffffff !important;
}

.calendar-unavailable, .calendar-unavailable a {
    background-color: #991b1b !important; /* Muted Crimson */
    color: #ffffff !important;
}

.calendar-title {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 700 !important;
    padding: 10px !important;
    text-align: center;
}

.calendar-day-header {
    color: var(--text-muted) !important;
    font-size: 7pt !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    padding: 0.5rem 0 !important;
}

.calendar-today {
    background: rgba(16, 185, 129, 0.1) !important;
    border-radius: 50%;
    color: var(--primary) !important;
}

.calendar-selected-day {
    background: var(--primary) !important;
    color: var(--text-on-primary) !important;
    border-radius: 50%;
    font-weight: 700 !important;
}

.calendar-weekend {
    background: rgba(0, 0, 0, 0.02) !important;
}

[data-theme="dark"] .calendar-weekend {
    background: rgba(255, 255, 255, 0.02) !important;
}

.calendar-other-month {
    color: var(--text-muted) !important;
    opacity: 0.5 !important;
}

.calendar-next-prev {
    color: var(--primary) !important;
}

.status-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

/* New Utility Classes */
.modern-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modern-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.modern-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.modern-badge.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.section-divider {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem !important;
    padding: 0.75rem 1rem !important;
    border-radius: 4px;
    margin: 1.5rem 0 0.75rem 0;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.modern-details .section-divider {
    grid-column: 1 / -1;
}

.club-name-prominent {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

/* Modern Button Base and Variants */
.modern-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--primary);
    color: white !important;
}

.modern-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    filter: brightness(1.1);
}

.modern-button:active {
    transform: translateY(0);
}

.modern-button.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main) !important;
}

.modern-button.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modern-button.btn-danger {
    background: var(--danger);
    color: white;
}

.modern-button.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.modern-button.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
}

/* ==========================================================================
   Mobile Responsiveness & Responsive Layouts
   ========================================================================== */

@media (max-width: 768px) {
    /* Containers & Spacing */
    .admin-container, .page-container {
        padding: 1rem !important;
    }

    /* Admin Header Responsiveness */
    .admin-header {
        gap: 0.5rem !important;
        width: 100% !important;
    }

    .logged-details {
        flex-wrap: wrap !important;
        gap: 0.25rem !important;
    }

    /* Cards Grid Collapse */
    .cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Flex Layouts Collapse */
    .results-layout {
        flex-direction: column !important;
    }
    
    .results-sidebar {
        flex: 1 1 100% !important;
        position: static !important;
        width: 100% !important;
        margin-bottom: 1.5rem;
    }

    /* Make Grid and Table containers scrollable horizontally on mobile */
    .player-grid-container,
    .modern-gridview, 
    .modern-detailsview,
    .modern-details {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Prevent wrapping of cell contents for clean scrolling */
    .modern-gridview td, 
    .modern-gridview th,
    .modern-detailsview td,
    .modern-detailsview th {
        white-space: nowrap;
    }

    /* Make filter inputs and dropdowns stack cleanly at full width on mobile */
    .filter-item {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Force ASP.NET RadioButtonLists and CheckBoxLists to stack vertically */
    .modern-radiobuttonlist tbody,
    .modern-radiobuttonlist tr,
    .modern-radiobuttonlist td {
        display: block !important;
        width: 100% !important;
    }

    /* Collapse inline double-column grid layouts */
    .admin-container div[style*="grid-template-columns: 1fr 1fr"],
    .admin-container div[style*="grid-template-columns:1fr 1fr"],
    .admin-container div[style*="grid-template-columns: 2fr"],
    .admin-container div[style*="grid-template-columns:2fr"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

.min-width-200 {
    min-width: 200px !important;
}

/* Matrix Cell Standardized Colors - Added May 2026 */

/* Standard Neutral Headers (Slate 700) */
html[data-theme] .matrix-container .modern-gridview th,
html[data-theme] .matrix-container .modern-gridview th.cell-grid-header,
html[data-theme] .matrix-container .modern-gridview td.cell-grid-header,
html[data-theme] .matrix-container .modern-gridview td:first-child,
html[data-theme] .matrix-container .modern-gridview th:first-child,
.cell-grid-header { 
    background: #334155 !important; 
    color: #ffffff !important; 
    font-weight: 700 !important;
    text-align: center !important;
    white-space: nowrap !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

/* Rotated Column Headers in Matrix Grids */
.rotated-header-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: normal;
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.1;
    padding: 0.5rem 0.2rem;
    text-transform: uppercase;
    max-height: 110px;
    word-break: keep-all;
    overflow-wrap: normal;
    text-align: left;
}

html[data-theme] .matrix-container .modern-gridview th.cell-rotated {
    vertical-align: bottom !important;
    padding-bottom: 0.75rem !important;
}

/* Emerald Variation for primary scheduling tools */
html[data-theme] .matrix-emerald .modern-gridview th,
html[data-theme] .matrix-emerald .modern-gridview th.cell-grid-header,
html[data-theme] .matrix-emerald .modern-gridview td.cell-grid-header,
html[data-theme] .matrix-emerald .modern-gridview td:first-child,
html[data-theme] .matrix-emerald .modern-gridview th:first-child {
    background: #065f46 !important; /* Dark Emerald */
    color: #ffffff !important;
}

/* Light theme first column & header background (Emerald 500) */
html[data-theme="light"] .matrix-container .modern-gridview th,
html[data-theme="light"] .matrix-container .modern-gridview th.cell-grid-header,
html[data-theme="light"] .matrix-container .modern-gridview td.cell-grid-header,
html[data-theme="light"] .matrix-container .modern-gridview td:first-child,
html[data-theme="light"] .matrix-container .modern-gridview th:first-child,
html[data-theme="light"] .matrix-emerald .modern-gridview th,
html[data-theme="light"] .matrix-emerald .modern-gridview th.cell-grid-header,
html[data-theme="light"] .matrix-emerald .modern-gridview td.cell-grid-header,
html[data-theme="light"] .matrix-emerald .modern-gridview td:first-child,
html[data-theme="light"] .matrix-emerald .modern-gridview th:first-child {
    background: #10b981 !important; /* Emerald 500 */
    color: #ffffff !important;
    text-shadow: none !important;
}

/* Base Micro-Badge Logic */
html[data-theme] .matrix-container .modern-gridview td[class*="cell-"]:not(.cell-grid-header) {
    position: relative !important;
    background: transparent !important;
    border: none !important;
    z-index: 1 !important;
    color: white !important;
    display: table-cell !important;
    vertical-align: middle !important;
}

html[data-theme] .matrix-container .modern-gridview td[class*="cell-"]:not(.cell-grid-header)::before {
    content: '';
    position: absolute;
    inset: 4px; 
    border-radius: 4px;
    z-index: -1;
}

/* Refined Professional Palette */
html[data-theme] .cell-home-league::before { background: #166534 !important; } /* Muted Forest Green */
html[data-theme] .cell-away-league::before { background: #991b1b !important; } /* Muted Crimson */
html[data-theme] .cell-home-cup::before    { background: #1e3a8a !important; } /* Muted Royal Blue */
html[data-theme] .cell-away-cup::before    { background: #a21caf !important; } /* Muted Magenta */
html[data-theme] .cell-played::before      { background: #166534 !important; }
html[data-theme] .cell-unplayed::before    { background: #94a3b8 !important; }
html[data-theme] .cell-empty::before       { background: #000 !important; opacity: 0.05; }

/* Centralized Legend Badge Logic - Compact */
.badge[class*="cell-"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0.25rem 0.6rem !important;
    border-radius: 4px !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 0.7rem !important;
    margin: 2px !important;
    min-width: 0;
    white-space: nowrap;
}

.badge.cell-home-league { background: #166534 !important; }
.badge.cell-away-league { background: #991b1b !important; }
.badge.cell-home-cup    { background: #1e3a8a !important; }
.badge.cell-away-cup    { background: #a21caf !important; }
.badge.cell-played      { background: #166534 !important; }
.badge.cell-unplayed    { background: #94a3b8 !important; }

/* Matrix Container specific rules */
.matrix-container {
    background: rgba(22, 163, 74, 0.05) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: visible;            /* Must be visible so sticky positioning works vs page scroll */
    margin-top: 1rem;
}

/* Inner scroll wrapper — isolates horizontal overflow from sticky context */
.matrix-scroll-wrap {
    overflow-x: auto;
    overflow-y: visible;
    border-radius: var(--radius-md);
    /* Styled scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(255,255,255,0.06);
}

.matrix-scroll-wrap::-webkit-scrollbar {
    height: 6px;
}

.matrix-scroll-wrap::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.04);
    border-radius: 3px;
}

.matrix-scroll-wrap::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

html[data-theme="light"] .matrix-scroll-wrap::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.06);
}

html[data-theme="dark"] .matrix-container {
    background: rgba(6, 78, 59, 0.15) !important;
}

.matrix-container .modern-gridview {
    margin: 0 !important;
    border: none !important;
    width: 100% !important;
    table-layout: auto !important;
}

/* Compact Matrix Sizing & Alignment */
html[data-theme] .matrix-container .modern-gridview td,
html[data-theme] .matrix-container .modern-gridview th {
    padding: 0.6rem 0.4rem !important;
    font-size: 0.75rem !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap !important; /* Force single line */
}

/* Reduce Results Matrix cell sizing to prevent horizontal truncation */
html[data-theme] .matrix-emerald .modern-gridview td:not(:first-child) {
    font-size: 0.6rem !important;
    padding: 0.4rem 0.15rem !important;
}

/* Fixture Matrix cell font size */
html[data-theme] .matrix-container:not(.matrix-emerald) .modern-gridview td:not(:first-child) {
    font-size: 0.6rem !important;
    font-weight: 700 !important;
}

.matrix-score {
    font-size: 1.2em !important;
    font-weight: 800 !important;
    margin-top: 1px !important;
}

html[data-theme] .matrix-container .modern-gridview td.cell-home-win::before {
    border-left: 3px solid #22c55e !important;
}

html[data-theme] .matrix-container .modern-gridview td.cell-away-win::before {
    border-left: 3px solid #ef4444 !important;
}

/* Allow wrapping on the first column for names */
html[data-theme] .matrix-container .modern-gridview td:first-child {
    white-space: normal !important;
}

html[data-theme] .matrix-container .modern-gridview td:first-child,
html[data-theme] .matrix-container .modern-gridview th:first-child {
    width: 1% !important;
    min-width: 150px !important;
    max-width: 250px !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    text-align: left !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 2 !important;
    background: #334155 !important;  /* Must have background to cover scrolling cells */
}

/* Sticky header row — sticks to top of viewport as page scrolls vertically */
html[data-theme] .matrix-container .modern-gridview th {
    position: sticky !important;
    top: 0 !important;
    z-index: 3 !important;
}

/* Top-left corner cell sits above both sticky axes */
html[data-theme] .matrix-container .modern-gridview th:first-child {
    z-index: 5 !important;
}

html[data-theme="light"] .matrix-container .modern-gridview td:first-child,
html[data-theme="light"] .matrix-container .modern-gridview th:first-child {
    background: #10b981 !important;
}

html[data-theme] .matrix-container .modern-gridview td * {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    margin: 0 auto !important;
}

/* Crosshair: subtle row highlight on hover using inset box-shadow to preserve round color washes underneath */
html[data-theme] .matrix-container .modern-gridview tr:hover td {
    box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="light"] .matrix-container .modern-gridview tr:hover td {
    box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.07) !important;
}

/* Crosshair: column highlight via JS-added class (using same soft tint overlay as row hover) */
html[data-theme] .matrix-container .modern-gridview td.col-highlight,
html[data-theme] .matrix-container .modern-gridview th.col-highlight {
    box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="light"] .matrix-container .modern-gridview td.col-highlight,
html[data-theme="light"] .matrix-container .modern-gridview th.col-highlight {
    box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.07) !important;
}

/* Intersection of hovered row and highlighted column — combine them for double-prominence tint */
html[data-theme] .matrix-container .modern-gridview tr:hover td.col-highlight {
    box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.16) !important;
}

html[data-theme="light"] .matrix-container .modern-gridview tr:hover td.col-highlight {
    box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.14) !important;
}

/* Keep first column colour stable during row hover */
html[data-theme] .matrix-container .modern-gridview tr:hover td:first-child {
    background: #334155 !important;
}

html[data-theme="light"] .matrix-container .modern-gridview tr:hover td:first-child {
    background: #10b981 !important;
    color: #ffffff !important;
}

html[data-theme] .matrix-emerald .modern-gridview tr:hover td:first-child {
    background: #065f46 !important;
}

html[data-theme="light"] .matrix-emerald .modern-gridview tr:hover td:first-child {
    background: #10b981 !important;
    color: #ffffff !important;
}

/* Alternating Rows for grouped data (Rounds) */
html[data-theme] .matrix-container .modern-gridview tr.round-green td {
    background: rgba(22, 163, 74, 0.12) !important; /* Soft Green wash */
}

html[data-theme] .matrix-container .modern-gridview tr.round-blue td {
    background: rgba(37, 99, 235, 0.12) !important; /* Soft Blue wash */
}

/* Force First Column to follow round colors with higher prominence (Dark Mode / default) */
html[data-theme] .matrix-container .modern-gridview tr.round-green td:first-child,
html[data-theme] .matrix-container .modern-gridview tr.round-green:hover td:first-child {
    background: rgba(22, 163, 74, 0.35) !important; /* Bolder Green for Col 1 */
    color: #ffffff !important;
}

html[data-theme] .matrix-container .modern-gridview tr.round-blue td:first-child,
html[data-theme] .matrix-container .modern-gridview tr.round-blue:hover td:first-child {
    background: rgba(37, 99, 235, 0.35) !important; /* Bolder Blue for Col 1 */
    color: #ffffff !important;
}

/* Light Mode Round Overrides for First Column (with dark text for readability) */
html[data-theme="light"] .matrix-container .modern-gridview tr.round-green td:first-child,
html[data-theme="light"] .matrix-container .modern-gridview tr.round-green:hover td:first-child {
    background: rgba(22, 163, 74, 0.35) !important;
    color: #0f172a !important;
}

html[data-theme="light"] .matrix-container .modern-gridview tr.round-blue td:first-child,
html[data-theme="light"] .matrix-container .modern-gridview tr.round-blue:hover td:first-child {
    background: rgba(37, 99, 235, 0.35) !important;
    color: #0f172a !important;
}

/* Standardized Action Feedback - Added May 2026 */



.spinner-ring {
    width: 64px;
    height: 64px;
    border: 5px solid rgba(16, 185, 129, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin-global 0.8s linear infinite;
}

@keyframes spin-global {
    to { transform: rotate(360deg); }
}

/* Enhanced Alert Popup System */
.alert-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 100001;
    align-items: center;
    justify-content: center;
}

#AlertDiv {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
    position: relative;
    transform: translateY(-20px);
    animation: alert-slide-in 0.3s ease-out forwards;
}

html[data-theme="dark"] #AlertDiv {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

#AlertMessage {
    color: var(--text-main);
    font-weight: 500;
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.6;
}

@keyframes alert-slide-in {
    to { transform: translateY(0); }
}

/* ── End Action Feedback ── */

/* Text colors and validation utility classes */
.text-danger { color: var(--danger) !important; }
.text-accent { color: var(--accent) !important; }
.text-primary { color: var(--primary) !important; }
.validator-error { color: var(--danger) !important; font-size: 0.75rem !important; }

/* ── Modern DetailsView Checkbox Styling ── */
.modern-detailsview input[type="checkbox"] {
    appearance: checkbox !important;
    -webkit-appearance: checkbox !important;
    width: auto !important;
    height: auto !important;
    cursor: pointer;
    vertical-align: middle;
}

.modern-detailsview input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Section dividers inside DetailsView */
.modern-detailsview .grid-section-header,
.modern-detailsview td.grid-section-header {
    background: transparent !important;
    color: var(--secondary) !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    border-bottom: none !important;
    border-right: none !important;
    padding-top: 1.5rem !important;
    padding-bottom: 0.5rem !important;
}

html[data-theme="light"] .modern-detailsview .grid-section-header,
html[data-theme="light"] .modern-detailsview td.grid-section-header {
    color: var(--secondary) !important;
}

/* Result Indicators - Thin Colored Strips */
.score-container {
    display: inline-flex;
    align-items: stretch;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.result-badge {
    width: 6px;
    display: block;
    flex-shrink: 0;
}

.badge-w {
    background: #4CAF50 !important; /* Green */
}

.badge-l {
    background: #ef4444 !important; /* Red */
}

.badge-d {
    background: #94a3b8 !important; /* Gray */
}

.badge-a {
    background: #ef4444 !important; /* Red for Abandoned/Postponed */
}



