/* ---------- BASE ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Comic Sans MS", "Poppins", sans-serif;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    transition: all 0.6s ease;
    position: relative;
}

/* ---------- HEADER ---------- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    position: relative;
    z-index: 100;
}

/* ---------- GAUCHE : Hastral ---------- */
.left h1 {
    font-size: 48px;
    font-weight: bold;
    color: var(--accent);
    display: flex;
    gap: 0px;
    font-family: "Comic Sans MS", "Marker Felt", "Permanent Marker", cursive;
    user-select: none;
}

.left h1 span {
    display: inline-block;
    transform: rotate(var(--rotate, 0deg));
    transition: transform 0.3s;
}

.left h1 span:hover {
    transform: rotate(calc(var(--rotate, 0deg) + 15deg)) scale(1.2);
    cursor: default;
}

.left h1 span:nth-child(1) { color: #ff4b5c; }
.left h1 span:nth-child(2) { color: #ffb400; }
.left h1 span:nth-child(3) { color: #6efff0; }
.left h1 span:nth-child(4) { color: #4dff6b; }
.left h1 span:nth-child(5) { color: #ffa1ff; }
.left h1 span:nth-child(6) { color: #ff6f91; }
.left h1 span:nth-child(7) { color: #7c83fd; }

/* ---------- CENTRE : barre de recherche ---------- */
.center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.center input {
    width: 280px;
    padding: 12px 20px;
    border-radius: 30px;
    border: 3px solid var(--accent);
    outline: none;
    background: var(--input-bg);
    color: var(--text);
    font-size: 16px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.center input::placeholder {
    color: var(--accent);
    font-weight: bold;
}

/* ---------- DROITE : engrenage + profil ---------- */
.right {
    display: flex;
    align-items: center;
    gap: 15px;
}

#gear {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent);
    transition: transform 0.2s;
}

#gear:hover {
    transform: scale(1.2);
}

.profile {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    transition: transform 0.2s;
    background: var(--panel);
    border: 3px solid var(--accent);
    overflow: hidden;
}

.profile:hover {
    transform: scale(1.1);
}

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

/* ---------- SETTINGS ---------- */
#settings {
    position: absolute;
    top: 60px;
    right: 25px;
    background: var(--panel);
    padding: 12px;
    border-radius: 15px;
    display: none;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: scaleY(0);
    transform-origin: top;
    opacity: 0;
    z-index: 1000;
}

#settings.open {
    display: block;
    transform: scaleY(1);
    opacity: 1;
}

#settings p {
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text);
}

#settings button {
    display: block;
    margin-top: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: var(--button);
    color: var(--text);
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    width: 100%;
}

#settings button:hover {
    transform: scale(1.05);
}

/* ---------- STARS ---------- */
.stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(1px 1px at 70% 60%, white, transparent),
        radial-gradient(2px 2px at 40% 80%, white, transparent),
        radial-gradient(1px 1px at 90% 20%, white, transparent),
        radial-gradient(2px 2px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(1px 1px at 15% 70%, white, transparent),
        radial-gradient(2px 2px at 60% 90%, white, transparent);
    background-size: 200% 200%;
    animation: twinkle 3s ease-in-out infinite;
    transition: opacity 0.6s ease;
    z-index: 1;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ---------- THEMES ---------- */
.theme-white {
    --bg: linear-gradient(180deg, #ffffff, #f2f2f2);
    --text: #000;
    --accent: #444;
    --input-bg: #ffffff;
    --panel: #ffffff;
    --button: #eaeaea;
}

.theme-black {
    --bg: linear-gradient(180deg, #0f0f0f, #1c1c1c);
    --text: #ffffff;
    --accent: #bbbbbb;
    --input-bg: #2a2a2a;
    --panel: #1e1e1e;
    --button: #333;
}

.theme-sunset {
    --bg: linear-gradient(180deg, #ff7e5f 0%, #feb47b 40%, #ffcc70 70%, #f7f7ff 100%);
    --text: #4b1e1e;
    --accent: #b73e3e;
    --input-bg: rgba(255,255,255,0.8);
    --panel: rgba(255,255,255,0.9);
    --button: #ff9f68;
}

.theme-night {
    --bg: linear-gradient(180deg, #050b1e, #0b1d3a, #020617);
    --text: #ffffff;
    --accent: #9fcbff;
    --input-bg: rgba(20,30,60,0.8);
    --panel: rgba(10,20,50,0.9);
    --button: #1e2f5c;
}

.theme-night .stars {
    opacity: 1;
}

/* ---------- MODAL ---------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.hidden {
    display: none;
}

.profile-modal {
    background: var(--panel);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    padding: 40px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.profile-modal h2 {
    text-align: center;
    color: var(--text);
    margin-bottom: 20px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--accent);
    border-radius: 10px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ---------- AVATAR SELECTOR ---------- */
.profile-selector {
    margin-bottom: 20px;
}

.profile-preview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto 15px;
    overflow: hidden;
    border: 3px solid #667eea;
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: var(--text);
}

.profile-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.arrow-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #667eea;
    background: var(--input-bg);
    cursor: pointer;
    font-size: 20px;
    color: #667eea;
    transition: all 0.3s;
}

.arrow-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.upload-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.upload-btn:hover {
    background: #5568d3;
}

/* ---------- BUTTONS ---------- */
.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.logout-btn {
    width: 100%;
    padding: 12px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #e84142;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .left h1 {
        font-size: 32px;
    }
    
    .center input {
        width: 200px;
    }
    
    header {
        padding: 10px 15px;
    }
    
    .profile-modal {
        padding: 30px 20px;
    }
}

/* ---------- RESPONSIVE MOBILE AMÉLIORÉ ---------- */
@media (max-width: 480px) {
    /* Header adapté mobile */
    header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 10px;
    }
    
    .left h1 {
        font-size: 28px;
    }
    
    /* Centre fixé */
    .center {
        position: static;
        transform: none;
        width: 100%;
    }
    
    .center input#searchBar {
        width: 100% !important;
        max-width: 100%;
    }
    
    .center input#searchBar:focus {
        width: 100% !important;
    }
    
    /* Boutons header */
    .right {
        width: 100%;
        justify-content: center;
    }
    
    #musicBtn {
        font-size: 20px;
        padding: 8px 12px;
    }
    
    #gear {
        font-size: 20px;
    }
    
    .profile {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    /* Settings dropdown mobile */
    #settings {
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    /* Modal profil mobile */
    .profile-modal {
        padding: 25px 15px;
        width: 95%;
        max-height: 85vh;
    }
    
    .profile-modal h2 {
        font-size: 20px;
    }
    
    .profile-preview {
        width: 120px;
        height: 120px;
        font-size: 48px;
    }
    
    .form-group input {
        font-size: 16px; /* Évite le zoom automatique iOS */
    }
    
    .submit-btn, .logout-btn {
        font-size: 15px;
        padding: 12px;
    }
    
    /* Boutons avatar plus petits */
    .arrow-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .upload-btn {
        padding: 8px 15px;
        font-size: 13px;
    }
}

/* ---------- RESPONSIVE TRÈS PETIT ÉCRAN ---------- */
@media (max-width: 360px) {
    .left h1 {
        font-size: 24px;
    }
    
    .profile-preview {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }
    
    .profile-controls {
        flex-wrap: wrap;
    }
}
/* ---------- RECHERCHE DE JEUX ---------- */
.center input#searchBar {
    width: 350px !important;
    padding: 12px 20px 12px 45px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: 15px center !important;
    background-size: 20px !important;
}

.center input#searchBar:focus {
    width: 420px !important;
    border-color: #667eea !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4) !important;
}

.no-results-message {
    grid-column: 1 / -1;
    width: 100%;
}