/**
 * GameSwap - Stylesheet Principal
 * Plateforme d'échange de jeux vidéo
 *
 * Direction : "comptoir de troc" / étiquette de cartouche.
 * Fond sombre façon écran éteint, accents or (cartouche) et magenta (échange).
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=IBM+Plex+Mono:wght@400;500;600&family=Manrope:wght@400;500;700;800&display=swap');

/* ===== VARIABLES CSS ===== */
:root {
    /* Surfaces */
    --bg: #15121c;
    --bg-alt: #1c1826;
    --surface: #211c2e;
    --surface-edge: #332b45;
    --surface-hover: #2a2438;

    /* Texte */
    --ink: #eee7db;
    --muted: #948da3;

    /* Accents */
    --primary: #ff3d6e;
    --primary-dark: #e0285a;
    --primary-light: #ff6b90;
    --secondary: #e8a33d;
    --secondary-dark: #c98a2c;
    --success: #6ee7a0;
    --danger: #ef4444;
    --warning: #e8a33d;
    --info: #7dd3fc;
    --dark: #0e0c13;
    --light: var(--surface);
    --white: #ffffff;

    /* Alias niveaux de gris (mappés sur la palette sombre pour compatibilité) */
    --gray-50: #211c2e;
    --gray-100: #29233a;
    --gray-200: #332b45;
    --gray-300: #443a58;
    --gray-400: #6a6178;
    --gray-500: #948da3;
    --gray-600: #b3aec0;
    --gray-700: #d3cedb;
    --gray-800: #eee7db;
    --gray-900: #f7f4ee;

    /* Dégradés (conservés pour compatibilité, recolorés) */
    --gradient: linear-gradient(135deg, #3a2a55 0%, #241c33 100%);
    --gradient-2: linear-gradient(135deg, #5c3220 0%, #241c33 100%);
    --gradient-3: linear-gradient(135deg, #1f4436 0%, #241c33 100%);
    --gradient-success: linear-gradient(135deg, #1f4436 0%, #16321f 100%);

    /* Polices */
    --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    --font-body: 'Manrope', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;

    /* Bordures */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-full: 9999px;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    background-image: radial-gradient(circle at 1px 1px, rgba(238, 231, 219, 0.05) 1px, transparent 0);
    background-size: 26px 26px;
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

button {
    font-family: inherit;
    cursor: pointer;
}

ul {
    list-style: none;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}

/* ===== SCROLLBAR PERSONNALISÉE ===== */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-dark);
}

/* ===== NAVBAR ===== */
.navbar {
    background: rgba(21, 18, 28, 0.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--surface-edge);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.navbar .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    transition: var(--transition);
}

.navbar .logo:hover {
    color: var(--secondary);
}

/* ===== BURGER (mobile) ===== */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.navbar-toggle:hover {
    background: var(--surface);
}

.navbar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: var(--transition);
    margin: 0 auto;
}

.navbar-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.navbar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===== NAVBAR MENU (liens + auth) ===== */
.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-links {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.navbar-links a {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.92rem;
    transition: var(--transition-fast);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.navbar-links a:hover {
    color: var(--ink);
    background: var(--surface);
}

.navbar-links a.active {
    color: var(--secondary);
    background: var(--surface);
}

/* ===== BADGE DE NOTIFICATION ===== */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--primary);
    color: white;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    line-height: 1;
}

.nav-badge-inline {
    margin-left: auto;
}

/* ===== ZONE AUTH ===== */
.navbar-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-auth > a {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.navbar-auth > a:hover,
.navbar-auth > a.active {
    color: var(--secondary);
}

/* ===== MENU UTILISATEUR (avatar + dropdown) ===== */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.9rem 0.35rem 0.35rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-menu-trigger:hover {
    background: var(--surface-hover);
    border-color: var(--secondary);
}

.user-menu-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-menu-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-chevron {
    color: var(--muted);
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

.user-menu.open .user-menu-chevron {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition-fast);
    z-index: 1001;
}

.user-menu.open .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.user-menu-dropdown a:hover,
.user-menu-dropdown a.active {
    background: var(--surface-hover);
    color: var(--secondary);
}

.user-menu-dropdown a.user-menu-logout {
    color: var(--danger);
}

.user-menu-dropdown a.user-menu-logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.user-menu-divider {
    height: 1px;
    background: var(--surface-edge);
    margin: 0.4rem 0.2rem;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 2rem;
    right: 2rem;
    height: 2px;
    background: linear-gradient(90deg, var(--secondary), transparent);
}

.card:hover {
    border-color: var(--surface-edge);
    box-shadow: var(--shadow-lg);
}

.card-header {
    border-bottom: 1px solid var(--surface-edge);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.card-header h2 {
    color: var(--ink);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ===== GRID SYSTEM ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.75rem;
}

/* ===== GAME CARD (cartouche) ===== */
.game-card {
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-6px);
    border-color: var(--secondary);
    box-shadow: var(--shadow-lg);
}

.game-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: var(--transition);
    filter: saturate(0.92);
}

.game-card:hover img {
    transform: scale(1.04);
}

.game-card .game-info {
    padding: 1.4rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.game-card h3 {
    color: var(--ink);
    margin-bottom: 0.7rem;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
}

.game-card h4 {
    color: var(--ink);
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.game-platform,
.game-condition {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    margin-bottom: 0.6rem;
    margin-right: 0.5rem;
}

.game-platform {
    background: rgba(232, 163, 61, 0.14);
    border: 1px solid rgba(232, 163, 61, 0.45);
    color: var(--secondary);
}

.game-condition {
    background: transparent;
    border: 1px dashed rgba(110, 231, 160, 0.55);
    color: var(--success);
}

.game-card p {
    color: var(--muted);
    font-size: 0.92rem;
}

.game-owner {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--surface-edge);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
}

.game-owner img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--secondary);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.85rem 1.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 61, 110, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: #1a1408;
    border-color: var(--secondary);
}

.btn-secondary:hover {
    background: #f3b658;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(232, 163, 61, 0.3);
}

.btn-success {
    background: var(--success);
    color: #0e2018;
    border-color: var(--success);
}

.btn-success:hover {
    background: #85f0b5;
    transform: translateY(-2px);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--secondary);
    color: var(--secondary);
}

.btn-outline:hover {
    background: var(--secondary);
    color: #1a1408;
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
    display: block;
}

/* ===== SÉLECTEUR PAYS / DRAPEAU (téléphone) ===== */
.iti {
    width: 100%;
}

.iti input.form-control,
.iti input[type="tel"].form-control {
    background: var(--bg-alt);
    color: var(--ink);
    border-color: var(--surface-edge);
}

.iti__flag-container .iti__selected-flag {
    background: var(--surface);
    border-right: 1px solid var(--surface-edge);
    border-radius: var(--radius) 0 0 var(--radius);
}

.iti__flag-container .iti__selected-flag:hover,
.iti__flag-container .iti__selected-flag:focus {
    background: var(--surface-hover);
}

.iti__country-list {
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    color: var(--ink);
    box-shadow: var(--shadow-lg);
}

.iti__country.iti__highlight {
    background: var(--surface-hover);
}

.iti__dial-code {
    color: var(--muted);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 700;
    color: var(--ink);
    font-size: 0.92rem;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: var(--transition);
    background: var(--bg-alt);
    color: var(--ink);
}

.form-control::placeholder {
    color: var(--muted);
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.15);
    background: var(--bg-alt);
}

.form-control:hover {
    border-color: var(--muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23948da3' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.7rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

/* ===== ALERTS ===== */
.alert {
    padding: 1.1rem 1.4rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    animation: slideInDown 0.5s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert::before {
    font-family: var(--font-mono);
    font-size: 1rem;
}

.alert-success {
    background: rgba(110, 231, 160, 0.1);
    color: #a5f3c4;
    border-left: 3px solid var(--success);
}

.alert-success::before {
    content: "✓";
    color: var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-left: 3px solid var(--danger);
}

.alert-danger::before {
    content: "✕";
    color: var(--danger);
}

.alert-info {
    background: rgba(125, 211, 252, 0.1);
    color: #bae6fd;
    border-left: 3px solid var(--info);
}

.alert-info::before {
    content: "i";
    color: var(--info);
}

.alert-warning {
    background: rgba(232, 163, 61, 0.1);
    color: #f3d19e;
    border-left: 3px solid var(--warning);
}

.alert-warning::before {
    content: "!";
    color: var(--warning);
}

/* ===== HERO SECTION ===== */
.hero {
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius-xl);
    padding: 4rem 3rem;
    text-align: center;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 3rem;
    right: 3rem;
    height: 2px;
    background: linear-gradient(90deg, var(--secondary), transparent 70%);
}

.hero h1 {
    font-size: 3rem;
    color: var(--ink);
    margin-bottom: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.hero p {
    font-size: 1.15rem;
    color: var(--muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.badge-pending {
    background: rgba(232, 163, 61, 0.16);
    color: var(--secondary);
    border: 1px solid rgba(232, 163, 61, 0.4);
}

.badge-accepted {
    background: rgba(110, 231, 160, 0.16);
    color: var(--success);
    border: 1px solid rgba(110, 231, 160, 0.4);
}

.badge-refused {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* ===== PROFILE ===== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--surface-edge);
}

.profile-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--secondary);
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.profile-avatar:hover {
    transform: scale(1.04);
}

.profile-info h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--ink);
}

.profile-info p {
    color: var(--muted);
    font-size: 1rem;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--surface-edge);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 1rem 1.6rem;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 700;
    font-family: var(--font-body);
    color: var(--muted);
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    font-size: 0.92rem;
}

.tab-btn:hover {
    color: var(--ink);
    background: var(--surface);
}

.tab-btn.active {
    color: var(--secondary);
    border-bottom-color: var(--secondary);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease both;
}

.fade-in:nth-child(1) { animation-delay: 0.1s; }
.fade-in:nth-child(2) { animation-delay: 0.2s; }
.fade-in:nth-child(3) { animation-delay: 0.3s; }
.fade-in:nth-child(4) { animation-delay: 0.4s; }
.fade-in:nth-child(5) { animation-delay: 0.5s; }
.fade-in:nth-child(6) { animation-delay: 0.6s; }

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== FOOTER ===== */
footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--surface-edge);
    padding: 3rem 0;
    margin-top: 5rem;
    text-align: center;
}

footer p {
    color: var(--muted);
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.85rem;
}

footer a {
    color: var(--secondary);
    font-weight: 600;
}

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

/* ===== LOADING STATES ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--surface-edge);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== TOOLTIPS ===== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 1rem;
    background: var(--dark);
    color: var(--ink);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .navbar .container {
        position: relative;
        flex-wrap: wrap;
    }

    .navbar-toggle {
        display: flex;
    }

    .navbar-menu {
        position: absolute;
        top: calc(100% + 1rem);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        background: var(--surface);
        border: 1px solid var(--surface-edge);
        border-radius: var(--radius);
        box-shadow: var(--shadow-lg);
        padding: 1rem;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
    }

    .navbar-menu.open {
        max-height: 80vh;
        opacity: 1;
        visibility: visible;
        padding: 1rem;
        overflow-y: auto;
    }

    .navbar-links {
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem;
    }

    .navbar-links a {
        width: 100%;
    }

    .navbar-auth {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        border-top: 1px solid var(--surface-edge);
        padding-top: 1rem;
    }

    .navbar-auth > a {
        text-align: center;
    }

    .user-menu-trigger {
        width: 100%;
        justify-content: center;
        border-radius: var(--radius);
    }

    .user-menu-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 1px solid var(--surface-edge);
        margin-top: 0.5rem;
        display: none;
    }

    .user-menu.open .user-menu-dropdown {
        display: block;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .hero h1 {
        font-size: 2.1rem;
    }

    .hero p {
        font-size: 1.05rem;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
    }

    .card {
        padding: 1.5rem;
    }

    .card-header h2 {
        font-size: 1.5rem;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 0.8rem 1.2rem;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 3rem 1.5rem;
    }

    .hero h1 {
        font-size: 1.7rem;
    }

    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.hidden { display: none; }
.visible { display: block; }

.flex { display: flex; }
.flex-column { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ===== ELEMENTS COMPLEMENTAIRES (accueil) ===== */
.eyebrow-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--success);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.eyebrow-tag::before {
    content: "";
    width: 7px;
    height: 7px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

.level-card {
    background: var(--bg-alt);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    padding: 1.8rem;
    position: relative;
}

.level-card .lv-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--secondary);
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 0.9rem;
}

.level-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.level-card p {
    color: var(--muted);
    font-size: 0.9rem;
}

.stat-block {
    text-align: center;
    padding: 2rem;
}

.stat-block .stat-num {
    font-family: var(--font-mono);
    font-size: 2.6rem;
    font-weight: 600;
    color: var(--success);
    text-shadow: 0 0 18px rgba(110, 231, 160, 0.25);
}

.stat-block .stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

/* ===== MESSAGERIE : BOÎTE DE RÉCEPTION ===== */
.conv-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.conv-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.conv-row:hover {
    background: var(--bg-alt);
    border-color: var(--surface-edge);
}

.conv-row.conv-unread {
    background: rgba(232, 163, 61, 0.06);
    border-color: rgba(232, 163, 61, 0.25);
}

.conv-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--surface-edge);
}

.conv-body {
    flex: 1;
    min-width: 0;
}

.conv-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.6rem;
}

.conv-name {
    font-weight: 700;
    color: var(--ink);
}

.conv-unread .conv-name {
    color: var(--secondary);
}

.conv-time {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
    white-space: nowrap;
}

.conv-preview {
    color: var(--muted);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.2rem;
}

.conv-you {
    color: var(--muted);
}

/* ===== MESSAGERIE : FIL DE CONVERSATION ===== */
.chat-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--surface-edge);
    background: var(--bg-alt);
}

.chat-back {
    font-size: 1.2rem;
    color: var(--muted);
    padding: 0.2rem 0.4rem;
}

.chat-back:hover {
    color: var(--secondary);
}

.chat-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--secondary);
}

.chat-header-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink);
}

.chat-messages {
    height: 55vh;
    min-height: 320px;
    overflow-y: auto;
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background-image: radial-gradient(circle at 1px 1px, rgba(238, 231, 219, 0.04) 1px, transparent 0);
    background-size: 22px 22px;
}

.chat-empty {
    margin: auto;
    text-align: center;
    color: var(--muted);
    max-width: 320px;
}

.chat-bubble-row {
    display: flex;
    width: 100%;
}

.chat-bubble-row.theirs {
    justify-content: flex-start;
}

.chat-bubble-row.mine {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 72%;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    position: relative;
}

.chat-bubble p {
    font-size: 0.95rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-bubble .chat-time {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    margin-top: 0.35rem;
    opacity: 0.7;
}

.theirs .chat-bubble {
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    color: var(--ink);
    border-bottom-left-radius: 2px;
}

.mine .chat-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.mine .chat-bubble .chat-time {
    color: rgba(255, 255, 255, 0.8);
}

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 0.7rem;
    padding: 1rem 1.4rem;
    border-top: 1px solid var(--surface-edge);
    background: var(--bg-alt);
}

.chat-input {
    flex: 1;
    resize: none;
    max-height: 120px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.4;
}

.chat-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.15);
}

.chat-send {
    flex-shrink: 0;
    padding: 0.75rem 1.4rem;
}

@media (max-width: 600px) {
    .chat-messages {
        height: 62vh;
    }

    .chat-bubble {
        max-width: 85%;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar, footer, .btn { display: none; }
    body { background: white; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
