/*
 * theme.css — design system global de l'application.
 * Tokens, typographie, navbar, breadcrumbs, cartes, boutons,
 * formulaires, tableaux, alertes, pagination, footer.
 * La couleur de marque (#f1ac16) est portée par les accents,
 * pas par de grands aplats : interface sobre et lisible.
 */

:root {
    --brand: #f1ac16;
    --brand-dark: #d99912;
    --brand-deep: #b57d05;
    --brand-soft: #fdf4e0;
    --brand-ring: rgba(241, 172, 22, 0.18);
    --ink: #23262d;
    --text: #4b505a;
    --muted: #8a8f99;
    --bg: #f7f5f1;
    --surface: #ffffff;
    --border: #eae7e0;
    --border-strong: #ddd9d0;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(24, 24, 32, 0.04), 0 2px 10px rgba(24, 24, 32, 0.05);
    --shadow-md: 0 8px 28px rgba(24, 24, 32, 0.09);
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

/* ── Base ────────────────────────────────────────────────────── */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg) !important;
    font-family: var(--font);
    color: var(--text);
    padding-top: 4.25rem; /* navbar fixe */
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.01em;
}

a {
    color: var(--brand-deep);
}

a:hover {
    color: var(--brand-dark);
}

main > .container-fluid {
    background-color: transparent !important;
    max-width: 1400px;
}

.container-fluid {
    background-color: transparent !important;
}

/* ── Navbar ──────────────────────────────────────────────────── */
nav.navbar,
nav.bg-dark {
    background-color: #5c5c5c !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.15) !important;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

.navbar-brand {
    padding: 0.35rem 1rem !important;
}

.navbar-brand img {
    width: 96px !important;
    height: auto !important;
    max-height: 36px !important;
    transition: transform 0.25s ease;
}

.navbar-brand img:hover {
    transform: scale(1.04);
}

.nav-link {
    color: #d6d8dd !important;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    padding: 0.55rem 1rem !important;
    margin: 0 0.15rem;
    border-radius: 8px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
}

.nav-link.active {
    color: var(--brand) !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 2px;
    left: 50%;
    border-radius: 2px;
    background-color: var(--brand);
    transition: all 0.25s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 55%;
    left: 22.5%;
}

/* ── Breadcrumbs ─────────────────────────────────────────────── */
.breadcrumb {
    background: transparent !important;
    padding: 0.25rem 0.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--brand) !important;
    content: "›";
    font-weight: 600;
}

.breadcrumb-item a {
    color: var(--muted) !important;
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb-item a:hover {
    color: var(--brand-deep) !important;
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--ink) !important;
    font-weight: 600;
}

/* ── Cartes ──────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow-md) !important;
}

.card-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    padding: 1rem 1.5rem;
}

.card-header h1, .card-header h2, .card-header h3,
.card-header h4, .card-header h5, .card-header h6 {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: #fbfaf7 !important;
    border-top: 1px solid var(--border) !important;
    border-radius: 0 0 var(--radius) var(--radius) !important;
}

/* ── Boutons ─────────────────────────────────────────────────── */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease,
        color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #3b2c02 !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--brand-dark) !important;
    border-color: var(--brand-dark) !important;
    color: #2e2201 !important;
    box-shadow: 0 6px 16px var(--brand-ring);
}

.btn-primary:focus-visible {
    box-shadow: 0 0 0 4px var(--brand-ring) !important;
}

.btn-outline-primary {
    border: 1px solid var(--border-strong) !important;
    color: var(--text) !important;
    background: var(--surface) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    border-color: var(--brand) !important;
    background: var(--brand-soft) !important;
    color: var(--ink) !important;
    box-shadow: 0 6px 16px var(--brand-ring);
}

.btn-success {
    border-radius: var(--radius-sm);
}

.btn-sm {
    border-radius: 8px;
}

/* ── Formulaires ─────────────────────────────────────────────── */
.form-label {
    color: var(--ink);
    font-weight: 600;
    font-size: 0.9rem;
}

.form-control,
.form-select {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-strong);
    padding: 0.6rem 0.9rem;
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-ring);
}

.form-control[readonly] {
    background-color: #fbfaf7;
    color: var(--muted);
}

.form-control::placeholder {
    color: #b6bac2;
}

.input-group-text {
    background-color: #fbfaf7;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
}

.form-text, .hint-block {
    color: var(--muted);
    font-size: 0.82rem;
}

.invalid-feedback {
    font-size: 0.82rem;
}

/* ── Tableaux ────────────────────────────────────────────────── */
.table {
    color: var(--text);
    margin-bottom: 0;
}

.table thead th {
    background: #faf8f3 !important;
    color: var(--muted) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.07em !important;
    border: none !important;
    border-bottom: 2px solid var(--border) !important;
    padding: 0.8rem 1.25rem !important;
    box-shadow: none !important;
    position: static !important;
}

.table thead th::after {
    display: none;
}

.table thead th a {
    color: var(--ink) !important;
    text-decoration: none !important;
}

.table tbody td {
    padding: 0.85rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: var(--brand-soft) !important;
}

/* ── DetailView ──────────────────────────────────────────────── */
.detail-view th {
    font-weight: 600;
    color: var(--ink);
}

.detail-view td {
    color: var(--text);
}

/* ── Alertes ─────────────────────────────────────────────────── */
.alert {
    border: none;
    border-left: 3px solid transparent;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
}

.alert-warning {
    background: #fdf6e4;
    border-left-color: var(--brand);
    color: #7a5b06;
}

.alert-danger {
    background: #fdecec;
    border-left-color: #dc3545;
    color: #8f2430;
}

.alert-info {
    background: #eaf4fb;
    border-left-color: #2f9ac4;
    color: #1e5d7a;
}

.alert-success {
    background: #eaf7ef;
    border-left-color: #28a745;
    color: #1d6a35;
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination .page-link {
    color: var(--text);
    border-color: var(--border);
    border-radius: 8px;
    margin: 0 2px;
    transition: all 0.15s ease;
}

.pagination .page-item.active .page-link {
    background-color: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #3b2c02 !important;
    font-weight: 700;
}

.pagination .page-link:hover {
    background-color: var(--brand-soft) !important;
    border-color: var(--brand) !important;
    color: var(--ink) !important;
}

/* ── Badges génériques ───────────────────────────────────────── */
.badge {
    font-weight: 600;
    border-radius: 999px;
}

/* ── Footer ──────────────────────────────────────────────────── */
.custom-footer {
    background-color: #5c5c5c !important;
    color: #e3e3e3 !important;
    margin-top: auto;
    border-top: 3px solid var(--brand);
}

.custom-footer h5 {
    color: #ffffff;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.custom-footer p,
.custom-footer .text-light {
    color: #e9e9e9 !important;
    font-size: 0.9rem;
}

.custom-footer a {
    color: var(--brand) !important;
    text-decoration: none;
}

.custom-footer a:hover {
    color: #ffc94d !important;
}

.custom-footer hr {
    border-color: rgba(255, 255, 255, 0.08);
    opacity: 1;
}

/* ── Feedback de chargement ──────────────────────────────────── */
.ux-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--brand), #ffca55);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
}

.ux-progress.active {
    opacity: 1;
    animation: ux-progress-grow 10s cubic-bezier(0.1, 0.7, 0.2, 1) forwards;
}

@keyframes ux-progress-grow {
    0% { width: 0; }
    15% { width: 45%; }
    50% { width: 75%; }
    100% { width: 92%; }
}

.ux-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(247, 245, 241, 0.75);
    backdrop-filter: blur(2px);
    z-index: 1990;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ux-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ux-loading-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem 2.5rem;
    text-align: center;
    color: var(--muted);
}

.ux-loading-text {
    color: var(--ink);
    font-weight: 600;
    margin: 1rem 0 0.25rem;
}

.ux-spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto;
    border: 3px solid var(--brand-soft);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: ux-spin 0.8s linear infinite;
}

@keyframes ux-spin {
    to { transform: rotate(360deg); }
}

/* ── Recherche globale de boutique (navbar) ──────────────────── */
.navbar-shop-search {
    position: relative;
    min-width: 260px;
}

.navbar-shop-search .search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #b9bcc4;
    font-size: 0.85rem;
    pointer-events: none;
}

.navbar-shop-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    color: #ffffff;
    font-size: 0.88rem;
    padding: 0.45rem 1rem 0.45rem 2.3rem;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.navbar-shop-search input::placeholder {
    color: #c8cad0;
}

.navbar-shop-search input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(241, 172, 22, 0.25);
}

.shop-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 320px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: none;
    z-index: 1050;
}

.shop-search-results.open {
    display: block;
}

.shop-search-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.9rem;
    color: var(--ink) !important;
    text-decoration: none;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.12s ease;
}

.shop-search-item:last-child {
    border-bottom: none;
}

.shop-search-item:hover,
.shop-search-item.active {
    background: var(--brand-soft);
}

.shop-search-platform {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    color: #fff;
}

.platform-prestashop { background: #a5b3c0; }
.platform-woocommerce { background: #96588a; }
.platform-shopify { background: #5e8e3e; }

.shop-search-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shop-search-empty {
    padding: 0.8rem 1rem;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 767px) {
    .navbar-shop-search {
        margin: 0.5rem 0;
        width: 100%;
    }
}

/* ── Navigation par ancres (fiches longues) ──────────────────── */
.ux-section-nav {
    position: sticky;
    top: 4rem;
    z-index: 900;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    padding: 0.45rem 0.9rem;
    margin-bottom: 1.25rem;
    font-size: 0.8rem;
}

.ux-section-nav-label {
    color: var(--muted);
    font-weight: 600;
    margin-right: 0.2rem;
}

.ux-section-nav a {
    color: var(--text);
    text-decoration: none;
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ux-section-nav a:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--ink);
}

.info-card, .table-wrapper {
    scroll-margin-top: 8.5rem;
}

/* ── Retour en haut ──────────────────────────────────────────── */
.ux-scrolltop {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--brand-deep);
    font-size: 1.15rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
    z-index: 1500;
}

.ux-scrolltop.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ux-scrolltop:hover {
    background: var(--brand);
    color: #3b2c02;
}

/* ── Accessibilité : réduire les animations si demandé ───────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
