@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800&family=Russo+One&display=swap');

:root {
    /* --- PALETTE TITAN OS --- */
    --bg-app: #10141e; 
    --bg-panel: #1e2538; 
    --bg-sidebar: #161b29;
    --primary: #fb923c; 
    --primary-dark: #ea580c; 
    --accent: #38bdf8;
    --gold: #facc15; 
    --danger: #ef4444; 
    --success: #4ade80;
    --text-main: #ffffff; 
    --text-muted: #94a3b8;
    --radius-l: 24px; 
    --radius-m: 16px; 
    --radius-s: 12px;
    --border-ui: 2px solid rgba(255,255,255,0.05);
}

/* RESET GLOBAL */
* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body { 
    margin: 0; padding: 0;
    background-color: var(--bg-app); 
    color: var(--text-main); 
    font-family: 'Outfit', sans-serif; 
    font-size: 16px; line-height: 1.5;
    min-height: 100vh; overflow-x: hidden; 
}

/* TYPOGRAPHIE */
h1, h2, h3, .titular { 
    font-family: 'Russo One', sans-serif; 
    text-transform: uppercase; 
    margin: 0; 
    color: #fff; 
    letter-spacing: 1px; 
}

/* LAYOUT & SIDEBAR */
.layout { 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
}

.sidebar {
    background: var(--bg-sidebar); 
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 10px 15px; 
    display: flex; 
    align-items: center; 
    gap: 10px;
    overflow-x: auto; 
    white-space: nowrap; 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    flex-shrink: 0;
}

.brand-logo {
    height: 40px;
    width: 40px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.brand { 
    display: none; 
}

.nav-category, .profile-widget { display: none; }

.nav-link {
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    padding: 8px 16px;
    background: rgba(255,255,255,0.05); 
    border-radius: 20px; 
    color: var(--text-muted);
    text-decoration: none; 
    font-weight: 700; 
    font-size: 0.85rem; 
    transition: 0.2s;
}
.nav-link i { font-size: 1.1rem; }
.nav-link.active { background: var(--primary); color: #000; }

.main-content { 
    flex: 1; 
    padding: 20px; 
    width: 100%; 
    overflow: visible; 
}

/* COMPOSANTS STANDARDS */
.card, .panel, .quest-card, .login-card, .raid-card {
    background: var(--bg-panel); 
    border-radius: var(--radius-l); 
    border: var(--border-ui);
    padding: 25px; 
    margin-bottom: 20px; 
    position: relative; 
    width: 100%;
}

.btn { 
    padding: 16px; 
    border-radius: var(--radius-s); 
    border: none; 
    font-family: 'Russo One'; 
    text-transform: uppercase; 
    cursor: pointer; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 10px; 
    color: #fff; 
    width: 100%; 
    font-size: 1rem; 
    transition: 0.2s; 
}
.btn-action { 
    background: linear-gradient(to bottom, #fb923c, #ea580c); 
    box-shadow: 0 4px 0 #c2410c; 
}
.btn-action:active { transform: translateY(2px); box-shadow: none; }

.input-tech { 
    width: 100%; 
    background: #131824; 
    border: 2px solid #2d364f; 
    padding: 15px; 
    color: #fff; 
    font-family: 'Outfit'; 
    font-weight: 600; 
    border-radius: var(--radius-s); 
    font-size: 1rem; 
}

/* GRILLES */
.grid-2, .adventure-grid, .rpg-layout, .dashboard-grid, .radar-grid, .chat-layout { 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
}

/* GESTION AFFICHAGE MOBILE/DESKTOP */
/* Par défaut (Mobile First logique ou Desktop standard), on cache la barre mobile */
.mobile-user-bar { display: none; }

/* RESPONSIVE PC (Écrans larges) */
@media (min-width: 1024px) {
    .layout { flex-direction: row; overflow: hidden; height: 100vh; }
    
    .sidebar { 
        width: 280px; 
        height: 100vh; 
        flex-direction: column; 
        border-right: var(--border-ui); 
        border-bottom: none; 
        padding: 30px; 
        overflow-y: auto; 
        align-items: stretch; 
    }
    
    .brand { 
        display: flex; 
        align-items: center; 
        gap: 10px;
        font-size: 1.2rem; 
        font-weight: 900; 
        margin-bottom: 20px; 
        color: #fff; 
    }

    .nav-category { display: block; margin-top: 20px; margin-bottom: 10px; font-size: 0.7rem; font-weight: 800; color: var(--text-muted); border-left: 2px solid var(--primary); padding-left: 10px; }
    .profile-widget { display: flex; align-items: center; gap: 15px; padding: 15px; background: var(--bg-panel); border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); margin-bottom: 20px; cursor: pointer; }
    
    .nav-link { display: flex; width: 100%; padding: 12px 15px; background: transparent; margin-bottom: 5px; font-size: 0.9rem; }
    .nav-link:hover { background: rgba(255,255,255,0.05); color: #fff; }
    
    .main-content { padding: 40px; overflow-y: auto; height: 100vh; }
    
    .grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
    .adventure-grid { display: grid; grid-template-columns: 1fr 350px; height: calc(100vh - 140px); min-height: 600px; }
    .rpg-layout { display: grid; grid-template-columns: 350px 380px 1fr; height: calc(100vh - 140px); min-height: 600px; }
    .dashboard-grid, .radar-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; }
    .chat-layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 140px); min-height: 600px; }
}

/* --- SYSTEM MODAL TITAN (POP-UPS) --- */
.sys-modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(16, 20, 30, 0.85);
    backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.sys-modal-overlay.active { opacity: 1; pointer-events: all; }

.sys-modal-card {
    background: #1e2538; width: 90%; max-width: 400px;
    border-radius: 24px; padding: 30px; text-align: center;
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    transform: scale(0.9) translateY(20px);
    transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative; overflow: hidden;
}
.sys-modal-overlay.active .sys-modal-card { transform: scale(1) translateY(0); }

/* Variantes de Couleurs */
.modal-type-info { border-color: var(--accent); }
.modal-type-success { border-color: var(--success); }
.modal-type-danger { border-color: var(--danger); }
.modal-type-levelup { border-color: var(--gold); background: linear-gradient(to bottom, #2a2615, #1e2538); }

/* Contenu Interne */
.sys-icon-box {
    font-size: 3.5rem; margin-bottom: 15px;
    animation: bounceIcon 1s infinite alternate;
}
.modal-type-info .sys-icon-box { color: var(--accent); filter: drop-shadow(0 0 10px var(--accent)); }
.modal-type-success .sys-icon-box { color: var(--success); filter: drop-shadow(0 0 10px var(--success)); }
.modal-type-danger .sys-icon-box { color: var(--danger); filter: drop-shadow(0 0 10px var(--danger)); }
.modal-type-levelup .sys-icon-box { color: var(--gold); font-size: 5rem; filter: drop-shadow(0 0 20px var(--gold)); }

.sys-title { font-size: 1.5rem; margin-bottom: 10px; color: #fff; }
.sys-msg { color: var(--text-muted); font-size: 1rem; margin-bottom: 25px; line-height: 1.5; }

.sys-btn {
    background: rgba(255,255,255,0.1); border: none; color: #fff;
    padding: 12px 30px; border-radius: 12px; font-family: 'Russo One';
    cursor: pointer; transition: 0.2s; font-size: 1rem; width: 100%;
}
.sys-btn:hover { background: #fff; color: #000; }
.modal-type-levelup .sys-btn { background: var(--gold); color: #000; box-shadow: 0 0 20px rgba(250, 204, 21, 0.4); }

/* Animation Level Up */
.levelup-rays {
    position: absolute; top: 50%; left: 50%; width: 600px; height: 600px;
    background: repeating-conic-gradient(from 0deg, rgba(250, 204, 21, 0.1) 0deg 10deg, transparent 10deg 20deg);
    transform: translate(-50%, -50%); z-index: -1;
    animation: spinRays 10s linear infinite;
}

@keyframes bounceIcon { from { transform: translateY(0); } to { transform: translateY(-10px); } }
@keyframes spinRays { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }


/* ============================================================
   TITAN OS - MOBILE EXPERIENCE V2 (NATIVE APP FEEL)
   S'active uniquement sur les écrans < 768px
   ============================================================ */
@media (max-width: 768px) {

    /* --- 1. LAYOUT & SCROLL --- */
    body {
        overflow-x: hidden;
        background: #10141e;
        padding-bottom: 90px; /* Espace pour le dock */
    }

    .layout {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .main-content {
        padding: 80px 15px 20px 15px; /* Padding Top pour le Header Fixe */
        height: auto;
        overflow: visible;
        width: 100%;
    }

    /* --- 2. HEADER APP (FIXE EN HAUT) --- */
    .hub-header, header:not(.main-header) {
        display: none !important; /* Cache les gros headers PC */
    }

    /* Force l'affichage du header mobile s'il est présent */
    .mobile-user-bar {
        display: block !important;
    }

    /* Simulation d'un Header Natif (Titres, etc.) */
    .main-content::before {
        content: 'TITAN OS';
        position: fixed;
        top: 0; left: 0; width: 100%;
        height: 60px;
        background: rgba(16, 20, 30, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-bottom: 1px solid rgba(255,255,255,0.05);
        z-index: 900;
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: 'Russo One';
        font-size: 1.2rem;
        color: #fff;
        letter-spacing: 2px;
        box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    }

    /* --- 3. NAVIGATION (DOCK SCROLLABLE) --- */
    .sidebar {
        position: fixed;
        bottom: 0; left: 0; width: 100%; height: 80px;
        background: rgba(19, 24, 36, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255,255,255,0.08);
        border-right: none; border-bottom: none;
        
        /* ALIGNEMENT HORIZONTAL + SCROLL */
        display: flex;
        flex-direction: row;
        justify-content: flex-start; /* Aligné au début pour le scroll */
        align-items: center;
        gap: 5px;
        padding: 0 15px;
        
        overflow-x: auto; /* Active le scroll horizontal */
        scroll-behavior: smooth;
        scrollbar-width: none; /* Cache scrollbar Firefox */
        -ms-overflow-style: none; /* Cache scrollbar IE */
        
        z-index: 1000;
        box-shadow: 0 -5px 30px rgba(0,0,0,0.5);
    }
    
    /* Cache scrollbar Chrome/Safari */
    .sidebar::-webkit-scrollbar { display: none; }

    .sidebar .brand, .sidebar .profile-widget, .sidebar .nav-category { display: none !important; }

    .nav-link {
        flex: 0 0 auto; /* EMPÊCHE L'ÉCRASEMENT */
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: transparent !important;
        padding: 8px 5px;
        width: 68px; /* Largeur fixe tactile */
        min-width: 68px;
        height: 100%;
        color: #64748b;
        font-size: 0.6rem;
        font-weight: 700;
        gap: 4px;
        border-radius: 12px;
        text-align: center;
        line-height: 1.2;
    }

    .nav-link i {
        font-size: 1.5rem;
        margin-bottom: 2px;
        display: block;
        transition: 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .nav-link.active { 
        color: #fff !important; 
        background: rgba(255,255,255,0.03) !important;
    }
    .nav-link.active i {
        color: var(--primary);
        transform: translateY(-3px);
        filter: drop-shadow(0 0 10px var(--primary));
    }
    .nav-link.active::after {
        content: ''; 
        width: 4px; height: 4px; 
        background: var(--primary); 
        border-radius: 50%;
        margin-top: 2px;
    }

    /* --- 4. CARTES & GRILLES EMPILES --- */
    .grid-2, .module-grid, .rpg-layout, .dashboard-grid, .adventure-grid, .chat-interface, .chat-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px;
        height: auto !important;
    }

    .card, .module-card, .panel, .boss-stage {
        width: 100% !important;
        height: auto !important;
        border-radius: 20px;
        padding: 20px;
        margin: 0;
    }

    /* --- 5. TYPOGRAPHIE & DÉTAILS --- */
    h1, h2, h3, .titular { font-size: 1.2rem !important; }
    .btn, .hero-btn { width: 100%; padding: 18px; font-size: 1rem; border-radius: 16px; }
    .input-tech { padding: 15px; font-size: 1rem; }

    /* Ajustements Aventure */
    .adventure-grid { height: auto; }
    .boss-stage { padding: 30px 20px; }
    .boss-avatar { font-size: 5rem; }
    
    /* Ajustements Stats */
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi-card { height: 110px; padding: 15px; }
    .kpi-icon { font-size: 2.5rem; }

    /* Ajustements Profil */
    .doll-area { height: 500px; margin-bottom: 20px; }
    
    /* Ajustements Chat */
    .contact-panel { height: 280px; margin-bottom: 10px; }
    .chat-area { height: 500px; }

    footer { text-align: center !important; margin-bottom: 20px; }
}