/* ============================================================
   assets/css/custom.css
   Surcharges Tailwind + styles globaux de la plateforme
   Police : Outfit (display) + DM Sans (body)
   Accent  : primary #059669 (vert émeraude)
   ============================================================ */

/* ── Variables CSS ────────────────────────────────────────── */
:root {
    --primary:       #059669;
    --primary-light: #ecfdf5;
    --primary-dark:  #047857;
    --surface:       #f8fafc;
    --card-radius:   1rem;
    --sidebar-width: 16rem;
    --transition:    150ms cubic-bezier(0.4, 0, 0.2, 1);
}


/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background-color: var(--surface);
    color: #1e293b;
}

h1, h2, h3, h4, h5, h6,
.font-display {
    font-family: 'Outfit', system-ui, sans-serif;
}


/* ── Layout avec sidebar ──────────────────────────────────── */
.with-sidebar {
    padding-left: 0;
    transition: padding-left var(--transition);
}

@media (min-width: 1024px) {
    .with-sidebar {
        padding-left: var(--sidebar-width);
    }
}


/* ── Cartes ───────────────────────────────────────────────── */
.card {
    background: #ffffff;
    border-radius: var(--card-radius);
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / .06), 0 1px 2px -1px rgb(0 0 0 / .04);
    padding: 1.5rem;
}

.card-sm { padding: 1rem; }
.card-lg { padding: 2rem; }

.card:hover { box-shadow: 0 4px 6px -1px rgb(0 0 0 / .07), 0 2px 4px -2px rgb(0 0 0 / .05); }


/* ── Stat cards ───────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid #f1f5f9;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgb(0 0 0 / .08);
}

.stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a;
}

.stat-label {
    font-size: .8125rem;
    color: #94a3b8;
    margin-top: .25rem;
}

.stat-trend {
    font-size: .75rem;
    font-weight: 600;
    margin-top: .375rem;
}


/* ── Formulaires ──────────────────────────────────────────── */
.form-label {
    display: block;
    font-size: .8125rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: .375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: .625rem .875rem;
    border: 1px solid #e2e8f0;
    border-radius: .625rem;
    font-size: .9375rem;
    font-family: 'DM Sans', sans-serif;
    color: #1e293b;
    background: #fff;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(5 150 105 / .12);
}

.form-input::placeholder,
.form-textarea::placeholder { color: #cbd5e1; }

.form-input.error,
.form-select.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgb(239 68 68 / .1);
}

.form-help {
    font-size: .75rem;
    color: #94a3b8;
    margin-top: .25rem;
}

.form-error {
    font-size: .75rem;
    color: #ef4444;
    margin-top: .25rem;
    display: flex;
    align-items: center;
    gap: .25rem;
}


/* ── Boutons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .625rem 1.25rem;
    font-size: .9375rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    border-radius: .625rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 3px rgb(5 150 105 / .4);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 8px rgb(5 150 105 / .35); }

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-danger {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 1px 3px rgb(239 68 68 / .35);
}
.btn-danger:hover { background: #dc2626; }

.btn-outline {
    background: transparent;
    border: 1.5px solid #e2e8f0;
    color: #64748b;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-sm { padding: .4rem .875rem; font-size: .8125rem; border-radius: .5rem; }
.btn-lg { padding: .875rem 1.75rem; font-size: 1rem; border-radius: .75rem; }
.btn-icon { padding: .5rem; border-radius: .5rem; }


/* ── Tableaux ─────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.data-table thead tr {
    background: #f8fafc;
    border-bottom: 2px solid #f1f5f9;
}

.data-table thead th {
    padding: .875rem 1rem;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #94a3b8;
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid #f8fafc;
    transition: background var(--transition);
}

.data-table tbody tr:hover { background: #f8fafc; }

.data-table tbody td {
    padding: .875rem 1rem;
    color: #334155;
    vertical-align: middle;
}

.data-table tbody tr:last-child { border-bottom: none; }


/* ── Badges de statut ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2rem .65rem;
    border-radius: 9999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success  { background: #dcfce7; color: #15803d; }
.badge-warning  { background: #fef9c3; color: #a16207; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-neutral  { background: #f1f5f9; color: #64748b; }
.badge-info     { background: #dbeafe; color: #1d4ed8; }
.badge-primary  { background: var(--primary-light); color: var(--primary-dark); }


/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgb(15 23 42 / .5);
    backdrop-filter: blur(4px);
    padding: 1rem;
}

.modal-overlay.active { display: flex; }

.modal-box {
    background: #fff;
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .18s ease-out both;
}

.modal-box-lg { max-width: 48rem; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.modal-body { padding: 1.5rem; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
    border-radius: 0 0 1.25rem 1.25rem;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1)  translateY(0); }
}

@keyframes animate-modal {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.animate-modal { animation: animate-modal .18s ease-out both; }


/* ── Toast notifications ──────────────────────────────────── */
.toast {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .875rem 1.125rem;
    border-radius: .875rem;
    box-shadow: 0 8px 24px rgb(0 0 0 / .12);
    font-size: .875rem;
    font-weight: 500;
    min-width: 260px;
    max-width: 400px;
    pointer-events: all;
    animation: toastIn .25s ease-out both;
    backdrop-filter: blur(8px);
}

.toast-success { background: #065f46; color: #a7f3d0; }
.toast-error   { background: #7f1d1d; color: #fecaca; }
.toast-warning { background: #78350f; color: #fde68a; }
.toast-info    { background: #1e3a5f; color: #bfdbfe; }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    opacity: .6;
    color: inherit;
    flex-shrink: 0;
    padding: .1rem;
    line-height: 1;
}
.toast-close:hover { opacity: 1; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

.toast.removing {
    animation: toastOut .2s ease-in forwards;
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0);    max-height: 80px; }
    to   { opacity: 0; transform: translateX(24px); max-height: 0; padding: 0; margin: 0; }
}


/* ── Upload d'image ───────────────────────────────────────── */
.upload-zone {
    border: 2px dashed #e2e8f0;
    border-radius: .875rem;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-preview {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: .625rem;
    display: none;
}


/* ── Pagination ───────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: .375rem;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .5rem;
    font-size: .875rem;
    font-weight: 500;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}

.page-btn:hover    { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.page-btn.active   { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.disabled { opacity: .4; cursor: default; pointer-events: none; }


/* ── Loader spinner ───────────────────────────────────────── */
.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    opacity: .7;
}

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


/* ── Utilitaires ──────────────────────────────────────────── */
.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.price-tag {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--primary-dark);
}

/* Scrollbar fine (webkit) */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }