/* ================================================================
   PRODUCTS PAGE - UX ENHANCEMENTS (Compatible version)
   S'applique automatiquement sans modifier le JS
   ================================================================ */

/* ────────────────────────────────────────────────────────────────
   TOOLBAR - Améliorations sur classes existantes
   ──────────────────────────────────────────────────────────────── */

.sect-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s ease;
}

.sect-toolbar:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.sect-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
}

/* Recherche expansible */
.inp-search {
    min-width: 280px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inp-search:focus {
    min-width: 360px;
    box-shadow: 0 0 0 4px var(--blue-pale);
    transform: scale(1.02);
}

/* Badge compteur */
.toolbar-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--blue-pale) 0%, rgba(31, 111, 235, 0.05) 100%);
    color: var(--blue);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid rgba(31, 111, 235, 0.2);
    box-shadow: 0 2px 8px rgba(31, 111, 235, 0.1);
    transition: all 0.3s ease;
}

.toolbar-count:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(31, 111, 235, 0.2);
}

/* Boutons actions - Effets hover */
.sect-toolbar-right {
    display: flex;
    gap: 12px;
}

.sect-toolbar-right .btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sect-toolbar-right .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.sect-toolbar-right .btn:active {
    transform: translateY(0);
}

/* ────────────────────────────────────────────────────────────────
   PROD-CARD - Améliorations sur structure existante
   ──────────────────────────────────────────────────────────────── */

.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Card améliorée */
.prod-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: visible !important; /* Pour repères découpe */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* Barre colorée en haut */
.prod-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--blue), var(--green));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    z-index: 1;
}

.prod-card:hover::before {
    transform: scaleX(1);
}

.prod-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    border-color: var(--blue);
}

/* En-tête card */
.prod-card-head {
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

/* Thumbnail avec zoom */
.prod-thumb {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.prod-card:hover .prod-thumb {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.prod-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.prod-card:hover .prod-thumb img {
    transform: scale(1.1);
}

.prod-thumb svg {
    width: 40px;
    height: 40px;
    stroke: var(--text-muted);
    opacity: 0.3;
}

/* Info produit */
.prod-card-info {
    flex: 1;
    min-width: 0;
}

.prod-card-info h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prod-card-info .sku {
    display: inline-block;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
    padding: 2px 8px;
    background: var(--bg-hover);
    border-radius: 6px;
}

/* Badges améliorés */
.prod-card-info .badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin: 2px 4px 2px 0;
    transition: all 0.2s ease;
}

.badge-gray {
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge-blue {
    background: var(--blue-pale);
    color: var(--blue);
    border: 1px solid rgba(31, 111, 235, 0.2);
}

.prod-card:hover .badge {
    transform: translateY(-1px);
}

/* Barre stock améliorée */
.prod-stock {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stock-bar {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.stock-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.stock-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.stock-bar-fill.ok {
    background: linear-gradient(90deg, var(--green), var(--green-dim));
}

.stock-bar-fill.low {
    background: linear-gradient(90deg, var(--orange), var(--orange-dim));
}

.stock-bar-fill.crit {
    background: linear-gradient(90deg, var(--red), var(--red-dim));
}

.prod-stock > span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Documents */
.prod-docs {
    padding: 0 16px 12px 16px;
    display: flex;
    gap: 8px;
}

.prod-doc-btn {
    flex: 1;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.prod-doc-btn.ft {
    background: var(--blue-pale);
    color: var(--blue);
    border-color: rgba(31, 111, 235, 0.2);
}

.prod-doc-btn.msds {
    background: var(--orange-pale);
    color: var(--orange);
    border-color: rgba(255, 123, 46, 0.2);
}

.prod-doc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Bouton action rapide */
.prod-qa-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
    box-shadow: 0 4px 12px rgba(31, 111, 235, 0.3);
}

.prod-card:hover .prod-qa-btn {
    opacity: 1;
    transform: scale(1);
}

.prod-qa-btn:hover {
    background: var(--blue-dim);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(31, 111, 235, 0.4);
}

.prod-qa-btn:active {
    transform: scale(0.95);
}

.prod-qa-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* ────────────────────────────────────────────────────────────────
   PAGINATION
   ──────────────────────────────────────────────────────────────── */

.pager {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px !important;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-top: 24px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.pager-info {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pager .btn {
    min-width: 100px;
    transition: all 0.3s ease;
}

.pager .btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.pager .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ────────────────────────────────────────────────────────────────
   ANIMATIONS
   ──────────────────────────────────────────────────────────────── */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.prod-card {
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.prod-card:nth-child(1) { animation-delay: 0.05s; }
.prod-card:nth-child(2) { animation-delay: 0.1s; }
.prod-card:nth-child(3) { animation-delay: 0.15s; }
.prod-card:nth-child(4) { animation-delay: 0.2s; }
.prod-card:nth-child(5) { animation-delay: 0.25s; }
.prod-card:nth-child(6) { animation-delay: 0.3s; }

/* ────────────────────────────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sect-toolbar {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .sect-toolbar-left,
    .sect-toolbar-right {
        width: 100%;
    }
    
    .sect-toolbar-right {
        flex-direction: column;
    }
    
    .inp-search,
    .inp-search:focus {
        min-width: 100%;
    }
    
    .prod-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .pager {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .pager .btn {
        flex: 1;
        min-width: auto;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .prod-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

/* ────────────────────────────────────────────────────────────────
   ÉTATS VIDES
   ──────────────────────────────────────────────────────────────── */

.tbl-empty {
    text-align: center;
    padding: 80px 20px !important;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
}

.tbl-empty::before {
    content: '📦';
    display: block;
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ────────────────────────────────────────────────────────────────
   MICRO-INTERACTIONS
   ──────────────────────────────────────────────────────────────── */

.btn,
.prod-card,
.inp,
.sel {
    -webkit-tap-highlight-color: transparent;
}

/* Ripple effect */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}


/* --- Products: actions in filters bar (no regression) --- */
.prod-filters-bar .prod-actions-row{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}
.prod-filters-bar .prod-actions-row .btn{
  white-space:nowrap;
}
@media (max-width: 900px){
  .prod-filters-bar .prod-actions-row{justify-content:flex-start;}
}
