/* ============================================================
   Zugzwang — Global Styles
   Chess tournament management app
   ============================================================ */

/* --- Reset & Base --- */

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    height: 100%;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Transitions globales (tout le composant feel smooth) --- */

.mud-button,
.mud-icon-button,
.mud-chip,
.mud-paper,
.mud-card,
.mud-nav-link,
.mud-table-row,
.mud-tab {
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* --- AppBar polish --- */

.mud-appbar {
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* --- Navigation drawer --- */

.mud-nav-link.active {
    background-color: var(--mud-palette-primary) !important;
    color: white !important;
    border-radius: 8px;
    margin: 2px 8px;
}

.mud-nav-link:hover:not(.active) {
    background-color: var(--mud-palette-primary-hover) !important;
    border-radius: 8px;
    margin: 2px 8px;
}

/* --- Card hover lift --- */

.mud-card:hover,
.mud-paper.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

/* --- Button press effect --- */

.mud-button:active {
    transform: scale(0.97) !important;
}

.mud-icon-button:active {
    transform: scale(0.9) !important;
}

/* --- Table styling --- */

.mud-table .mud-table-head .mud-table-cell {
    font-weight: 600 !important;
    font-size: 0.72rem !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mud-palette-text-secondary) !important;
    border-bottom: 2px solid var(--mud-palette-primary) !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

.mud-table-body .mud-table-row .mud-table-cell {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
}

.mud-table-body .mud-table-row:last-child .mud-table-cell {
    border-bottom: none !important;
}

/* --- Page fade-in animation --- */

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

.mud-main-content > * {
    animation: fadeInUp 300ms ease-out;
}

/* --- Page header gradient (reutilisable) --- */

.page-header {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #388E3C 100%);
    border-radius: 16px;
    padding: 20px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    min-height: 72px;
    margin-bottom: 16px;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: 30%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    pointer-events: none;
}

.page-header h4,
.page-header h5,
.page-header .mud-typography-h4,
.page-header .mud-typography-h5 {
    color: white !important;
}

.page-header .mud-typography-body2,
.page-header .mud-typography-subtitle1,
.page-header .header-subtitle {
    color: rgba(255,255,255,0.75) !important;
}

.page-header .mud-icon-root {
    color: rgba(255,255,255,0.25);
}

/* Dark mode override */
.mud-dark .page-header {
    background: linear-gradient(135deg, #1B3A1B 0%, #2E5A2E 50%, #1B5E20 100%);
}

/* --- Empty state --- */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    border-radius: 16px;
    border: 2px dashed var(--mud-palette-lines-default);
}

.empty-state .mud-icon-root {
    font-size: 64px !important;
    opacity: 0.2;
    margin-bottom: 12px;
}

/* --- Score display --- */

.score-cell {
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Board number */
.board-number {
    font-weight: 700;
    color: var(--mud-palette-primary);
}

/* Colonnes numeriques (Elo, scores, rangs) */
.col-numeric {
    font-variant-numeric: tabular-nums;
    text-align: center;
}

/* --- Status (theme-aware) --- */

.status-active { color: var(--mud-palette-success); }
.status-withdrawn { color: var(--mud-palette-error); }
.status-completed { color: var(--mud-palette-info); }

/* --- Elo colore par niveau --- */

.elo-master { color: #c62828; font-weight: 700; }       /* 2200+ */
.elo-expert { color: #e65100; font-weight: 600; }       /* 2000-2199 */
.elo-strong { color: var(--mud-palette-primary); font-weight: 600; }  /* 1800-1999 */

/* --- Titres FIDE --- */

.title-gm { color: #c62828; font-weight: 700; }
.title-im { color: #e65100; font-weight: 700; }
.title-fm { color: var(--mud-palette-primary); font-weight: 600; }
.title-cm { color: var(--mud-palette-text-secondary); font-weight: 600; }
.title-wgm, .title-wim, .title-wfm, .title-wcm { font-style: italic; }

/* --- Resultats de parties --- */

.result-win { color: var(--mud-palette-success); font-weight: 600; }
.result-loss { color: var(--mud-palette-error); opacity: 0.7; }
.result-draw { color: var(--mud-palette-warning); font-weight: 500; }

/* --- Dialog polish --- */

.mud-dialog {
    border-radius: 16px !important;
}

.mud-dialog .mud-dialog-title {
    padding: 20px 24px 12px !important;
}

.mud-dialog .mud-dialog-content {
    padding: 12px 24px !important;
}

.mud-dialog .mud-dialog-actions {
    padding: 12px 24px 16px !important;
}

/* --- Tabs --- */

.mud-tabs .mud-tab {
    text-transform: none !important;
    font-weight: 500;
    letter-spacing: 0;
}

.mud-tabs .mud-tab.mud-tab-active {
    font-weight: 700;
}

.mud-tabs .mud-tab-slider {
    height: 3px;
    border-radius: 3px 3px 0 0;
}

/* --- Snackbar --- */

.mud-snackbar {
    border-radius: 12px !important;
    font-weight: 500;
}

/* --- Focus ring --- */

.mud-input-outlined .mud-input-slot:focus-within {
    box-shadow: 0 0 0 2px rgba(27, 94, 32, 0.15);
}

.mud-dark .mud-input-outlined .mud-input-slot:focus-within {
    box-shadow: 0 0 0 2px rgba(102, 187, 106, 0.2);
}

/* --- Tooltip --- */

.mud-tooltip {
    border-radius: 8px !important;
    font-size: 0.8rem !important;
    padding: 6px 12px !important;
}

/* --- Scrollbar custom (Webkit) --- */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--mud-palette-lines-default);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--mud-palette-text-secondary);
}

/* --- Progress bar --- */

.mud-progress-linear {
    height: 6px !important;
    border-radius: 3px !important;
}
