﻿/* ================================================================
   historiques-shared.css
   CSS partagé pour toutes les pages d'historiques
   À importer dans wwwroot/css/ et référencer dans index.html
   ================================================================ */

/* ── Loading ──────────────────────────────────────────────────── */
.histo-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.histo-loader {
    width: 32px;
    height: 32px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: histo-spin 0.7s linear infinite;
}

@keyframes histo-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Page container ───────────────────────────────────────────── */
.histo-page {
    max-width: 1100px;
    padding-bottom: 4rem;
}

/* ── Header ───────────────────────────────────────────────────── */
.histo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2rem;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #1f2937;
    flex-wrap: wrap;
}

.histo-eyebrow {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.histo-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
    margin: 0;
    letter-spacing: -0.02em;
}

    .histo-title em {
        font-style: italic;
        font-weight: 300;
        color: var(--text-muted);
    }

/* Stats pills dans le header */
.histo-header-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.histo-stat-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    min-width: 80px;
    border: 2px solid transparent;
    background: var(--surface);
}

    .histo-stat-pill:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    }

.stat-icon {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.stat-num {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
}

.stat-lbl {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.2rem;
    opacity: 0.8;
}

.histo-stat-pill.total {
    border-color: var(--text-main);
    color: var(--text-main);
}

/* ── Alert ────────────────────────────────────────────────────── */
.histo-alert {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ── Filters ──────────────────────────────────────────────────── */
.histo-filters {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.histo-search {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #f6f7fb;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    transition: border-color 0.2s;
}

    .histo-search:focus-within {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(111,77,230,0.1);
    }

.histo-search-icon {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.histo-search input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-main);
    font-family: inherit;
}

.histo-type-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.histo-type-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 20px;
    border: 1.5px solid transparent;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f3f4f6;
    color: var(--text-muted);
}

    .histo-type-btn:hover {
        transform: translateY(-1px);
    }

    .histo-type-btn.active {
        color: white;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

.histo-date-filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.histo-date-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .histo-date-group label {
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        white-space: nowrap;
    }

    .histo-date-group input[type="date"] {
        padding: 0.5rem 0.75rem;
        border: 1.5px solid #e5e7eb;
        border-radius: 8px;
        font-size: 0.875rem;
        color: var(--text-main);
        background: #f6f7fb;
        font-family: inherit;
        outline: none;
        transition: border-color 0.2s;
    }

        .histo-date-group input[type="date"]:focus {
            border-color: var(--primary);
        }

.histo-reset-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

    .histo-reset-btn:hover {
        background: #f9fafb;
        color: var(--text-main);
        border-color: #d1d5db;
    }

.histo-results-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
}

.count-number {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.count-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.count-page-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Empty state ──────────────────────────────────────────────── */
.histo-empty {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
}

.histo-empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: #d1d5db;
}

.histo-empty h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* ── Day group ────────────────────────────────────────────────── */
.histo-day-group {
    margin-bottom: 2.5rem;
}

.histo-day-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.day-line {
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.day-text {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    white-space: nowrap;
}

.day-count {
    font-size: 0.72rem;
    color: #9ca3af;
    font-weight: 500;
    white-space: nowrap;
    background: #f3f4f6;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
}

/* ── Timeline ─────────────────────────────────────────────────── */
.histo-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 2rem;
    border-left: 2px solid #e5e7eb;
    position: relative;
}

/* ── Entry ────────────────────────────────────────────────────── */
.histo-entry {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
    padding-bottom: 1.5rem;
}

.entry-type-marker {
    position: absolute;
    left: -2.85rem;
    top: 0.6rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    border: 2px solid white;
    box-shadow: 0 0 0 3px #e5e7eb;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.histo-entry:hover .entry-type-marker {
    transform: scale(1.15);
}

.entry-card {
    flex: 1;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1.5px solid #f3f4f6;
    transition: all 0.2s ease;
    position: relative;
}

    .entry-card::before {
        content: '';
        position: absolute;
        left: -8px;
        top: 1.1rem;
        width: 0;
        height: 0;
        border-top: 7px solid transparent;
        border-bottom: 7px solid transparent;
        border-right: 8px solid #f3f4f6;
    }

.histo-entry:hover .entry-card {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateX(3px);
    border-color: inherit;
}

.entry-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.entry-meta-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.entry-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.entry-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.entry-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

/* Corps acteurs */
.entry-card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.entry-actor {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 160px;
}

.actor-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.client-av {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.tech-av {
    background: linear-gradient(135deg, var(--accent), #e67e22);
}

.produit-av {
    background: linear-gradient(135deg, #10b981, #047857);
}

.user-av {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.acteur-av {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.actor-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.actor-role {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.actor-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actor-detail {
    font-size: 0.77rem;
    color: var(--text-muted);
}

.entry-arrow {
    font-size: 1.2rem;
    color: #d1d5db;
    font-weight: 300;
    flex-shrink: 0;
}

/* Footer */
.entry-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.entry-product {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 500;
}

.product-icon {
    font-size: 0.9rem;
}

.product-deduit-badge {
    background: #ecfdf5;
    color: #065f46;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-left: auto;
}

.entry-comment {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.comment-icon {
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.comment-text {
    font-style: italic;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Qte badge */
.entry-qte-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Description déroulable */
.entry-description {
    margin-top: 0.75rem;
    font-size: 0.82rem;
}

    .entry-description summary {
        cursor: pointer;
        color: var(--primary);
        font-weight: 600;
        font-size: 0.8rem;
        letter-spacing: 0.03em;
        user-select: none;
        list-style: none;
    }

        .entry-description summary::before {
            content: '▸ ';
        }

    .entry-description[open] summary::before {
        content: '▾ ';
    }

    .entry-description p {
        margin: 0.5rem 0 0;
        color: var(--text-muted);
        line-height: 1.6;
        background: #f6f7fb;
        padding: 0.75rem;
        border-radius: 8px;
        white-space: pre-line;
        font-size: 0.8rem;
    }

/* ═══════════════ PAGINATION ═══════════════ */
.histo-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.histo-page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 0.65rem;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: var(--surface);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .histo-page-btn:hover:not(:disabled) {
        border-color: var(--primary);
        color: var(--primary);
        background: color-mix(in srgb, var(--primary) 6%, transparent);
    }

    .histo-page-btn:disabled {
        opacity: 0.35;
        cursor: not-allowed;
    }

    .histo-page-btn.current {
        background: var(--primary);
        border-color: var(--primary);
        color: white;
        box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent);
        transform: translateY(-1px);
    }

    .histo-page-btn.nav-btn {
        padding: 0 1rem;
        font-size: 0.82rem;
        letter-spacing: 0.02em;
    }

.histo-page-numbers {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.histo-page-ellipsis {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 0.25rem;
    user-select: none;
}

/* ════════════ COULEURS PAR TYPE D'ACTION ════════════ */

/* Création — vert émeraude */
.type-creation {
    --type-color: #10b981;
    --type-bg: #d1fae5;
    --type-text: #065f46;
}

.histo-stat-pill.type-creation,
.entry-type-badge.type-creation {
    background: var(--type-bg);
    color: var(--type-text);
    border-color: var(--type-color);
}

.histo-type-btn.type-creation.active {
    background: var(--type-color);
    color: white;
}

.histo-stat-pill.type-creation {
    border-color: var(--type-color);
    color: var(--type-text);
}

.histo-entry.type-creation .entry-card {
    border-left: 3px solid var(--type-color);
}

.histo-entry.type-creation .entry-type-marker {
    background: var(--type-bg);
    color: var(--type-text);
    box-shadow: 0 0 0 3px #a7f3d0;
}

/* Modification — bleu indigo */
.type-modification {
    --type-color: #6366f1;
    --type-bg: #ede9fe;
    --type-text: #3730a3;
}

.histo-stat-pill.type-modification,
.entry-type-badge.type-modification {
    background: var(--type-bg);
    color: var(--type-text);
    border-color: var(--type-color);
}

.histo-type-btn.type-modification.active {
    background: var(--type-color);
    color: white;
    border-color: var(--type-color);
}

.histo-stat-pill.type-modification {
    border-color: var(--type-color);
    color: var(--type-text);
}

.histo-entry.type-modification .entry-card {
    border-left: 3px solid var(--type-color);
}

.histo-entry.type-modification .entry-type-marker {
    background: var(--type-bg);
    color: var(--type-text);
    box-shadow: 0 0 0 3px #c7d2fe;
}

/* Suppression — rouge */
.type-suppression {
    --type-color: #ef4444;
    --type-bg: #fee2e2;
    --type-text: #991b1b;
}

.histo-stat-pill.type-suppression,
.entry-type-badge.type-suppression {
    background: var(--type-bg);
    color: var(--type-text);
    border-color: var(--type-color);
}

.histo-type-btn.type-suppression.active {
    background: var(--type-color);
    color: white;
    border-color: var(--type-color);
}

.histo-stat-pill.type-suppression {
    border-color: var(--type-color);
    color: var(--type-text);
}

.histo-entry.type-suppression .entry-card {
    border-left: 3px solid var(--type-color);
}

.histo-entry.type-suppression .entry-type-marker {
    background: var(--type-bg);
    color: var(--type-text);
    box-shadow: 0 0 0 3px #fca5a5;
}

/* Activation — cyan */
.type-activation {
    --type-color: #06b6d4;
    --type-bg: #cffafe;
    --type-text: #155e75;
}

.histo-stat-pill.type-activation,
.entry-type-badge.type-activation {
    background: var(--type-bg);
    color: var(--type-text);
    border-color: var(--type-color);
}

.histo-type-btn.type-activation.active {
    background: var(--type-color);
    color: white;
    border-color: var(--type-color);
}

.histo-stat-pill.type-activation {
    border-color: var(--type-color);
    color: var(--type-text);
}

.histo-entry.type-activation .entry-card {
    border-left: 3px solid var(--type-color);
}

.histo-entry.type-activation .entry-type-marker {
    background: var(--type-bg);
    color: var(--type-text);
    box-shadow: 0 0 0 3px #a5f3fc;
}

/* Désactivation — gris */
.type-desactivation {
    --type-color: #9ca3af;
    --type-bg: #f3f4f6;
    --type-text: #374151;
}

.histo-stat-pill.type-desactivation,
.entry-type-badge.type-desactivation {
    background: var(--type-bg);
    color: var(--type-text);
    border-color: var(--type-color);
}

.histo-type-btn.type-desactivation.active {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.histo-stat-pill.type-desactivation {
    border-color: var(--type-color);
    color: var(--type-text);
}

.histo-entry.type-desactivation .entry-card {
    border-left: 3px solid var(--type-color);
}

.histo-entry.type-desactivation .entry-type-marker {
    background: var(--type-bg);
    color: var(--type-text);
    box-shadow: 0 0 0 3px #e5e7eb;
}

/* Mouvement stock — orange */
.type-stock {
    --type-color: #f59e0b;
    --type-bg: #fef3c7;
    --type-text: #92400e;
}

.histo-stat-pill.type-stock,
.entry-type-badge.type-stock {
    background: var(--type-bg);
    color: var(--type-text);
    border-color: var(--type-color);
}

.histo-type-btn.type-stock.active {
    background: var(--type-color);
    color: white;
    border-color: var(--type-color);
}

.histo-stat-pill.type-stock {
    border-color: var(--type-color);
    color: var(--type-text);
}

.histo-entry.type-stock .entry-card {
    border-left: 3px solid var(--type-color);
}

.histo-entry.type-stock .entry-type-marker {
    background: var(--type-bg);
    color: var(--type-text);
    box-shadow: 0 0 0 3px #fde68a;
}

/* Envoi SMS — violet */
.type-sms {
    --type-color: #8b5cf6;
    --type-bg: #ede9fe;
    --type-text: #5b21b6;
}

.histo-stat-pill.type-sms,
.entry-type-badge.type-sms {
    background: var(--type-bg);
    color: var(--type-text);
    border-color: var(--type-color);
}

.histo-type-btn.type-sms.active {
    background: var(--type-color);
    color: white;
    border-color: var(--type-color);
}

.histo-entry.type-sms .entry-card {
    border-left: 3px solid var(--type-color);
}

.histo-entry.type-sms .entry-type-marker {
    background: var(--type-bg);
    color: var(--type-text);
    box-shadow: 0 0 0 3px #ddd6fe;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .histo-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .histo-header-stats {
        width: 100%;
    }

    .histo-stat-pill {
        flex: 1;
        min-width: 60px;
    }

    .histo-timeline {
        padding-left: 1.25rem;
    }

    .entry-type-marker {
        left: -2.1rem;
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }

    .entry-card-body {
        flex-direction: column;
        align-items: flex-start;
    }

    .entry-arrow {
        transform: rotate(90deg);
    }

    .histo-pagination {
        gap: 0.35rem;
    }

    .histo-page-btn.nav-btn {
        font-size: 0.78rem;
        padding: 0 0.75rem;
    }
}

@media (max-width: 480px) {
    .histo-type-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
    }

    .histo-type-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .histo-date-filters {
        flex-direction: column;
        align-items: flex-start;
    }

    .histo-reset-btn {
        margin-left: 0;
    }
}
