/* =======================================================
   FICHIER : shop-header.css
   PROJET : HelloColis Shopping - Header Néon
   VERSION : 3.0 (Avec nos optimisations mobile)
   ======================================================= */

/* -------------------------------------
   VARIABLES & CONSTANTES
------------------------------------- */
:root {
    --neon-blue: #4A90E2;
    --neon-blue-light: #5AA0F2;
    --neon-blue-dark: #2A60B0;
    --neon-glow: 0 0 15px rgba(74, 144, 226, 0.5);
    --bg-header: rgba(10, 15, 30, 0.95);
    --text-light: #FFFFFF;
    --text-dim: #A3D0FF;
    --border-neon: rgba(74, 144, 226, 0.25);
    --cart-badge: #FF4757;
    --header-height: 70px;
    --header-height-tablet: 60px;
    --header-height-mobile: 55px;
}

/* -------------------------------------
   HEADER PRINCIPAL
------------------------------------- */
.shop-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-neon);
    box-shadow: 0 4px 20px rgba(0, 10, 30, 0.4);
    z-index: 1000;
    padding: 0.8rem 2rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.shop-header .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* -------------------------------------
   BRANDING (Logo + Titre)
------------------------------------- */
.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 200px;
}

.header-logo {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-blue-dark) 100%);
    border-radius: 8px;
    padding: 6px;
    box-shadow: var(--neon-glow);
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.05);
}

.header-logo svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.header-title {
    font-family: 'Michroma', sans-serif;
    font-size: 1.4rem;
    font-weight: 400;
    background: linear-gradient(90deg, var(--text-light) 0%, var(--text-dim) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
    margin: 0;
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
    white-space: nowrap;
}

/* -------------------------------------
   RECHERCHE DESKTOP
------------------------------------- */
.header-search {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.header-search form {
    display: flex;
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    background: rgba(20, 30, 50, 0.7);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 25px 0 0 25px;
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
    background: rgba(25, 40, 70, 0.9);
}

.search-input::placeholder {
    color: #8AABD9;
    opacity: 0.7;
}

.search-btn {
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-blue-dark) 100%);
    border: none;
    border-radius: 0 25px 25px 0;
    padding: 0 1.5rem;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: linear-gradient(135deg, var(--neon-blue-light) 0%, #3A70C0 100%);
    box-shadow: var(--neon-glow);
}

.search-btn svg {
    width: 18px;
    height: 18px;
}

/* -------------------------------------
   RECHERCHE MOBILE (Icône)
------------------------------------- */
.header-search-mobile {
    display: none;
    align-items: center;
}

.header-search-mobile .search-toggle {
    background: transparent;
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--neon-blue);
    transition: all 0.3s ease;
    padding: 0;
}

.header-search-mobile .search-toggle:hover,
.header-search-mobile .search-toggle:active {
    background: rgba(74, 144, 226, 0.15);
    border-color: var(--neon-blue);
    color: var(--text-light);
    transform: scale(1.05);
    box-shadow: var(--neon-glow);
}

.header-search-mobile .search-toggle svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    filter: drop-shadow(0 0 5px rgba(74, 144, 226, 0.5));
}

/* -------------------------------------
   ACTIONS UTILISATEUR
------------------------------------- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 100px;
    justify-content: flex-end;
}

.header-icon {
    background: transparent;
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.3s ease;
    position: relative;
}

.header-icon:hover {
    border-color: var(--neon-blue);
    color: var(--text-light);
    background: rgba(74, 144, 226, 0.1);
    transform: translateY(-2px);
}

.cart-icon {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--cart-badge);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(255, 71, 87, 0.4);
}

/* -------------------------------------
   RECHERCHE EXPANSIVE (Mobile)
------------------------------------- */
.search-expanded {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    padding: 0.8rem 1rem;
    z-index: 1100;
    border-bottom: 1px solid var(--border-neon);
    box-shadow: 0 4px 20px rgba(0, 10, 30, 0.8);
    animation: slideDown 0.3s ease;
    display: none;
}

.search-expanded-container {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    max-width: 600px;
    margin: 0 auto;
}

.search-back {
    background: none;
    border: none;
    color: var(--neon-blue);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.search-back:hover {
    background: rgba(74, 144, 226, 0.1);
    color: white;
}

.search-expanded-input {
    flex: 1;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    outline: none;
}

.search-expanded-input:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
}

.search-expanded-btn {
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-blue-dark) 100%);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-expanded-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--neon-glow);
}

/* -------------------------------------
   ANIMATIONS
------------------------------------- */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* -------------------------------------
   MEDIA QUERIES - TABLETTE
------------------------------------- */
@media (max-width: 900px) {
    .shop-header {
        padding: 0.6rem 1rem;
        height: var(--header-height-tablet);
    }

    .header-title {
        font-size: 1.1rem;
    }

    .header-search {
        margin: 0 1rem;
        max-width: 300px;
    }

    .search-input {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .header-logo {
        width: 35px;
        height: 35px;
    }

    .header-logo svg {
        width: 24px;
        height: 24px;
    }
}

/* -------------------------------------
   MEDIA QUERIES - MOBILE (AVEC NOS OPTIMISATIONS)
------------------------------------- */
@media (max-width: 600px) {
    .shop-header {
        padding: 0.5rem;
        height: var(--header-height-mobile);
    }

    .shop-header .header-container {
        gap: 0.25rem;
    }

    /* ✅ AFFICHAGE DU TITRE EN MOBILE (forcé avec nos valeurs) */
    .header-title {
        display: block !important;
        font-size: 0.7rem !important;
        font-weight: 500;
        max-width: 80px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-left: 4px;
        -webkit-text-fill-color: white; /* Force la couleur */
        background: none; /* Enlève le dégradé */
        color: white;
    }

    /* ✅ LOGO PLUS PETIT (comme on avait) */
    .header-logo {
        width: 32px;
        height: 32px;
        padding: 4px;
    }

    .header-logo svg {
        width: 22px;
        height: 22px;
    }

    /* ✅ CACHER RECHERCHE DESKTOP */
    .header-search {
        display: none;
    }

    /* ✅ AFFICHER RECHERCHE MOBILE (avec nos ajustements) */
    .header-search-mobile {
        display: flex;
        margin-left: auto;
        margin-right: 0.25rem;
    }

    .header-search-mobile .search-toggle {
        width: 34px;
        height: 34px;
    }

    .header-search-mobile .search-toggle svg {
        width: 20px;
        height: 20px;
    }

    /* ✅ ACTIONS UTILISATEUR (avec nos espacements) */
    .header-actions {
        gap: 0.25rem;
        min-width: auto;
    }

    .header-icon {
        width: 34px;
        height: 34px;
    }

    .header-icon svg {
        width: 18px;
        height: 18px;
    }

    .cart-count {
        width: 16px;
        height: 16px;
        font-size: 0.6rem;
        top: -4px;
        right: -4px;
    }

    /* ✅ RECHERCHE EXPANSIVE (ajustée) */
    .search-expanded {
        padding: 0.5rem;
    }

    .search-expanded-container {
        gap: 0.5rem;
    }

    .search-expanded-input {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .search-back svg,
    .search-expanded-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* -------------------------------------
   TRÈS PETITS MOBILES (NOS OPTIMISATIONS)
------------------------------------- */
@media (max-width: 400px) {
    .header-title {
        max-width: 60px;
        font-size: 0.65rem !important;
    }

    .header-logo {
        width: 28px;
        height: 28px;
    }

    .header-logo svg {
        width: 18px;
        height: 18px;
    }

    .header-search-mobile .search-toggle {
        width: 30px;
        height: 30px;
    }

    .header-icon {
        width: 30px;
        height: 30px;
    }

    .header-search-mobile .search-toggle svg {
        width: 18px;
        height: 18px;
    }
}