/* --- Reset et Base (Kinema+ Dark Theme) --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; /* Police moderne et lisible */
    background: linear-gradient(160deg, #0A0A0A 0%, #1A1A1A 100%); /* Dégradé sombre et profond */
    color: #E0E0E0; /* Blanc cassé pour le texte général */
    min-height: 100vh;
    padding: 20px; /* Padding autour du container */
    -webkit-font-smoothing: antialiased; /* Meilleur rendu des polices */
    -moz-osx-font-smoothing: grayscale;
}

/* --- Container Principal --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(135deg, #1C1C1E 0%, #111111 100%); /* Dégradé sombre pour le fond du container */
    border-radius: 18px; /* Plus arrondis */
    box-shadow: 0 15px 40px rgba(0,0,0,0.7); /* Ombre profonde */
    overflow: hidden;
    border: 1px solid #282828; /* Bordure subtile */
}

/* --- Header --- */
.header {
    background: linear-gradient(135deg, #2A2A2E 0%, #1E1E22 100%); /* Fond légèrement différent pour le header */
    color: #FFFFFF; /* Blanc pur */
    padding: 30px;
    text-align: center;
    position: relative; /* Pour positionner les éléments internes */
    border-bottom: 1px solid #282828;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    background: rgba(255,255,255,0.08); /* Fond transparent plus subtil */
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1); /* Bordure translucide */
}

.user-photo {
    width: 55px; /* Légèrement plus grand */
    height: 55px;
    border-radius: 50%;
    border: 3px solid #2E8B57; /* Bordure verte Kinema+ */
    object-fit: cover;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.1); /* Effet d'anneau subtil */
}

.balance-display {
    font-size: 1.6rem; /* Légèrement plus grand */
    font-weight: bold;
    color: #3BCC7A; /* Vert Kinema+ pour la balance */
}

/* --- Contenu Principal --- */
.main-content {
    padding: 30px;
}

/* --- Catégories --- */
.categories {
    display: grid;
    gap: 40px; /* Plus d'espace entre les catégories */
}

.category {
    margin-bottom: 30px; /* Conserver l'espace bas */
}

.category-title {
    font-size: 2em; /* Plus grand */
    color: #FFFFFF; /* Blanc pur */
    margin-bottom: 25px; /* Plus d'espace */
    padding-bottom: 10px;
    border-bottom: 3px solid #2E8B57; /* Vert Kinema+ pour le soulignement */
    font-weight: 700;
    letter-spacing: -0.2px;
}

/* --- Grille des produits --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px; /* Plus d'espace entre les cartes */
}

/* --- Cartes produits --- */
.product-card {
    background: #1A1A1A; /* Fond sombre pour les cartes */
    border-radius: 15px;
    padding: 25px; /* Plus de padding */
    box-shadow: 0 8px 25px rgba(0,0,0,0.5); /* Ombre plus prononcée */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
    border: 1px solid #282828; /* Bordure subtile */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Pour pousser le bouton en bas */
}

.product-card:hover {
    transform: translateY(-8px); /* Effet de soulèvement plus marqué */
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
    border-color: #2E8B57; /* Bordure verte au survol */
}

/* --- Images produits (modernes) --- */
.product-image {
    width: 90px; /* Plus grandes */
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px; /* Plus d'espace */
    display: block;
    border: 4px solid #3BCC7A; /* Bordure verte Kinema+ plus prononcée */
    box-shadow: 0 0 0 3px rgba(255,255,255,0.05), 0 5px 15px rgba(0,0,0,0.4); /* Ombre et halo subtil */
}

/* --- Informations produit --- */
.product-name {
    font-size: 1.35rem; /* Plus grand */
    font-weight: bold;
    color: #FFFFFF; /* Blanc pur */
    margin-bottom: 8px;
    text-align: center;
    letter-spacing: -0.1px;
}

.product-tagline {
    font-style: italic;
    color: #A0A0A0; /* Gris doux */
    font-size: 0.95rem; /* Légèrement plus grand */
    margin-bottom: 12px;
    text-align: center;
}

.product-description {
    color: #B0B0B0; /* Gris clair */
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 18px; /* Plus d'espace */
    flex-grow: 1; /* Permet à la description de prendre l'espace */
}

.product-price {
    font-size: 1.6rem; /* Plus grand et proéminent */
    font-weight: bold;
    color: #3BCC7A; /* Vert Kinema+ pour le prix */
    text-align: center;
    margin-bottom: 20px; /* Plus d'espace */
}

/* --- Contrôles de quantité --- */
.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px; /* Plus d'espace */
    margin-bottom: 20px;
}

.quantity-btn {
    width: 40px; /* Plus grand */
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #2E8B57; /* Vert Kinema+ */
    color: white;
    font-size: 1.4rem; /* Plus grand */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.quantity-btn:hover {
    background: #246B44; /* Vert plus foncé */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.quantity-btn:disabled {
    background: #444444; /* Gris sombre désactivé */
    color: #888888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.quantity-display {
    font-size: 1.3rem; /* Plus grand */
    font-weight: bold;
    min-width: 40px; /* Assure un minimum de largeur */
    text-align: center;
    color: #E0E0E0; /* Blanc cassé */
}

/* --- Bouton d'achat --- */
.buy-btn {
    width: 100%;
    padding: 15px; /* Plus de padding */
    background: linear-gradient(135deg, #2E8B57 0%, #3BCC7A 100%); /* Dégradé de vert Kinema+ */
    color: white;
    border: none;
    border-radius: 10px; /* Plus arrondi */
    font-size: 1.1rem; /* Plus grand */
    font-weight: 700; /* Plus gras */
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4); /* Ombre plus forte */
}

.buy-btn:hover {
    transform: translateY(-3px); /* Effet de soulèvement */
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.buy-btn:disabled {
    background: linear-gradient(135deg, #444444 0%, #555555 100%); /* Dégradé gris désactivé */
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Messages (Success/Error) --- */
.message {
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: bold;
    text-align: center;
    opacity: 0; /* Caché par défaut */
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.message.show {
    opacity: 1;
    visibility: visible;
}

.message.success {
    background: rgba(46, 139, 87, 0.2); /* Vert Kinema+ translucide */
    color: #3BCC7A;
    border: 1px solid #2E8B57;
}

.message.error {
    background: rgba(204, 59, 59, 0.2); /* Rouge translucide */
    color: #FF6B6B;
    border: 1px solid #CC3B3B;
}

.hidden {
    display: none; /* Toujours utile pour JS si show n'est pas utilisé */
}

/* --- Bouton retour (ajusté pour le thème) --- */
.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 12px 22px; /* Plus grand */
    background: rgba(255,255,255,0.08); /* Fond translucide */
    color: #E0E0E0; /* Blanc cassé */
    text-decoration: none;
    border-radius: 30px; /* Très arrondi */
    box-shadow: 0 5px 15px rgba(0,0,0,0.4); /* Ombre sombre */
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    z-index: 1000;
    border: 1px solid rgba(255,255,255,0.1); /* Bordure subtile */
    font-weight: 600;
}

.back-btn:hover {
    transform: translateY(-3px); /* Effet de soulèvement */
    background: rgba(255,255,255,0.15); /* Plus opaque au survol */
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

/* --- Navigation Inférieure Flottante (Bottom Navigation) (Cohérence) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    /* Dégradé doux pour la barre de navigation */
    background: linear-gradient(to top, #1A1A1A 0%, #111111 100%);
    display: flex;
    justify-content: space-around;
    padding: 12px 0; /* Padding ajusté */
    z-index: 999;
    /* Ombre subtile vers le haut */
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
    border-top-left-radius: 20px; /* Rayon plus prononcé */
    border-top-right-radius: 20px; /* Rayon plus prononcé */
    overflow: hidden; /* Pour contenir les effets internes */
}

.bottom-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #2E8B57, transparent); /* Fine ligne lumineuse en haut */
    opacity: 0.3;
}

.bottom-nav .nav-item {
    color: #A0A0A0; /* Couleur par défaut des icônes/texte inactifs */
    text-align: center;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    padding: 8px 0; /* Padding ajusté */
    border-radius: 10px; /* Rayon de bordure plus rond */
    transition: all 0.3s ease-in-out; /* Transition globale */
    flex-grow: 1;
    max-width: 90px; /* Pour éviter que les éléments soient trop larges sur grand écran */
    position: relative;
}

.bottom-nav .nav-item img {
    filter: invert(70%); /* Icônes grisées par défaut */
    width: 26px; /* Icônes légèrement plus grandes */
    height: 26px;
    margin-bottom: 4px; /* Espacement ajusté */
    transition: filter 0.3s ease-in-out;
}

.bottom-nav .nav-item span {
    font-size: 0.8em; /* Texte légèrement plus petit */
    font-weight: 600; /* Plus gras */
    text-transform: uppercase; /* Texte en majuscules pour un look moderne */
    letter-spacing: 0.5px; /* Espacement des lettres */
}

.bottom-nav .nav-item:hover {
    background-color: #222222; /* Fond plus sombre au survol */
    color: #FFFFFF; /* Texte blanc au survol */
}

.bottom-nav .nav-item:hover img {
    filter: invert(100%); /* Icônes blanches au survol */
}

.bottom-nav .nav-item.active {
    background: linear-gradient(135deg, #2E8B57 0%, #1F6A44 100%); /* Dégradé vert pour l'actif */
    color: #FFFFFF; /* Texte blanc pour l'actif */
    box-shadow: 0 0 15px rgba(46, 139, 87, 0.6); /* Lueur autour de l'élément actif */
    transform: translateY(-2px); /* Léger soulèvement */
}

.bottom-nav .nav-item.active img {
    filter: invert(100%); /* Icônes blanches pour l'actif */
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .container {
        border-radius: 15px;
    }
    
    .products-grid {
        grid-template-columns: 1fr; /* Une colonne pour les petits écrans */
        gap: 20px;
    }
    
    .header {
        padding: 25px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .category-title {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
    
    .back-btn {
        position: static; /* Ne plus fixer le bouton, le rendre statique */
        display: block; /* Prend toute la largeur */
        width: fit-content; /* S'adapte à son contenu */
        margin: 0 auto 20px auto; /* Centre et ajoute un espacement */
        padding: 10px 18px;
        font-size: 0.95rem;
        border-radius: 25px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .header {
        padding: 20px;
    }
    .header h1 {
        font-size: 1.8rem;
    }
    .user-photo {
        width: 45px;
        height: 45px;
        border-width: 2px;
    }
    .balance-display {
        font-size: 1.4rem;
    }
    .product-card {
        padding: 18px;
        border-radius: 12px;
    }
    .product-image {
        width: 70px;
        height: 70px;
        margin-bottom: 15px;
        border-width: 3px;
    }
    .product-name {
        font-size: 1.2rem;
    }
    .product-tagline {
        font-size: 0.85rem;
    }
    .product-description {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    .product-price {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }
    .quantity-btn {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
    .quantity-display {
        font-size: 1.1rem;
    }
    .buy-btn {
        padding: 12px;
        font-size: 1rem;
        border-radius: 8px;
    }
    .message {
        padding: 12px;
        font-size: 0.9rem;
    }
    .category-title {
        font-size: 1.6rem;
    }
}
