/* Intra Chess League - Warm Chess Theme */
/* A crafted, cohesive design system */

:root {
    /* Light theme - soft warm slate */
    --bg-primary: #f5f7fa;
    --bg-secondary: #fafbfc;
    --bg-tertiary: #eef1f5;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --success: #059669;
    --error: #dc2626;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
}

.dark {
    /* Dark theme - deep slate/indigo */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-hover: #475569;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-light: #1e1b4b;
    --success: #34d399;
    --error: #f87171;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Layout */
.min-h-screen { min-height: 100vh; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.inline { display: inline; }
.block { display: block; }
.grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.space-y-12 > * + * { margin-top: 3rem; }

/* Grid */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}
.col-span-full { grid-column: 1 / -1; }

/* Spacing */
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-auto { margin-top: auto; }
.mt-1 { margin-top: 0.25rem; }
.mb-1 { margin-top: 0.25rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-4 { margin-left: 1rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.pl-4 { padding-left: 1rem; }

/* Width */
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-20 { width: 5rem; }
.h-20 { height: 5rem; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-none { max-width: none; }

/* Typography */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-4xl { font-size: 2.25rem; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }

/* Colors */
.text-white { color: #fff; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: #111827; }
.text-blue-600 { color: #2563eb; }
.text-red-700 { color: #b91c1c; }
.bg-white { background-color: #fff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-900 { background-color: #111827; }
.bg-red-50 { background-color: #fef2f2; }

/* Borders */
.border { border-width: 1px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-l { border-left-width: 1px; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-red-200 { border-color: #fecaca; }
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }

/* Interactivity */
.transition { transition: all 150ms ease; }
.hover\:text-gray-700:hover { color: #374151; }
.hover\:text-gray-900:hover { color: #111827; }
.hover\:text-blue-800:hover { color: #1e40af; }
.hover\:underline:hover { text-decoration: underline; }
.hover\:bg-gray-700:hover { background-color: #374151; }
.hover\:border-gray-300:hover { border-color: #d1d5db; }
.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5); }
.focus\:border-transparent:focus { border-color: transparent; }

/* Prose (for markdown content) */
.prose { max-width: 65ch; }
.prose h1 { font-size: 2rem; font-weight: 700; margin-top: 2rem; margin-bottom: 1rem; }
.prose h2 { font-size: 1.5rem; font-weight: 700; margin-top: 1.5rem; margin-bottom: 0.75rem; }
.prose h3 { font-size: 1.25rem; font-weight: 600; margin-top: 1.25rem; margin-bottom: 0.5rem; }
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.prose li { margin-bottom: 0.25rem; }
.prose a { color: #2563eb; text-decoration: underline; }
.prose code { background: #f3f4f6; padding: 0.125rem 0.25rem; border-radius: 0.25rem; font-size: 0.875em; }
.prose pre { background: #1f2937; color: #f9fafb; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; }
.prose blockquote { border-left: 4px solid #e5e7eb; padding-left: 1rem; color: #6b7280; font-style: italic; }

/* Dark mode */
.dark .dark\:bg-gray-800 { background-color: #1f2937; }
.dark .dark\:bg-gray-900 { background-color: #111827; }
.dark .dark\:bg-gray-700 { background-color: #374151; }
.dark .dark\:text-white { color: #fff; }
.dark .dark\:text-gray-100 { color: #f3f4f6; }
.dark .dark\:text-gray-200 { color: #e5e7eb; }
.dark .dark\:text-gray-300 { color: #d1d5db; }
.dark .dark\:text-gray-400 { color: #9ca3af; }
.dark .dark\:text-blue-400 { color: #60a5fa; }
.dark .dark\:text-green-400 { color: #4ade80; }
.dark .dark\:text-red-400 { color: #f87171; }
.dark .dark\:border-gray-600 { border-color: #4b5563; }
.dark .dark\:border-gray-700 { border-color: #374151; }
.dark .dark\:hover\:text-white:hover { color: #fff; }
.dark .dark\:hover\:text-gray-200:hover { color: #e5e7eb; }
.dark .dark\:hover\:text-blue-300:hover { color: #93c5fd; }
.dark .dark\:hover\:bg-gray-200:hover { background-color: #e5e7eb; }
.dark .dark\:hover\:bg-gray-700:hover { background-color: #374151; }
.dark .dark\:block { display: block; }
.dark .dark\:hidden { display: none; }
.hidden { display: none; }
.transition-colors { transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease; }
.dark .dark\:hover\:border-gray-600:hover { border-color: #4b5563; }
.dark .dark\:bg-green-900 { background-color: #14532d; }
.dark .dark\:bg-red-900 { background-color: #7f1d1d; }
.dark .dark\:text-green-300 { color: #86efac; }
.dark .dark\:text-red-300 { color: #fca5a5; }
.dark .dark\:border-green-700 { border-color: #15803d; }
.dark .dark\:border-red-700 { border-color: #b91c1c; }
.dark .dark\:bg-gray-700 { background-color: #374151; }
.dark .dark\:border-gray-600 { border-color: #4b5563; }
.dark .dark\:text-white { color: #fff; }
.dark .dark\:hover\:text-blue-400:hover { color: #60a5fa; }

/* Additional color utilities */
.text-purple-600 { color: #9333ea; }
.text-orange-600 { color: #ea580c; }
.text-green-600 { color: #16a34a; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-green-50 { background-color: #f0fdf4; }
.bg-purple-50 { background-color: #faf5ff; }
.bg-orange-50 { background-color: #fff7ed; }
.bg-green-100 { background-color: #dcfce7; }
.bg-blue-100 { background-color: #dbeafe; }
.text-blue-700 { color: #1d4ed8; }
.text-green-700 { color: #15803d; }
.text-purple-700 { color: #7e22ce; }
.text-orange-700 { color: #c2410c; }
.hover\:bg-blue-100:hover { background-color: #dbeafe; }
.hover\:bg-green-100:hover { background-color: #dcfce7; }
.hover\:bg-purple-100:hover { background-color: #f3e8ff; }
.hover\:bg-orange-100:hover { background-color: #ffedd5; }

/* Dark mode color utilities */
.dark .dark\:text-purple-400 { color: #c084fc; }
.dark .dark\:text-orange-400 { color: #fb923c; }
.dark .dark\:bg-blue-900 { background-color: #1e3a8a; }
.dark .dark\:bg-purple-900 { background-color: #581c87; }
.dark .dark\:bg-orange-900 { background-color: #7c2d12; }
.dark .dark\:bg-gray-600 { background-color: #4b5563; }
.dark .dark\:text-blue-300 { color: #93c5fd; }
.dark .dark\:text-purple-300 { color: #d8b4fe; }
.dark .dark\:text-orange-300 { color: #fdba74; }
.dark .dark\:hover\:bg-blue-800:hover { background-color: #1e40af; }
.dark .dark\:hover\:bg-green-800:hover { background-color: #166534; }
.dark .dark\:hover\:bg-purple-800:hover { background-color: #6b21a8; }
.dark .dark\:hover\:bg-orange-800:hover { background-color: #9a3412; }
.dark .dark\:hover\:bg-gray-600:hover { background-color: #4b5563; }

/* ========================================
   COMPONENT CLASSES - Using CSS Variables
   ======================================== */

/* Cards */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-hover);
}

.card-clickable {
    cursor: pointer;
}

.card-clickable:hover {
    transform: translateY(-1px);
}

/* Remove visited link styling from clickable cards */
.card-clickable:visited,
.game-row:visited,
a.card:visited {
    color: var(--text-primary);
}

/* Game row - for tournament game lists */
.game-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.15s ease;
}

.game-row:hover {
    background-color: var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.btn-danger {
    background-color: transparent;
    color: var(--error);
    border-color: transparent;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-danger:hover {
    background-color: rgba(220, 38, 38, 0.1);
}

.btn-sm {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
}

/* Form inputs */
.input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.input::placeholder {
    color: var(--text-muted);
}

textarea.input {
    resize: vertical;
    min-height: 100px;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

/* Navigation */
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

/* Theme toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Header */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* Badges/Tags */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-accent {
    background-color: var(--accent-light);
    color: var(--accent);
}

/* Stats */
.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Tables */
.table-container {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background-color: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: var(--bg-tertiary);
}

/* Alerts */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: rgba(45, 106, 79, 0.1);
    border: 1px solid rgba(45, 106, 79, 0.2);
    color: var(--success);
}

.alert-error {
    background-color: rgba(155, 44, 44, 0.1);
    border: 1px solid rgba(155, 44, 44, 0.2);
    color: var(--error);
}

/* Links */
.link {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

.link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Page sections */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

/* Avatar */
.avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 5rem;
    height: 5rem;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 600;
}

/* Admin links */
.admin-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    background-color: var(--bg-tertiary);
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: background-color 0.15s ease;
}

.admin-link:hover {
    background-color: var(--border-color);
}

.admin-link:visited {
    color: var(--text-primary);
}

/* Chess-specific */
.game-result {
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Utility overrides for theming */
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-tertiary { background-color: var(--bg-tertiary); }
.border-themed { border-color: var(--border-color); }

/* Chess Analysis Styles */
.admin-article {
    line-height: 1.8;
    font-size: 0.9375rem;
}

.move-link {
    background-color: var(--accent-light);
    color: var(--accent);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    text-decoration: none;
    font-weight: 500;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.move-link:hover {
    background-color: var(--accent);
    color: white;
}

/* Chess annotation colors */
.chess-brilliant { color: #00b4d8; font-weight: 600; }
.chess-good { color: #2ecc71; font-weight: 600; }
.chess-interesting { color: #f39c12; font-weight: 600; }
.chess-dubious { color: #e67e22; font-weight: 600; }
.chess-mistake { color: #f1c40f; font-weight: 600; }
.chess-blunder { color: #e74c3c; font-weight: 600; }

/* Custom color tags */
.chess-color-green { color: #2ecc71; }
.chess-color-red { color: #e74c3c; }
.chess-color-blue { color: #3498db; }
.chess-color-yellow { color: #f1c40f; }
.chess-color-teal { color: #00b4d8; }
.chess-color-orange { color: #e67e22; }

/* Mobile Navigation */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.nav-mobile {
    display: none;
    flex-direction: column;
    padding: 0 1rem 1rem;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.nav-mobile.show {
    display: flex;
}

.nav-mobile-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9375rem;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease;
}

.nav-mobile-link:hover {
    background-color: var(--bg-tertiary);
}

/* Responsive breakpoint */
@media (max-width: 768px) {
    .nav-desktop {
        display: none !important;
    }
    
    .nav-hamburger {
        display: block;
    }
    
    .nav-mobile:not(.hidden) {
        display: flex;
    }
}

@media (min-width: 769px) {
    .nav-mobile {
        display: none !important;
    }
    
    .nav-hamburger {
        display: none !important;
    }
}

/* ========================================
   ROUND SEARCH BAR FIX
   ======================================== */

.search-pill {
    /* Shape & Size */
    width: 100%;
    max-width: 400px;       /* Makes it wider (approx 25rem) */
    padding: 0.75rem 1.5rem; /* Thicker padding */
    border-radius: 9999px;   /* Perfectly round "pill" corners */
    
    /* Theme Colors (Guarantees Dark Mode works) */
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    
    /* Polish */
    outline: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

/* Focus State */
.search-pill:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Container alignment */
.search-form-container {
    width: 100%;
    display: flex;
    justify-content: flex-end; /* Pushes to right on desktop */
}

/* Mobile override: Full width */
@media (max-width: 768px) {
    .search-pill {
        max-width: 100%;
    }
}