/**
 * Medal of Honor Statistics - Theme System
 * Two themes: Modern Minimal & Military Dark
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Theme Variables)
   ============================================ */

/* Modern Minimal Theme (Default) */
:root,
.theme-minimal {
    /* Background colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;

    /* Text colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-accent: #f59e0b;

    /* Accent colors */
    --accent-primary: #f59e0b;
    --accent-secondary: #fbbf24;
    --accent-hover: #d97706;

    /* Border colors */
    --border-color: #334155;
    --border-accent: #475569;

    /* Status colors */
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;

    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Fonts */
    --font-heading: 'Rajdhani', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* Valentine's Day Theme (Feb 14 only - auto-activated) */
.theme-valentine {
    /* Background colors - romantic pink/rose palette */
    --bg-primary: #1a0a14;
    --bg-secondary: #2d1525;
    --bg-tertiary: #4a2038;
    --bg-hover: #5d2a48;

    /* Text colors - soft pink/white */
    --text-primary: #fce4ec;
    --text-secondary: #f8bbd9;
    --text-muted: #ce93d8;
    --text-accent: #ff69b4;

    /* Accent colors - hot pink/rose */
    --accent-primary: #ff69b4;
    --accent-secondary: #ff8ec4;
    --accent-hover: #ff1493;

    /* Border colors */
    --border-color: #5d2a48;
    --border-accent: #8b3a62;

    /* Status colors - pastel versions */
    --success: #81c784;
    --danger: #ff6b9d;
    --warning: #ffb74d;
    --info: #ba68c8;

    /* Shadows - romantic glow */
    --shadow-sm: 0 1px 3px 0 rgb(255 105 180 / 0.2);
    --shadow-md: 0 4px 8px -1px rgb(255 105 180 / 0.3);
    --shadow-lg: 0 10px 20px -3px rgb(255 105 180 / 0.4);

    /* Fonts - elegant */
    --font-heading: 'Rajdhani', 'Segoe UI', sans-serif;
}

/* Valentine's Day special effects */
.theme-valentine body {
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255, 105, 180, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 20, 147, 0.06) 0%, transparent 50%);
}

.theme-valentine .header-title::after {
    content: ' 💕';
}

.theme-valentine .nav-link:hover,
.theme-valentine .nav-link.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    text-shadow: 0 0 8px rgba(255, 105, 180, 0.5);
}

/* Military Dark Theme */
.theme-military {
    /* Background colors - olive/khaki military palette */
    --bg-primary: #1a1f16;
    --bg-secondary: #2d3428;
    --bg-tertiary: #3d4438;
    --bg-hover: #4a5240;

    /* Text colors - aged paper/cream */
    --text-primary: #e8e4d9;
    --text-secondary: #c4bfae;
    --text-muted: #9a9486;
    --text-accent: #d4a84b;

    /* Accent colors - brass/gold military */
    --accent-primary: #d4a84b;
    --accent-secondary: #c9a227;
    --accent-hover: #b8922d;

    /* Border colors */
    --border-color: #4a5240;
    --border-accent: #6b7a5c;

    /* Status colors */
    --success: #5d8a3e;
    --danger: #a63d3d;
    --warning: #c9a227;
    --info: #4a7c8c;

    /* Shadows - more dramatic */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 8px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 20px -3px rgb(0 0 0 / 0.6);

    /* Fonts - military feel */
    --font-heading: 'Black Ops One', 'Impact', sans-serif;
}

/* ============================================
   BASE STYLES
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Military theme background pattern */
.theme-military body {
    background-image:
        linear-gradient(90deg, rgba(74, 82, 64, 0.03) 1px, transparent 1px),
        linear-gradient(rgba(74, 82, 64, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: 0.025em;
}

.theme-military h1,
.theme-military h2,
.theme-military h3 {
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
}

/* ============================================
   HEADER
   ============================================ */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-brand img {
    height: 48px;
    width: auto;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
    display: none;
}

@media (min-width: 640px) {
    .header-title {
        display: block;
    }
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

.theme-military .nav-link {
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

/* Controls (language, theme) */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.control-btn svg {
    width: 1rem;
    height: 1rem;
}

/* ============================================
   SEARCH BOX
   ============================================ */

.search-container {
    position: relative;
    width: 100%;
    max-width: 320px;
}

.search-input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-top: 0.25rem;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--bg-hover);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .page-title {
        font-size: 2.25rem;
    }
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-weight: 400;
}

.card-body {
    padding: 1.5rem;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
    overflow-x: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
}

th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
    border-bottom: 2px solid var(--border-accent);
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

th.sortable:hover {
    color: var(--accent-primary);
}

td {
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-hover);
}

/* Clickable rows */
tr.clickable-row {
    cursor: pointer;
    transition: background var(--transition-fast);
}

tr.clickable-row:hover td {
    background: var(--bg-hover);
}

tr.clickable-row:active td {
    background: var(--bg-tertiary);
}

/* Zebra striping */
tbody tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.1);
}

tbody tr:nth-child(even):hover td {
    background: var(--bg-hover);
}

/* Numeric columns */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Player name in table */
.player-name {
    font-weight: 500;
    color: var(--accent-primary);
}

.player-name:hover {
    text-decoration: underline;
}

/* Map links */
.map-link {
    text-decoration: none;
    color: inherit;
    transition: opacity var(--transition-fast);
}

.map-link:hover {
    opacity: 0.85;
}

.map-link:hover span {
    text-decoration: underline;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled):not(.pagination-disabled) {
    background: var(--bg-hover);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.pagination-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
    font-weight: 600;
}

.pagination-btn:disabled,
.pagination-btn.pagination-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.pagination-ellipsis {
    border-color: transparent;
    background: transparent;
}

.pagination-info {
    padding: 0 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.footer-banner {
    text-align: center;
}

.footer-banner img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.footer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-info a {
    color: var(--accent-primary);
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Staggered animations for table rows */
.animate-rows tr {
    animation: fadeIn 0.3s ease-out both;
}

.animate-rows tr:nth-child(1) { animation-delay: 0.05s; }
.animate-rows tr:nth-child(2) { animation-delay: 0.1s; }
.animate-rows tr:nth-child(3) { animation-delay: 0.15s; }
.animate-rows tr:nth-child(4) { animation-delay: 0.2s; }
.animate-rows tr:nth-child(5) { animation-delay: 0.25s; }
.animate-rows tr:nth-child(n+6) { animation-delay: 0.3s; }

/* ============================================
   UTILITIES
   ============================================ */

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

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

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

.text-success {
    color: var(--success);
}

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

.font-bold {
    font-weight: 700;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.gap-4 {
    gap: 1rem;
}

/* Responsive grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }
}

/* Flex utilities */
.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

/* Map image styling */
.map-image {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: var(--bg-tertiary);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.badge-accent {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

/* Stats card */
.stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Theme transition */
body, .header, .footer, .card, table, th, td,
.nav-link, .control-btn, .search-input, .pagination-btn {
    transition: background-color var(--transition-normal),
                border-color var(--transition-normal),
                color var(--transition-normal);
}

/* Medal Animation Styles */
.medal-badge {
    display: inline-block;
    font-size: 1.5rem;
    margin-left: 0.5rem;
    cursor: pointer;
    vertical-align: middle;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.medal-badge.visible {
    opacity: 1;
    transform: scale(1);
}

.medal-badge:hover {
    transform: scale(1.2);
}

.medal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.medal-overlay.hidden {
    display: none;
}

.medal-animation {
    font-size: 8rem;
    opacity: 0;
    transform: scale(0);
    z-index: 10000;
}

.medal-animation.animate {
    animation: medalPopIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes medalPopIn {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-45deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.confetti-container {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    z-index: 9998;
    pointer-events: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
}

.confetti.animate {
    animation: confettiFall 1.5s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) rotate(720deg) scale(0);
    }
}

.spark {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FFD700;
    box-shadow: 0 0 10px #FFD700, 0 0 20px #FFA500;
    opacity: 0;
}

.spark.animate {
    animation: sparkBurst 0.8s ease-out forwards;
}

@keyframes sparkBurst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* Medal Tooltip */
.medal-tooltip {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    min-width: 200px;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.medal-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.medal-tooltip-header {
    font-weight: bold;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.medal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.medal-list li {
    padding: 0.25rem 0;
}

.medal-list li a {
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.medal-list li a:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

