/* /administration : personnalisation de la boutique, commandes et statistiques. Tailles en pixels entiers. */

/* ---------- Personnaliser la boutique ---------- */

.customize-head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px 0;
    background: var(--bs-body-bg, #fff);
}

.customize-tabs {
    margin-bottom: 20px;
}

    .customize-tabs .nav-link {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

.customize-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 460px;
    gap: 28px;
    align-items: start;
}

.customize-card {
    background: #fff;
    border: 1px solid #e7e5ee;
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(20, 17, 31, .04);
}

    .customize-card h2 {
        font-size: 16px;
        font-weight: 700;
        margin-bottom: 14px;
    }

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.preset {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 2px solid #ece9f3;
    border-radius: 12px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    transition: border-color .15s, transform .15s;
}

    .preset:hover {
        transform: translateY(-2px);
    }

    .preset.active {
        border-color: #6d28d9;
    }

.preset-swatch {
    height: 44px;
    border-radius: 8px;
}

.color-field {
    display: flex;
    gap: 8px;
}

    .color-field input[type=color] {
        width: 48px;
        height: 38px;
        padding: 2px;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        background: #fff;
        flex: none;
    }

.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice {
    padding: 8px 14px;
    border: 1.5px solid #e2dfeb;
    border-radius: 999px;
    background: #fff;
    font-weight: 600;
    font-size: 14px;
}

    .choice.active {
        border-color: #6d28d9;
        background: #f3effe;
        color: #4c1d95;
    }

    .choice.corner-sharp { border-radius: 3px; }
    .choice.corner-rounded { border-radius: 10px; }
    .choice.corner-soft { border-radius: 999px; }

.image-slot {
    height: 140px;
    border: 1.5px dashed #d9d5e5;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #faf9fd;
    padding: 8px;
    text-align: center;
}

    .image-slot img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        border-radius: 8px;
    }

.category-picks {
    max-height: 320px;
    overflow: auto;
    display: grid;
    gap: 4px;
}

.featured-list {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
    display: grid;
    gap: 6px;
    counter-reset: featured;
}

    .featured-list li {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 8px;
        border: 1px solid #ece9f3;
        border-radius: 10px;
        background: #faf9fd;
        counter-increment: featured;
    }

        .featured-list li::before {
            content: counter(featured);
            width: 22px;
            height: 22px;
            border-radius: 50%;
            background: #6d28d9;
            color: #fff;
            font-size: 12px;
            font-weight: 700;
            display: grid;
            place-items: center;
            flex: none;
        }

.customize-card .code,
.orders-page .code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 600;
}

.search-field {
    position: relative;
}

    .search-field svg {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #8a87a0;
    }

    .search-field input {
        padding-left: 36px;
    }

.item-results {
    margin-top: 6px;
    border: 1px solid #ece9f3;
    border-radius: 10px;
    overflow: hidden;
}

.item-result {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid #f1eff6;
    background: #fff;
    text-align: left;
}

    .item-result:hover {
        background: #f6f3fe;
    }

.tax-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.tax-rate {
    width: 150px;
    flex: none;
}

.social-label {
    width: 110px;
}

/* Aperçu en direct : la vraie boutique (mêmes classes .shop, .hero...) réduite. */

.customize-preview {
    position: sticky;
    top: 96px;
}

.preview-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 8px;
}

.preview-frame {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e7e5ee;
    box-shadow: 0 24px 50px -24px rgba(20, 17, 31, .35);
}

.shop.shop-preview {
    min-height: 0;
    zoom: .5;
    pointer-events: none;
}

    .shop-preview .preview-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 24px;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
    }

    .shop-preview .preview-logo {
        height: 40px;
        max-width: 160px;
        object-fit: contain;
    }

    .shop-preview .preview-cart {
        padding: 8px 16px;
        border-radius: 999px;
        background: var(--ink);
        color: var(--bg);
        font-weight: 600;
    }

    .shop-preview .hero {
        margin: 20px;
    }

    .shop-preview .preview-products {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        padding: 0 20px 24px;
    }

    .shop-preview .preview-product {
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: 12px;
        display: grid;
        gap: 8px;
    }

    .shop-preview .preview-photo {
        aspect-ratio: 4 / 3;
        border-radius: var(--radius-sm);
        background: var(--surface-2);
        display: grid;
        place-items: center;
        overflow: hidden;
        font-family: ui-monospace, monospace;
        font-weight: 700;
        color: var(--brand);
    }

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

    .shop-preview .preview-name {
        font-weight: 600;
        font-size: 15px;
    }

@media (max-width: 1200px) {
    .customize-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .customize-preview {
        position: static;
        order: -1;
    }
}

/* ---------- Commandes ---------- */

.orders-search {
    width: min(420px, 100%);
}

.order-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.order-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid #e7e5ee;
    border-radius: 999px;
    background: #fff;
    font-weight: 600;
    font-size: 14px;
    color: #4b4860;
}

    .order-tab.active {
        background: #1c1830;
        border-color: #1c1830;
        color: #fff;
    }

.order-tab-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .07);
    font-size: 12px;
    text-align: center;
}

    .order-tab.active .order-tab-count {
        background: rgba(255, 255, 255, .18);
    }

    .order-tab-count.is-hot {
        background: #ec4899;
        color: #fff;
    }

.orders-table {
    background: #fff;
    border: 1px solid #e7e5ee;
    border-radius: 14px;
    overflow: auto;
}

    .orders-table th {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: #6b6880;
        font-weight: 700;
        background: #faf9fd;
    }

.order-row {
    cursor: pointer;
}

    .order-row:hover td {
        background: #f8f6fd;
    }

    .order-row.flash td {
        animation: order-flash 2.4s ease;
    }

@keyframes order-flash {
    0%, 30% { background: #fdf2f8; }
    100% { background: transparent; }
}

.order-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
    background: #eef2ff;
    color: #3730a3;
}

    .order-status.status-new { background: #fce7f3; color: #9d174d; }
    .order-status.status-confirmed { background: #ede9fe; color: #5b21b6; }
    .order-status.status-preparing { background: #fef3c7; color: #92400e; }
    .order-status.status-shipped,
    .order-status.status-readyforpickup { background: #e0f2fe; color: #075985; }
    .order-status.status-completed { background: #dcfce7; color: #166534; }
    .order-status.status-cancelled { background: #f1f5f9; color: #64748b; }

h1 .order-status {
    font-size: 14px;
}

.orders-empty {
    text-align: center;
    padding: 56px 16px;
    border: 1.5px dashed #e2dfeb;
    border-radius: 16px;
    color: #6b6880;
}

    .orders-empty svg {
        color: #a78bfa;
        margin-bottom: 8px;
    }

.crumbs-admin {
    font-size: 14px;
    color: #6b6880;
    margin-bottom: 8px;
}

.order-detail-head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 18px;
}

.order-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    align-items: start;
}

.step-confirm {
    border: 1px solid #ddd6fe;
    background: #f5f3ff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 18px;
    max-width: 640px;
}

.component-list {
    list-style: none;
    padding: 6px 0 0 12px;
    margin: 6px 0 0;
    border-left: 2px solid #ede9fe;
    font-size: 13px;
    color: #4b4860;
}

.order-totals {
    margin: 12px 0 0 auto;
    max-width: 320px;
    display: grid;
    gap: 4px;
}

    .order-totals > div {
        display: flex;
        justify-content: space-between;
        color: #4b4860;
    }

    .order-totals .grand {
        border-top: 1px solid #e7e5ee;
        padding-top: 8px;
        margin-top: 4px;
        font-weight: 800;
        font-size: 18px;
        color: #14111f;
    }

.pick-check {
    width: 28px;
}

.pick-box {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1.5px solid #9ca3af;
    border-radius: 4px;
    vertical-align: middle;
}

.customer-note {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 10px 12px;
}

.order-timeline {
    list-style: none;
    padding: 0 0 0 14px;
    margin: 0;
    border-left: 2px solid #ede9fe;
    display: grid;
    gap: 12px;
}

    .order-timeline li {
        position: relative;
    }

        .order-timeline li::before {
            content: "";
            position: absolute;
            left: -20px;
            top: 6px;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: #8b5cf6;
            box-shadow: 0 0 0 3px #fff;
        }

/* Pastille du menu et notification d'une nouvelle commande */

.nav-badge {
    margin-left: auto;
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #ec4899;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    animation: badge-pop .4s ease;
}

@keyframes badge-pop {
    0% { transform: scale(.4); }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.order-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(420px, calc(100vw - 32px));
    padding: 14px 16px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(120deg, #6d28d9, #ec4899);
    box-shadow: 0 24px 48px -16px rgba(109, 40, 217, .6);
    animation: toast-in .45s cubic-bezier(.2, .9, .3, 1.3);
}

.order-toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .2);
    display: grid;
    place-items: center;
    flex: none;
}

@keyframes toast-in {
    from { transform: translateY(30px) scale(.95); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media (max-width: 1100px) {
    .order-detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media print {
    .sidebar, .top-row, .order-toast, .d-print-none {
        display: none !important;
    }

    .customize-card {
        box-shadow: none;
        break-inside: avoid;
    }

    .order-detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Statistiques ---------- */

.stats-head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #065f46;
    font-weight: 600;
    font-size: 13px;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, .6);
    animation: live-pulse 1.8s infinite;
}

@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.period-chips {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: #f1eff6;
}

    .period-chips button {
        border: 0;
        background: none;
        padding: 6px 14px;
        border-radius: 999px;
        font-weight: 600;
        font-size: 14px;
        color: #4b4860;
    }

        .period-chips button.active {
            background: #fff;
            color: #14111f;
            box-shadow: 0 1px 4px rgba(20, 17, 31, .12);
        }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.kpi {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e7e5ee;
    border-radius: 16px;
    padding: 16px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: kpi-in .5s ease both;
}

    .kpi:nth-child(2) { animation-delay: .05s; }
    .kpi:nth-child(3) { animation-delay: .1s; }
    .kpi:nth-child(4) { animation-delay: .15s; }
    .kpi:nth-child(5) { animation-delay: .2s; }
    .kpi:nth-child(6) { animation-delay: .25s; }

@keyframes kpi-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.kpi strong {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.kpi-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b6880;
}

.kpi-sub {
    font-size: 12px;
    color: #6b6880;
}

.kpi-hero {
    color: #fff;
    border: 0;
    background: linear-gradient(130deg, #4c1d95, #7c3aed 55%, #ec4899);
    box-shadow: 0 18px 40px -18px rgba(124, 58, 237, .7);
}

    .kpi-hero .kpi-label {
        color: rgba(255, 255, 255, .8);
    }

.kpi-delta {
    font-size: 13px;
    font-weight: 700;
}

    .kpi-delta.up { color: #059669; }
    .kpi-delta.down { color: #dc2626; }
    .kpi-delta.flat { color: #9ca3af; }

.kpi-hero .kpi-delta {
    color: #fff;
    opacity: .9;
}

.kpi-spark {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 34px;
    opacity: .35;
}

    .kpi-spark path {
        fill: none;
        stroke: #8b5cf6;
        stroke-width: 2;
        vector-effect: non-scaling-stroke;
    }

.kpi-hero .kpi-spark path {
    stroke: #fff;
}

.stats-card {
    background: #fff;
    border: 1px solid #e7e5ee;
    border-radius: 16px;
    padding: 20px 22px;
    margin-bottom: 18px;
}

    .stats-card h2 {
        font-size: 16px;
        font-weight: 700;
        margin-bottom: 14px;
    }

.stats-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.legend {
    font-size: 13px;
    color: #6b6880;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sw {
    display: inline-block;
    width: 14px;
    height: 10px;
    border-radius: 3px;
    margin-left: 10px;
}

.sw-bar { background: linear-gradient(#8b5cf6, #ec4899); }
.sw-line { background: #06b6d4; height: 3px; }

.day-chart {
    width: 100%;
    height: 260px;
    overflow: visible;
}

    .day-chart .grid {
        stroke: #f0eef5;
        stroke-width: 1;
        vector-effect: non-scaling-stroke;
    }

    .day-chart rect {
        transition: opacity .15s;
    }

        .day-chart rect:hover {
            opacity: .75;
        }

    .day-chart .visits-line {
        fill: none;
        stroke: #06b6d4;
        stroke-width: 2.5;
        stroke-linejoin: round;
        vector-effect: non-scaling-stroke;
    }

    .day-chart .axis {
        font-size: 12px;
        fill: #8a87a0;
    }

.chart-scale {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #8a87a0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

    .stats-grid.three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats-grid > .stats-card {
        margin-bottom: 18px;
    }

.funnel {
    display: grid;
    gap: 12px;
}

.funnel-label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 4px;
}

.funnel-track {
    height: 12px;
    border-radius: 999px;
    background: #f3f1f8;
    overflow: hidden;
}

    .funnel-track span {
        display: block;
        height: 100%;
        border-radius: 999px;
        background: linear-gradient(90deg, #7c3aed, #ec4899);
        transform-origin: left;
        animation: grow .8s cubic-bezier(.2, .8, .2, 1) both;
        animation-delay: calc(var(--i) * 90ms);
    }

@keyframes grow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.funnel-rate {
    font-size: 12px;
    color: #8a87a0;
    margin-top: 2px;
}

.funnel-foot {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #f0eef5;
    text-align: center;
}

    .funnel-foot strong {
        display: block;
        font-size: 20px;
        font-weight: 800;
    }

    .funnel-foot span {
        font-size: 12px;
        color: #6b6880;
    }

.heatmap {
    display: grid;
    grid-template-columns: 36px repeat(24, minmax(0, 1fr));
    gap: 3px;
    align-items: center;
}

.hm-hour {
    font-size: 11px;
    color: #8a87a0;
}

.hm-day {
    font-size: 12px;
    color: #6b6880;
    text-transform: capitalize;
}

.hm-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: #f3f1f8;
    position: relative;
    overflow: hidden;
}

    .hm-cell::after {
        content: "";
        position: absolute;
        inset: 0;
        background: #7c3aed;
        opacity: var(--a);
    }

.product-stats .code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
}

.mini-bar {
    height: 8px;
    border-radius: 999px;
    background: #f3f1f8;
    overflow: hidden;
}

    .mini-bar span {
        display: block;
        height: 100%;
        border-radius: 999px;
        background: linear-gradient(90deg, #7c3aed, #ec4899);
    }

.share-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

    .share-list li {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 10px;
        border-radius: 8px;
        font-size: 14px;
        position: relative;
        z-index: 0;
    }

    .share-list li.share-bar::before {
        content: "";
        position: absolute;
        inset: 0;
        width: var(--w);
        border-radius: 8px;
        background: #f3effe;
        z-index: -1;
    }

@media (max-width: 1100px) {
    .stats-grid,
    .stats-grid.three {
        grid-template-columns: minmax(0, 1fr);
    }
}
