/* EZD Solutions : thème clair, contrasté, ombres légères (complète Bootstrap 5.3). */

:root {
    --ezd-bg: #f1f4f9;
    --ezd-ink: #0f172a;
    --ezd-muted: #526072;
    --ezd-line: #e3e8f0;
    --ezd-navbar: #0b1324;
    --ezd-primary: #0b5ed7;
    --ezd-primary-dark: #0a4fb5;
    --ezd-radius: 14px;
    --ezd-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .06);
    --ezd-shadow-lg: 0 18px 50px rgba(15, 23, 42, .22);
    --bs-body-color: var(--ezd-ink);
    --bs-secondary-color: var(--ezd-muted);
    --bs-link-color: var(--ezd-primary);
    --bs-link-color-rgb: 11, 94, 215;
}

body.app-body {
    background: var(--ezd-bg);
    color: var(--ezd-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-body > main {
    flex: 1 0 auto;
}

.text-secondary {
    color: var(--ezd-muted) !important;
}

.text-pre-line {
    white-space: pre-line;
}

/* ---------- Navigation ---------- */
.app-navbar {
    background: var(--ezd-navbar);
    box-shadow: 0 2px 12px rgba(2, 6, 23, .25);
}

.app-navbar .nav-link,
.app-navbar .btn,
.app-navbar .navbar-text {
    white-space: nowrap;
}

.app-navbar .nav-link {
    color: rgba(255, 255, 255, .78);
    border-radius: 8px;
    padding-inline: .6rem !important;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1d7afc, #0a4fb5);
    color: #fff;
    font-weight: 800;
    font-size: .8rem;
    letter-spacing: .04em;
}

.brand-mark-lg {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    font-size: 1.05rem;
}

/* ---------- Cartes et tableaux ---------- */
.card {
    border: 0;
    border-radius: var(--ezd-radius);
    box-shadow: var(--ezd-shadow);
}

.card > .card-header {
    background: #fff;
    border-bottom: 1px solid var(--ezd-line);
    padding: .9rem 1.25rem;
}

.card > .card-header:first-child {
    border-radius: var(--ezd-radius) var(--ezd-radius) 0 0;
}

.card > .card-footer {
    border-top: 1px solid var(--ezd-line);
    border-radius: 0 0 var(--ezd-radius) var(--ezd-radius);
}

.table > thead th {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ezd-muted);
    background: #f8fafc;
    border-bottom-color: var(--ezd-line);
    white-space: nowrap;
}

.table-responsive:last-child .table tbody tr:last-child td {
    border-bottom: 0;
}

.badge.text-bg-warning {
    color: #3d2c00 !important;
}

.btn-primary {
    --bs-btn-bg: var(--ezd-primary);
    --bs-btn-border-color: var(--ezd-primary);
    --bs-btn-hover-bg: var(--ezd-primary-dark);
    --bs-btn-hover-border-color: var(--ezd-primary-dark);
    --bs-btn-active-bg: var(--ezd-primary-dark);
}

/* ---------- Statistiques client ---------- */
.stat-card .stat-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.35rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}

.stat-card .stat-label {
    color: var(--ezd-muted);
    font-size: .85rem;
    margin-top: .2rem;
}

.stat-pending .stat-icon {
    background: #fff4cc;
    color: #8a6100;
}

.stat-approved .stat-icon {
    background: #d9f5e5;
    color: #0f6b3a;
}

.stat-rejected .stat-icon {
    background: #fde2e4;
    color: #a4161a;
}

.example-list li {
    background: #f4f7fb;
    border: 1px solid var(--ezd-line);
    border-radius: 10px;
    padding: .5rem .75rem;
    margin-bottom: .5rem;
}

/* ---------- Commandes (admin) ---------- */
.status-tabs .nav-link {
    color: var(--ezd-ink);
    font-weight: 600;
    border-radius: 999px;
}

.status-tabs .nav-link.active {
    background: var(--ezd-navbar);
}

.order-row {
    cursor: pointer;
}

.order-row:hover > td,
.order-row.is-open > td {
    background: #f5f8fe;
}

.order-row:focus-visible {
    outline: 2px solid var(--ezd-primary);
    outline-offset: -2px;
}

.row-chevron {
    display: inline-block;
    transition: transform .15s ease;
    color: var(--ezd-muted);
}

.order-row.is-open .row-chevron {
    transform: rotate(90deg);
}

.order-detail-body {
    background: #f8fafc;
    border-top: 1px solid var(--ezd-line);
    border-bottom: 2px solid var(--ezd-line);
}

.detail-box {
    background: #fff;
    border: 1px solid var(--ezd-line);
    border-radius: 12px;
    padding: 1rem;
}

.transcript summary {
    cursor: pointer;
    color: var(--ezd-primary);
}

.transcript-body {
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--ezd-line);
    border-radius: 12px;
    padding: .75rem;
}

.transcript-line {
    display: flex;
    gap: .5rem;
    font-size: .85rem;
    padding: .3rem 0;
    border-bottom: 1px dashed var(--ezd-line);
}

.transcript-line:last-child {
    border-bottom: 0;
}

.transcript-role {
    flex: 0 0 52px;
    font-weight: 700;
    color: var(--ezd-muted);
}

.transcript-user .transcript-role {
    color: var(--ezd-primary);
}

.transcript-text {
    white-space: pre-wrap;
}

/* ---------- Produits (admin) ---------- */
.products-table .col-price {
    min-width: 140px;
}

.products-table .col-stock {
    min-width: 100px;
}

.row-inactive > td {
    opacity: .6;
}

.row-active-profile > td {
    background: #f0fbf4;
}

.row-dirty > td {
    background: #fffbea;
}

.json-output {
    background: #0b1324;
    color: #d6e2ff;
    border-radius: 12px;
    padding: 1rem;
    font-size: .8rem;
    min-height: 180px;
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- Connexion ---------- */
.login-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 20%, rgba(29, 122, 252, .18), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(10, 79, 181, .18), transparent 45%),
        var(--ezd-bg);
    color: var(--ezd-ink);
}

.login-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    box-shadow: var(--ezd-shadow-lg);
}

/* ---------- Widget Amine ---------- */
.amine-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1060;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.amine-launcher-label {
    background: #fff;
    color: var(--ezd-ink);
    font-weight: 700;
    font-size: .85rem;
    padding: .5rem .9rem;
    border-radius: 999px;
    box-shadow: var(--ezd-shadow);
    white-space: nowrap;
}

.amine-launcher-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(135deg, #1d7afc, #0a4fb5);
    color: #fff;
    font-size: 1.6rem;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 26px rgba(11, 94, 215, .4);
    transition: transform .15s ease, box-shadow .15s ease;
}

.amine-launcher-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(11, 94, 215, .5);
}

.amine-launcher-btn:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

.amine-icon-close,
.amine-widget.is-open .amine-icon-open {
    display: none;
}

.amine-widget.is-open .amine-icon-close {
    display: inline-block;
}

.amine-panel {
    position: fixed;
    right: 20px;
    bottom: 96px;
    z-index: 1060;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: min(620px, calc(100vh - 130px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--ezd-shadow-lg);
    overflow: hidden;
}

.amine-panel[hidden] {
    display: none;
}

.amine-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1rem;
    background: var(--ezd-navbar);
    color: #fff;
}

.amine-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1d7afc, #0a4fb5);
    font-weight: 800;
}

.amine-title {
    font-size: .98rem;
    font-weight: 700;
    margin: 0;
}

.amine-status {
    font-size: .75rem;
    color: rgba(255, 255, 255, .75);
}

.amine-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    margin-right: .35rem;
}

.amine-icon-btn {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .85);
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.amine-icon-btn:hover,
.amine-icon-btn:focus-visible {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.amine-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f4f7fb;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.amine-msg {
    display: flex;
}

.amine-msg-user {
    justify-content: flex-end;
}

.amine-bubble {
    max-width: 85%;
    padding: .6rem .85rem;
    border-radius: 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.45;
    font-size: .93rem;
}

.amine-msg-assistant .amine-bubble {
    background: #fff;
    color: var(--ezd-ink);
    border: 1px solid var(--ezd-line);
    border-bottom-left-radius: 5px;
}

.amine-msg-user .amine-bubble {
    background: var(--ezd-primary);
    color: #fff;
    border-bottom-right-radius: 5px;
}

.amine-msg-error .amine-bubble {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fecdd3;
}

.amine-options {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .6rem;
}

.amine-option {
    border: 1px solid var(--ezd-primary);
    background: #fff;
    color: var(--ezd-primary);
    border-radius: 999px;
    padding: .3rem .8rem;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: start;
    white-space: normal;
}

.amine-option:hover:not(:disabled),
.amine-option:focus-visible {
    background: var(--ezd-primary);
    color: #fff;
}

.amine-options.is-used .amine-option {
    border-color: #cbd5e1;
    color: #94a3b8;
    background: #f8fafc;
    cursor: default;
}

.amine-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.amine-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: amine-blink 1.2s infinite ease-in-out;
}

.amine-typing span:nth-child(2) {
    animation-delay: .2s;
}

.amine-typing span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes amine-blink {
    0%, 80%, 100% {
        opacity: .3;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.amine-form {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    padding: .75rem;
    border-top: 1px solid var(--ezd-line);
    background: #fff;
}

.amine-input {
    flex: 1;
    resize: none;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: .55rem .8rem;
    font-size: .93rem;
    line-height: 1.4;
    max-height: 140px;
    color: var(--ezd-ink);
}

.amine-input:focus {
    outline: none;
    border-color: var(--ezd-primary);
    box-shadow: 0 0 0 3px rgba(11, 94, 215, .15);
}

.amine-send {
    flex: 0 0 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--ezd-primary);
    color: #fff;
}

.amine-send:disabled {
    opacity: .5;
}

@media (max-width: 575.98px) {
    .amine-launcher {
        right: 14px;
        bottom: 14px;
    }

    .amine-launcher-label {
        font-size: .78rem;
        padding: .4rem .7rem;
    }

    .amine-panel {
        inset: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .amine-widget.is-open .amine-launcher {
        display: none;
    }
}
