/* ==========================================================================
   BAR À CHARMS ORÉZYA
   ========================================================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #faf8f5;
    color: #292522;
    font-family: Arial, sans-serif;
}

.bar-charms {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 16px 50px;
}


/* ==========================================================================
   EN-TÊTE
   ========================================================================== */

.bar-charms-header {
    text-align: center;
    margin-bottom: 25px;
}

.bar-charms-header h1 {
    margin: 0;
    font-family: Georgia, serif;
    font-size: 26px;
    font-weight: 500;
    letter-spacing: 1px;
}

.bar-charms-header p {
    margin: 8px 0 0;
    font-size: 15px;
    color: #777;
}


/* ==========================================================================
   ÉTAPES
   ========================================================================== */

.bar-charms-steps {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    margin-bottom: 25px;

    scrollbar-width: none;
}

.bar-charms-steps::-webkit-scrollbar {
    display: none;
}

.bar-step {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 5px;

    padding: 9px 12px;

    border: 1px solid #e5dfd8;
    border-radius: 30px;

    background: #fff;

    font-size: 12px;
    color: #777;
}

.bar-step span {
    font-size: 14px;
}

.bar-step.active {
    border-color: #c7a66a;
    color: #80652f;
    background: #fffdf9;
}


/* ==========================================================================
   CONSTRUCTION
   ========================================================================== */

.bar-charms-builder {
    display: flex;
    flex-direction: column;
    gap: 25px;
}


/* ==========================================================================
   APERÇU DE LA CRÉATION
   ========================================================================== */

.bar-charms-preview {
    width: 100%;
}

.bar-charms-preview-card {
    position: sticky;
    top: 15px;

    background: #fff;
    border: 1px solid #ebe5df;
    border-radius: 20px;

    padding: 20px;

    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.04);
}

.bar-charms-preview-card h2 {
    margin: 0 0 15px;

    font-family: Georgia, serif;
    font-size: 20px;
    font-weight: 500;

    text-align: center;
}

.bar-charms-preview-zone {
    min-height: 190px;

    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;

    border-radius: 15px;
    background: #faf8f5;

    overflow: hidden;
}

.bar-creation {
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 12px;
}

.bar-creation-base {
    display: block;

    width: 100%;
    max-width: 500px;
    max-height: 180px;

    object-fit: contain;
}

.bar-creation-charms {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 8px;
}

.bar-selected-charm img {
    display: block;
    width: 180%;
    height: 180%;
    margin: -40%;
    object-fit: contain;
}

.bar-remove-charm {
    position: absolute;

    top: -6px;
    right: -6px;

    width: 22px;
    height: 22px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: #292522;
    color: #fff;

    font-size: 16px;
    line-height: 1;

    cursor: pointer;
    z-index: 5;
}

.bar-selected-charm img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
}

.bar-charms-empty {
    margin: 0;
    padding: 20px;

    color: #888;
    text-align: center;
    font-size: 14px;
}

.bar-charms-total {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-top: 18px;
    padding-top: 15px;

    border-top: 1px solid #eee7e0;
}

.bar-charms-total span {
    font-size: 14px;
    color: #777;
}

.bar-charms-total strong {
    font-size: 21px;
    font-weight: 600;
}


/* ==========================================================================
   SECTIONS
   ========================================================================== */

.bar-charms-selection {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.bar-section {
    background: #fff;

    border: 1px solid #ebe5df;
    border-radius: 20px;

    padding: 18px;
}

.bar-section h2 {
    margin: 0 0 16px;

    font-family: Georgia, serif;
    font-size: 19px;
    font-weight: 500;
}


/* ==========================================================================
   BASES
   ========================================================================== */

.bar-charms-bases {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.bar-base-card {
    width: 100%;

    padding: 10px;

    border: 1px solid #e7e0d8;
    border-radius: 15px;

    background: #fff;

    cursor: pointer;

    text-align: center;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.bar-base-card:hover {
    transform: translateY(-2px);
}

.bar-base-card.selected {
    border-color: #b99550;

    box-shadow:
        0 0 0 2px rgba(185, 149, 80, 0.12);
}

.bar-base-card img {
    display: block;

    width: 100%;
    aspect-ratio: 1 / 1;

    object-fit: contain;

    border-radius: 10px;
}

.bar-base-name {
    display: block;

    margin-top: 8px;

    font-size: 13px;
    font-weight: 500;
}

.bar-base-price {
    display: block;

    margin-top: 4px;

    font-size: 13px;
    color: #80652f;
}


/* ==========================================================================
   RECHERCHE
   ========================================================================== */

.bar-charms-search {
    margin-bottom: 14px;
}

.bar-charms-search input {
    width: 100%;

    padding: 13px 15px;

    border: 1px solid #ddd5cd;
    border-radius: 30px;

    background: #faf8f5;

    font-size: 14px;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.bar-charms-search input:focus {
    border-color: #c5a05d;

    box-shadow:
        0 0 0 3px rgba(197, 160, 93, 0.12);
}


/* ==========================================================================
   CATÉGORIES
   ========================================================================== */

.bar-charms-categories {
    display: flex;
    gap: 8px;

    overflow-x: auto;

    padding-bottom: 7px;
    margin-bottom: 18px;

    scrollbar-width: none;
}

.bar-charms-categories::-webkit-scrollbar {
    display: none;
}

.bar-category-button {
    flex: 0 0 auto;

    padding: 8px 13px;

    border: 1px solid #e3ddd6;
    border-radius: 25px;

    background: #fff;

    color: #666;

    font-size: 12px;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

.bar-category-button.active {
    background: #292522;
    color: #fff;
    border-color: #292522;
}

.bar-charms-categories {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}


/* ==========================================================================
   GRILLE DES CHARMS
   ========================================================================== */

.bar-charms-list {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 12px;
}

.bar-charm-card {
    position: relative;

    border: 1px solid #e8e1da;
    border-radius: 16px;

    background: #fff;

    overflow: hidden;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.bar-charm-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 7px 20px rgba(0, 0, 0, 0.07);
}

.bar-charm-image {
    position: relative;

    width: 100%;
    aspect-ratio: 1 / 1;

    background: #faf8f5;

    overflow: hidden;
}

.bar-charm-image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    transition: transform 0.3s ease;
}

.bar-charm-card:hover .bar-charm-image img {
    transform: scale(1.03);
}

.bar-charm-info {
    padding: 10px 11px 12px;
}

.bar-charm-name {
    display: block;

    font-size: 13px;
    line-height: 1.3;

    font-weight: 500;
}

.bar-charm-price {
    display: block;

    margin-top: 5px;

    color: #80652f;

    font-size: 13px;
    font-weight: 600;
}


/* ==========================================================================
   INFORMATIONS AU TOUCHER / SURVOL
   ========================================================================== */

.bar-charm-details {
    position: absolute;

    inset: 0;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;

    padding: 14px;

    background: rgba(255, 255, 255, 0.94);

    opacity: 0;

    visibility: hidden;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

.bar-charm-card.show-details .bar-charm-details {
    opacity: 1;
    visibility: visible;
}

.bar-charm-details p {
    margin: 3px 0;

    font-size: 12px;
    color: #555;
}

.bar-charm-details strong {
    color: #292522;
}


/* ==========================================================================
   BOUTON AJOUT
   ========================================================================== */

.bar-charm-add {
    width: 100%;

    margin-top: 10px;

    padding: 11px 10px;

    border: 0;
    border-radius: 25px;

    background: #292522;
    color: #fff;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}

.bar-charm-add:active {
    transform: scale(0.97);
}


/* ==========================================================================
   VOIR PLUS
   ========================================================================== */

.bar-charms-load-more {
    display: block;

    width: 100%;

    margin-top: 18px;

    padding: 13px;

    border: 1px solid #292522;
    border-radius: 30px;

    background: #fff;

    color: #292522;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
}

.bar-charms-load-more:hover {
    background: #292522;
    color: #fff;
}


/* ==========================================================================
   PANIER
   ========================================================================== */

.bar-charms-cart-section {
    position: sticky;

    bottom: 0;

    z-index: 10;

    padding-top: 5px;
}

.bar-charms-add-cart {
    width: 100%;

    padding: 15px 18px;

    border: 0;
    border-radius: 30px;

    background: #292522;
    color: #fff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    box-shadow:
        0 5px 20px rgba(0, 0, 0, 0.15);
}

.bar-charms-add-cart:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


/* ==========================================================================
   ABSENCE DE DONNÉES
   ========================================================================== */

.bar-charms-no-data {
    grid-column: 1 / -1;

    margin: 0;
    padding: 25px 10px;

    text-align: center;

    color: #888;

    font-size: 14px;
}


/* ==========================================================================
   TABLETTE
   ========================================================================== */

@media (min-width: 600px) {

    .bar-charms {
        padding-left: 25px;
        padding-right: 25px;
    }

    .bar-charms-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .bar-charms-bases {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

}


/* ==========================================================================
   ORDINATEUR
   ========================================================================== */

@media (min-width: 900px) {

    .bar-charms {
        padding-top: 40px;
    }

    .bar-charms-header h1 {
        font-size: 32px;
    }

    /* Ta création : toute la largeur en haut */
    .bar-charms-builder {
        display: block;
    }

    .bar-charms-preview {
        width: 100%;
    }

    .bar-charms-preview-card {
        position: static;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 30px;
    }

    /* Choix : base à gauche / charms à droite */
    .bar-charms-selection {
        display: grid;
        grid-template-columns: 2fr 3fr;
        align-items: start;
        gap: 30px;
    }

    .bar-charms-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .bar-charms-bases {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .bar-charms-cart-section {
        position: static;
        grid-column: 1 / -1;
    }

    /* Flèches uniquement sur ordinateur */
    .bar-charms-category-arrow {
        display: flex;
    }
}

/* ==========================================================
   MENU MOBILE + PANIER — BAR À CHARMS
   ========================================================== */

@media (max-width: 899px) {

    .menu-mobile {
        position: absolute;
        top: 15px;
        left: 15px;

        width: 44px;
        height: 44px;

        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;

        padding: 0;
        border: 1px solid #b99a52;
        border-radius: 4px;
        background: transparent;

        z-index: 1000;
    }

    .menu-mobile span {
        display: block;
        width: 24px;
        height: 2px;
        background: #292522;
        border-radius: 2px;
    }

}

/* Icône sac panier — Bar à Charms */
@media (max-width: 899px) {

    .panier-mobile .icone-sac {
        display: block !important;
        width: 22px !important;
        height: 22px !important;
        border: 2px solid #292522 !important;
        border-radius: 3px !important;
        background: transparent !important;
        position: relative !important;
        box-sizing: border-box !important;
    }

    .panier-mobile .icone-sac::before {
        content: "" !important;
        display: block !important;
        position: absolute !important;

        width: 9px !important;
        height: 6px !important;

        left: 4.5px !important;
        top: -7px !important;

        border: 2px solid #292522 !important;
        border-bottom: 0 !important;
        border-radius: 6px 6px 0 0 !important;

        box-sizing: border-box !important;
    }

}

/* ==========================================================
   BAR À CHARMS — 7 CASES HORIZONTALES
   ========================================================== */

.bar-slot-grid {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
    border: 1px dashed #b99a52;
    border-radius: 6px;
    overflow: hidden;
    background: #fffdf8;
    box-sizing: border-box;
}

.bar-slot {
    position: relative !important;

    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    height: 95px !important;
    min-height: 95px !important;

    margin: 0 !important;
    padding: 22px 4px 5px !important;

    border: 0 !important;
    border-right: 1px dashed #b99a52 !important;

    background: transparent;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    box-sizing: border-box;
    cursor: pointer;
}

.bar-slot:last-child {
    border-right: 0 !important;
}

.bar-slot-number {
    position: absolute !important;
    top: 4px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;

    font-size: 12px !important;
    font-weight: 600 !important;
    color: #292522 !important;

    pointer-events: none;
}

.bar-slot.is-empty {
    color: #aaa;
}

.bar-slot.is-active {
    background: #faf4e5 !important;
    box-shadow: inset 0 0 0 2px #b99a52 !important;
}

.bar-slot img {
    display: block !important;

    width: auto !important;
    height: auto !important;

    max-width: 100px !important;
    max-height: 100px !important;

    object-fit: contain !important;

    margin: 0 auto !important;

    pointer-events: none;
}

.bar-slot-remove {
    position: absolute !important;

    top: 20px !important;
    right: 2px !important;

    width: 17px !important;
    height: 17px !important;

    padding: 0 !important;

    border: 1px solid #b99a52 !important;
    border-radius: 50% !important;

    background: #fff !important;
    color: #292522 !important;

    font-size: 10px !important;
    line-height: 15px !important;
    text-align: center !important;

    cursor: pointer;
}


/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 899px) {

    .bar-slot {
        height: 70px !important;
        min-height: 70px !important;
        padding: 19px 2px 4px !important;
    }

    .bar-slot-number {
        top: 3px !important;
        font-size: 10px !important;
    }

    .bar-slot img {
        max-width: 30px !important;
        max-height: 30px !important;
    }

    .bar-slot-remove {
        top: 18px !important;
        right: 1px !important;
        width: 15px !important;
        height: 15px !important;
        font-size: 9px !important;
        line-height: 13px !important;
    }
}

/* ===== CHARMS PLUS GRANDS SUR TÉLÉPHONE ===== */
@media (max-width: 768px) {
    .bar-selected-charm img {
        width: 180%;
        height: 180%;
        margin: -40%;
    }
}

/* Flèche de défilement des catégories */

.bar-charms-categories-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.bar-charms-categories-wrapper .bar-charms-categories {
    flex: 1;
    min-width: 0;
}

.bar-charms-category-arrow {
    flex: 0 0 auto;

    width: 32px;
    height: 32px;

    border: 1px solid #e3ddd6;
    border-radius: 50%;

    background: #fff;
    color: #777;

    font-size: 24px;
    line-height: 25px;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
}

.bar-charms-category-arrow:hover {
    background: #f8f5f1;
}

/* Flèches catégories uniquement sur ordinateur */
.bar-charms-category-arrow {
    display: none;
}

@media (min-width: 900px) {
    .bar-charms-category-arrow {
        display: flex;
    }
}

/* ===== TAILLE DES CHARMS SUR TÉLÉPHONE ===== */
@media (max-width: 768px) {

    .bar-selected-charm {
        width: 45px;
        height: 45px;
    }

    .bar-selected-charm img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .bar-slot img {
        width: 45px !important;
        height: 45px !important;
        max-width: 45px !important;
        max-height: 45px !important;
        object-fit: contain !important;
        transform: none !important;
    }

}

