/* --------- Reset & base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    background: radial-gradient(circle at top left, #1f2937, #020617 55%);
    color: #e5e7eb;
}

/* --------- Layout global ---------- */

.container {
    width: min(100% - 2rem, 960px);
    margin: 2rem auto;
}

/* --------- Navbar ---------- */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #020617, #111827);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

/* Logo / brand */
.navbar-brand {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-decoration: none;
    color: #e5e7eb;
}

.navbar-brand::first-letter {
    color: #38bdf8;
}

/* Liens à droite */
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.9rem;
    text-decoration: none;
    color: #e5e7eb;
    border: 1px solid transparent;
    transition: all 0.18s ease-out;
}

/* Lien "Register" style bouton */
.navbar-nav a[href$="register"] {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    color: #0b1120;
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(56, 189, 248, 0.35);
}

/* Hover et focus */
.navbar-nav a:hover,
.navbar-nav a:focus-visible {
    border-color: rgba(148, 163, 184, 0.7);
    background-color: rgba(15, 23, 42, 0.9);
}

.navbar-nav a[href$="register"]:hover,
.navbar-nav a[href$="register"]:focus-visible {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

/* --------- Navbar search ---------- */

.navbar-search {
    flex: 1;
    display: flex;
    justify-content: center;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 380px;
}

.search-input {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.95);
    color: #e5e7eb;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.16s ease-out,
                box-shadow 0.16s ease-out,
                background-color 0.16s ease-out;
}

.search-input::placeholder {
    color: #6b7280;
}

.search-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6);
    background-color: rgba(15, 23, 42, 1);
}

.search-btn {
    padding-inline: 1rem;
    white-space: nowrap;
}

/* Logout */
.logout-form {
    margin: 0;
}

.logout-btn {
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
}

/* --------- Typo globale ---------- */

h1, h2, h3 {
    color: #f9fafb;
    margin-top: 0;
}

p {
    color: #cbd5f5;
}

/* --------- Page d'auth (register/login) ---------- */

.auth-page {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.auth-card {
    width: min(100%, 420px);
    background: radial-gradient(circle at top left,
        rgba(30, 64, 175, 0.25),
        rgba(15, 23, 42, 0.98));
    border-radius: 1rem;
    padding: 2.4rem 2.2rem 2rem;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(148, 163, 184, 0.35);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(56, 189, 248, 0.35);
    opacity: 0.35;
    pointer-events: none;
}

.auth-title {
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
}

.auth-subtitle {
    font-size: 0.95rem;
    color: #9ca3af;
    margin-bottom: 1.8rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e5e7eb;
}

.input {
    padding: 0.6rem 0.75rem;
    border-radius: 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.95);
    color: #e5e7eb;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.16s ease-out, box-shadow 0.16s ease-out,
        background-color 0.16s ease-out;
}

.input::placeholder {
    color: #6b7280;
}

.input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6);
    background-color: rgba(15, 23, 42, 1);
}

/* Boutons */

.btn {
    border: none;
    cursor: pointer;
    padding: 0.65rem 1rem;
    border-radius: 0.65rem;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: transform 0.15s ease-out,
        box-shadow 0.15s ease-out,
        filter 0.15s ease-out;
}

.btn-primary {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    color: #0b1120;
    box-shadow: 0 12px 35px rgba(8, 47, 73, 0.9);
}

.btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(8, 47, 73, 1);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 8px 18px rgba(8, 47, 73, 0.8);
}

.btn-full {
    width: 100%;
}

/* Messages */

.alert {
    font-size: 0.85rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.6rem;
    margin-bottom: 0.75rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(34, 197, 94, 0.5);
    color: #bbf7d0;
}

.alert-danger {
    background: rgba(185, 28, 28, 0.12);
    border-color: rgba(248, 113, 113, 0.5);
    color: #fecaca;
}

.field-error {
    font-size: 0.8rem;
    color: #fecaca;
}

.auth-footer-text {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    text-align: center;
    color: #9ca3af;
}

.auth-footer-text a {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 500;
}

.auth-footer-text a:hover {
    text-decoration: underline;
}

/* --------- HOME PAGE ---------- */

.home-page {
    min-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1.5rem 4rem;
    gap: 2.5rem;
}

/* Carte profil user */
.user_card {
    width: min(100%, 760px);
    background: radial-gradient(circle at top left,
        rgba(30, 64, 175, 0.25),
        rgba(15, 23, 42, 0.98));
    border-radius: 1rem;
    padding: 2.2rem 2rem;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(148, 163, 184, 0.35);
    position: relative;
    overflow: hidden;
}

.user_card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(56, 189, 248, 0.25);
    opacity: 0.35;
    pointer-events: none;
}

.user-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.75rem;
    position: relative;
    z-index: 1;
}

.user-avatar {
    width: 78px;
    height: 78px;
    border-radius: 999px;
    overflow: hidden;
    border: 2px solid rgba(56, 189, 248, 0.7);
    box-shadow: 0 10px 30px rgba(8, 47, 73, 0.9);
    flex-shrink: 0;
    background: radial-gradient(circle at top, #1f2937, #020617);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 1.4rem;
    margin: 0 0 0.25rem;
    color: #f9fafb;
}

.user-subtitle {
    margin: 0 0 0.9rem;
    font-size: 0.9rem;
    color: #9ca3af;
}

.user-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.home-pill {
    padding: 0.32rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: #e5e7eb;
}

.user-total {
    text-align: right;
    flex-shrink: 0;
}

.user-total-label {
    display: block;
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 0.25rem;
}

.user-total-amount {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fbbf24;
}

/* --------- INVENTAIRE PAR JEU (home) ---------- */

.games-wrapper {
    margin-top: 0.5rem;
    width: 100%;
    max-width: 960px;
}

/* Grids */
.games-grid {
    display: grid;
    gap: 1.5rem;
    width: 100%;
    margin-top: 1rem;
}

.games-grid-1 {
    grid-template-columns: 1fr;
}

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

/* Carte inventaire par jeu */
.game-card {
    background: radial-gradient(circle at top left,
        rgba(30, 64, 175, 0.25),
        rgba(15, 23, 42, 0.98));
    border-radius: 1rem;
    padding: 1.6rem 1.5rem;
    box-shadow:
        0 20px 50px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(148, 163, 184, 0.35);
    position: relative;
    overflow: hidden;
}

.game-title {
    margin: 0 0 0.4rem;
    font-size: 1.2rem;
    color: #f9fafb;
}

.game-subtitle {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #9ca3af;
}

.game-actions {
    margin-top: 1.1rem;
}

/* Carousel quand 3+ jeux */
.games-carousel {
    margin-top: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.games-carousel-inner {
    display: flex;
    gap: 1.25rem;
    min-width: 100%;
}

.games-carousel-inner .game-card {
    min-width: 260px;
    max-width: 320px;
}

/* --------- Pages d'erreur / construction ---------- */

.error-page {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem 4rem;
}

.error-card {
    width: min(100%, 480px);
    padding: 2.4rem 2.2rem 2rem;
    border-radius: 1.5rem;
    background: radial-gradient(circle at top left,
        rgba(30, 64, 175, 0.25),
        rgba(15, 23, 42, 0.98));
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(148, 163, 184, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.35);
    text-align: center;
}

.error-illustration {
    max-width: 260px;
    width: 100%;
    margin: 0 auto 1.5rem;
    display: block;
}

.error-title {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    color: #f9fafb;
}

.error-text {
    font-size: 0.95rem;
    color: #cbd5f5;
    margin-bottom: 1.75rem;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

/* --------- Riftbound cards grid ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}


.card-item {
    display: flex;
    flex-direction: column;
    padding: 0.8rem;
    border-radius: 0.8rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

/* fusion des deux définitions .card-thumb */
.card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 0.6rem;
    margin-bottom: 0.6rem;
    background: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* boutons +/- sur la carte */
.card-actions {
    position: absolute;
    right: 0.4rem;
    bottom: 0.4rem;
    display: flex;
    gap: 0.25rem;
}

.card-btn {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.card-btn-plus {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #022c22;
}

.card-btn-minus {
    background: rgba(248, 113, 113, 0.2);
    color: #fecaca;
}

.card-info h2 {
    font-size: 1rem;
    margin: 0 0 0.25rem;
}

.card-meta {
    font-size: 0.8rem;
    color: #9ca3af;
    margin: 0 0 0.5rem;
}

.card-desc {
    font-size: 0.85rem;
    color: #cbd5f5;
}

/* --------- Responsive ---------- */

@media (max-width: 900px) {
    .home-page {
        padding-top: 2rem;
        align-items: flex-start;
    }

    .user_card {
        width: 100%;
    }

    .user-card-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-total {
        text-align: left;
        width: 100%;
        margin-top: 0.75rem;
    }

    /* 2 jeux → 1 colonne sur écran étroit */
    .games-grid-2 {
        grid-template-columns: 1fr;
    }

    /* cartes du carousel un peu plus larges sur mobile */
    .games-carousel-inner .game-card {
        min-width: 80%;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .navbar-search {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .search-form {
        max-width: 100%;
    }

    .navbar-nav {
        order: 2;
    }
}

@media (max-width: 640px) {
    .navbar {
        padding-inline: 1rem;
    }

    .navbar-nav {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .auth-card {
        padding: 2rem 1.5rem 1.8rem;
    }

    .error-card {
        padding: 2rem 1.6rem 1.8rem;
        width: 100%;
    }

    .error-actions {
        flex-direction: column;
    }

    .error-actions .btn {
        width: 100%;
    }
}
