/* =====================================================
   GAMES MANAGER — Main Stylesheet
   Palette : Indigo/Violet #6366f1, dark theme
   ===================================================== */

:root {
    --primary:    #6366f1;
    --primary-d:  #4f46e5;
    --primary-l:  #818cf8;
    --accent:     #f59e0b;
    --success:    #10b981;
    --danger:     #ef4444;
    --bg:         #0f0e17;
    --bg2:        #1a1927;
    --bg3:        #242338;
    --border:     rgba(99,102,241,0.18);
    --text:       #e2e1f0;
    --muted:      #6b6a7d;
    --card-bg:    #1a1927;
    --nav-h:      64px;
    --bottom-nav: 68px;
    --font-head:  'Syne', sans-serif;
    --font-body:  'Inter', sans-serif;
}

/* RESET & BASE */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-top: var(--nav-h);
    padding-bottom: calc(var(--bottom-nav) + 8px);
    overflow-x: hidden;
}

@media (min-width: 992px) {
    body {
        padding-bottom: 24px;
    }
}

/* BACKGROUND MESH */
body::before {
    content: '';
    position: fixed;
    top: -40%;
    left: -20%;
    width: 80vw;
    height: 80vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* TOP NAV */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: rgba(15,14,23,.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.top-nav .nav-link {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: .875rem;
    color: var(--muted);
    padding: .4rem .75rem;
    border-radius: 8px;
    transition: all .2s;
}

.top-nav .nav-link:hover,
.top-nav .nav-link.active {
    color: var(--primary-l);
    background: rgba(99,102,241,.12);
}

.brand-icon {
    font-size: 1.4rem;
    color: var(--primary-l);
    margin-right: .4rem;
}

.brand-text {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    letter-spacing: -.02em;
}

/* MOBILE HEADER */
.mobile-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: rgba(15,14,23,.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

body { padding-top: 52px; }
@media (min-width: 992px) { body { padding-top: var(--nav-h); } }

.mobile-brand {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.05rem;
    color: #fff;
    text-decoration: none;
}

.mobile-brand i { color: var(--primary-l); }

/* BOTTOM NAV */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav);
    background: rgba(15,14,23,.97);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: stretch;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    text-decoration: none;
    font-size: .68rem;
    font-family: var(--font-body);
    font-weight: 500;
    transition: color .2s;
    padding: 8px 0;
}

.bottom-nav-item i {
    font-size: 1.35rem;
    transition: transform .2s;
}

.bottom-nav-item.active,
.bottom-nav-item:active {
    color: var(--primary-l);
}

.bottom-nav-item.active i {
    transform: translateY(-2px);
}

/* MAIN CONTENT */
.main-content {
    position: relative;
    z-index: 1;
    padding: 1rem;
}

@media (min-width: 992px) {
    .main-content { padding: 1.5rem 2rem; }
}

/* PAGE TITLE */
.page-title {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 1.25rem;
    letter-spacing: -.02em;
}

.page-title i { color: var(--primary-l); }

/* CARDS */
.gm-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem 1.1rem;
    transition: border-color .2s, transform .15s;
    position: relative;
    overflow: hidden;
}

.gm-card:hover {
    border-color: rgba(99,102,241,.4);
    transform: translateY(-1px);
}

.gm-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-l));
    opacity: 0;
    transition: opacity .2s;
}

.gm-card:hover::before { opacity: 1; }

.gm-card-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    margin-bottom: .25rem;
}

/* BADGES */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .72rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 20px;
}

.player-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* STAT NUMBERS */
.stat-num {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 2.2rem;
    color: var(--primary-l);
    line-height: 1;
}

.stat-label {
    font-size: .78rem;
    color: var(--muted);
    font-weight: 500;
}

/* FILTER BAR */
.filter-bar {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-chip {
    padding: .3rem .8rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.filter-chip:hover,
.filter-chip.active {
    border-color: var(--primary);
    color: var(--primary-l);
    background: rgba(99,102,241,.12);
}

/* FAB */
.fab {
    position: fixed;
    bottom: calc(var(--bottom-nav) + 14px);
    right: 18px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    color: #fff;
    border: none;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(99,102,241,.45);
    cursor: pointer;
    z-index: 900;
    transition: transform .15s, box-shadow .15s;
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(99,102,241,.6);
}

@media (min-width: 992px) {
    .fab { bottom: 24px; }
}

/* MODALS */
.modal-content {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.1rem 1.4rem;
}

.modal-title {
    font-family: var(--font-head);
    font-weight: 700;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: .9rem 1.4rem;
}

/* FORMS */
.form-control, .form-select {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    padding: .6rem .9rem;
    font-size: .9rem;
    transition: border-color .15s;
}

.form-control:focus, .form-select:focus {
    background: var(--bg3);
    border-color: var(--primary);
    color: var(--text);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .3rem;
}

/* BUTTONS */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    border: none;
    font-weight: 600;
    border-radius: 10px;
    padding: .55rem 1.2rem;
    transition: opacity .15s, transform .1s;
}

.btn-primary:hover { opacity: .9; transform: translateY(-1px); }

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary-l);
    border-radius: 10px;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

/* TABLES */
.table {
    color: var(--text);
}

.table thead th {
    font-family: var(--font-head);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding: .6rem .8rem;
}

.table tbody td {
    border-color: var(--border);
    padding: .65rem .8rem;
    vertical-align: middle;
}

/* LOGIN */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem 1.8rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo i {
    font-size: 3rem;
    color: var(--primary-l);
}

.login-logo h1 {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.6rem;
    color: #fff;
    margin-top: .4rem;
}

/* SESSION FORM */
.player-score-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .8rem;
    background: var(--bg3);
    border-radius: 10px;
    margin-bottom: .5rem;
}

.player-score-row .player-name {
    flex: 1;
    font-weight: 600;
    font-size: .9rem;
}

.player-score-row input[type=number] {
    width: 90px;
    text-align: center;
}

.winner-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s;
    padding: 0;
}

.winner-toggle.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

/* HISTORY CARD */
.session-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: .9rem 1rem;
    margin-bottom: .75rem;
}

.session-card-game {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: .95rem;
    color: #fff;
}

.session-card-date {
    font-size: .75rem;
    color: var(--muted);
}

.rank-1 { color: #fbbf24; font-weight: 700; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #b45309; }

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: .75rem;
    opacity: .5;
}

.empty-state p {
    font-size: .9rem;
    margin-bottom: 1rem;
}

/* COLOR PICKER */
input[type=color] {
    width: 44px;
    height: 38px;
    padding: 2px 4px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--bg3);
    cursor: pointer;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ANIMATIONS */
@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.gm-card, .session-card {
    animation: fadeSlide .25s ease both;
}
