/* ========================================
   🎨 KORENCE STOCK MANAGER - STYLE LISTE COMPACTE
   Version: Cartes 2 Lignes (35% Image / 65% Infos)
   ======================================== */

/* --- RÉINITIALISATION ET BASE --- */
* {
    box-sizing: border-box;
}

/* --- BOUTON DE RÉINITIALISATION --- */
.ksm-reset-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white !important;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    border: none;
}

.ksm-reset-button:hover {
    color: white !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
}

.ksm-reset-button .dashicons {
    font-size: 18px;
    line-height: 1;
}

/* --- FILTRES ET RECHERCHE (AMÉLIORÉ AVEC MEILLEURE LISIBILITÉ) --- */
.ksm-filters {
    background: linear-gradient(135deg, #e2ffd5 0%, #77ff5f 100%);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.ksm-filters form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: nowrap !important;
}

.ksm-filters input[type="text"],
.ksm-filters select {
    padding: 14px 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    /*min-width: 240px;*/
    font-size: 15px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.95); /* Fond blanc légèrement transparent */
    color: #2d3748; /* Texte foncé pour la lisibilité */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    flex: 1 !important;
    min-width: 180px !important;
}

.ksm-filters select,
.ksm-filters .ksm-button {
     flex-shrink: 0 !important; /* Empêche les listes déroulantes et le bouton de se compresser */
}

.ksm-filters input[type="text"]::placeholder {
    color: #718096; /* Placeholder gris plus foncé */
    font-weight: 500;
}

.ksm-filters input[type="text"]:focus,
.ksm-filters select:focus {
    outline: none;
    background: white; /* Fond complètement blanc au focus */
    border-color: #ffd700;
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

.ksm-filters select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%232d3748' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

/* Style des options du select */
.ksm-filters select option {
    color: #2d3748;
    background: white;
    font-weight: 500;
    padding: 10px;
}

/* --- BARRE DE TRI (AMÉLIORÉ) --- */
.ksm-sort-bar {
    background: white;
    padding: 18px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid #e2e8f0;
}

.ksm-sort-bar label {
    font-weight: 700;
    color: #2d3748;
    font-size: 16px;
}

.ksm-sort-bar select {
    padding: 12px 40px 12px 16px;
    border: 2px solid #cbd5e0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    min-width: 220px;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23667eea' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}

.ksm-sort-bar select:hover {
    border-color: #667eea;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.ksm-sort-bar select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* --- BOUTONS --- */
.ksm-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #a6e589 0%, #24a50e 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.ksm-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

.ksm-button:active {
    transform: translateY(-1px);
}

.ksm-button .dashicons {
    font-size: 18px;
    line-height: 1;
}

.ksm-button-small {
    padding: 8px 16px;
    font-size: 13px;
}

.ksm-button-small .dashicons {
    font-size: 16px;
}

/* --- GRILLE DE PRODUITS (3/2/1 PAR LIGNE) --- */
.ksm-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 cartes par ligne sur PC */
    gap: 20px;
    margin-bottom: 30px;
}

/* --- CARTE PRODUIT INDIVIDUELLE (2 LIGNES COMPACTES) --- */
.ksm-product-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid transparent;
}

.ksm-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
    border-color: #667eea;
}

/* ============= LIGNE 1 : IMAGE + INFOS ============= */
.ksm-card-row-1 {
    display: flex;
    flex-direction: row;
}

/* --- COLONNE 1 : IMAGE (35%) --- */
.ksm-card-image-column {
    width: 35%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    flex-shrink: 0;
}

.ksm-image-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.ksm-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 1 / 1; /* Image carrée */
    transition: transform 0.5s ease;
}

.ksm-product-card:hover .ksm-product-image {
    transform: scale(1.08);
}

/* --- BADGE DE STATUT (REMPLACE L'ANCIEN BADGE DE STOCK) --- */
.ksm-stock-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 5px;
    border-radius: 16px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
    z-index: 10;
    color: white; /* Couleur de texte globale pour tous les badges */
}

/* Statut : Publié (Vert) */
.ksm-stock-badge.published {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

/* Statut : En attente (Orange) */
.ksm-stock-badge.pending {
    background: linear-gradient(135deg, #f0ad4e 0%, #f5a623 100%);
}

/* Statut : Brouillon (Gris) */
.ksm-stock-badge.draft {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
}

/* Statut : Privé (Rouge/Rose) */
.ksm-stock-badge.private {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

/* Statut : Inconnu (rare) */
.ksm-stock-badge.unknown {
    background: #2d3748;
}

/* --- COLONNE 2 : INFOS (65%) --- */
.ksm-card-info-column {
    width: 65%;
    padding: 5px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.ksm-card-link {
    text-decoration: none;
    color: inherit;
}

/* === MODIFICATION === */
.ksm-card-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: #2d3748;
    
    /* Limitation à 1 seule ligne */
    white-space: nowrap;      /* Force le texte sur une seule ligne */
    overflow: hidden;         /* Cache ce qui dépasse */
    text-overflow: ellipsis;  /* Ajoute "..." à la fin */
    transition: color 0.3s ease;

    /* Ancien code pour 2 lignes (désactivé)
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    height: 39px; 
    */
}
/* === FIN MODIFICATION === */


.ksm-card-title:hover {
    color: #667eea;
}

/* --- STATISTIQUES (INLINE COMPACT) --- */
.ksm-card-stats {
    display: flex;
    gap: 15px;
    margin: 0;
    padding: 0px 0 0 0;
}

.ksm-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ksm-stat-icon {
    font-size: 18px;
    line-height: 1;
}

.ksm-stat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ksm-stat-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    color: #a0aec0;
    letter-spacing: 0.5px;
    line-height: 1;
}

.ksm-stat-value {
    font-size: 16px;
    font-weight: 800;
    color: #2d3748;
    line-height: 1;
}

/* ============= LIGNE 2 : AUTEUR + FORMULAIRE (ADMIN SEULEMENT) ============= */
.ksm-card-row-2 {
    padding: 10px 15px;
    background: #f7fafc;
    border-top: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* --- AUTEUR --- */
.ksm-card-author {
    font-size: 12px;
    color: #718096;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.ksm-card-author .dashicons {
    font-size: 16px;
    color: #a0aec0;
}

/* --- ACTIONS DE LA CARTE (FORMULAIRE ADMIN) --- */
.ksm-card-actions {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.ksm-update-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
    position: relative;
}

.ksm-quantity-input {
    width: 90px;
    padding: 7px 10px;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.ksm-quantity-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ksm-message {
    display: none; 
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);    
    min-width: 160px;
    white-space: normal;
    text-align: center;    
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 600;
    z-index: 99;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.ksm-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ksm-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ksm-message::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: inherit;
    border-top-color: inherit;
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-left-color: transparent;
}

/* --- PAGINATION --- */
.ksm-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.page-numbers {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.3s ease;
    background: white;
}

.page-numbers:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

.page-numbers.current {
    background: linear-gradient(135deg, #e2ffd5 0%, #77ff5f 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* --- MESSAGE "AUCUN PRODUIT" --- */
.ksm-no-products {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #718096;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

/* ========================================
   📱 RESPONSIVE DESIGN
   ======================================== */

/* TABLETTE : 2 cartes par ligne */
@media (max-width: 1024px) {
    .ksm-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* MOBILE : 1 carte par ligne */
@media (max-width: 768px) {
    .ksm-products-grid {
        grid-template-columns: 1fr;
    }
    
    .ksm-filters form {
        flex-direction: column;
        align-items: stretch;
    }

    .ksm-filters input[type="text"],
    .ksm-filters select {
        width: 100%;
        min-width: unset;
    }

    .ksm-sort-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .ksm-sort-bar select {
        width: 100%;
    }
    
    .ksm-card-row-2 {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .ksm-card-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .ksm-update-form {
        width: 100%;
    }
    
    .ksm-quantity-input {
        flex: 1;
        width: auto !important;
    }
}

/* ========================================
   ✨ ANIMATIONS ET EFFETS SPÉCIAUX
   ======================================== */

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

.ksm-product-card {
    animation: fadeIn 0.5s ease-out;
}

/* Animation au chargement avec délai progressif */
.ksm-product-card:nth-child(1) { animation-delay: 0.05s; }
.ksm-product-card:nth-child(2) { animation-delay: 0.1s; }
.ksm-product-card:nth-child(3) { animation-delay: 0.15s; }
.ksm-product-card:nth-child(4) { animation-delay: 0.2s; }
.ksm-product-card:nth-child(5) { animation-delay: 0.25s; }
.ksm-product-card:nth-child(6) { animation-delay: 0.3s; }

/* Effet de brillance au survol */
.ksm-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
    pointer-events: none;
    z-index: 1;
}

.ksm-product-card:hover::before {
    left: 100%;
}

/* ========================================
   🎯 COMPATIBILITÉ AVEC LES AUTRES SHORTCODES
   (Pour ne pas casser [ksm_produit_admin] sur les pages produits)
   ======================================== */

/* Message "en stock" sur les pages produits */
.ksm-in-stock-message {
    background: white;
    color: black;
    padding: 12px 5px;
    border-radius: 10px;
    font-weight: 600;
    margin: 5px 0;
    text-align: center;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

/* Formulaire d'admin sur les pages produits */
.ksm-product-admin-form-wrapper {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin: 20px 0;
    border: 2px solid #e2e8f0;
}

.ksm-product-admin-form-wrapper h4 {
    margin-top: 0;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ksm-notice-success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
    margin-bottom: 15px;
    font-weight: 600;
}

.ksm-current-stock-value {
    color: #667eea;
    font-size: 20px;
    font-weight: 800;
}

.ksm-product-admin-form-no-ajax {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.ksm-product-admin-form-no-ajax label {
    font-weight: 600;
    color: #4a5568;
}

.ksm-product-admin-form-no-ajax .ksm-quantity-input {
    min-width: 150px;
}

/* ========================================
   📝 FORMULAIRE D'AJOUT DE PRODUIT
   Shortcode: [ksm_add_product]
   ======================================== */

.ksm-add-product-container {
    max-width: 900px;
    margin: 30px auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ksm-add-product-header {
    background: linear-gradient(90deg, #b1ff8e 0%, #24a304 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.ksm-add-product-header h2 {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ksm-add-product-header h2 .dashicons {
    font-size: 36px;
}

.ksm-add-product-subtitle {
    margin: 0;
    font-size: 16px;
    opacity: 0.95;
    font-weight: 400;
}

.ksm-add-product-form {
    padding: 40px 30px;
}

/* Messages d'erreur/succès */
.ksm-form-messages {
    margin-bottom: 25px;
    padding: 15px 20px;
    border-radius: 10px;
    display: none;
    font-weight: 600;
    animation: slideDown 0.3s ease;
}

.ksm-form-messages.success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
    display: block;
}

.ksm-form-messages.error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
    display: block;
}

.ksm-form-messages.info {
    background: #e0f2fe;
    color: #0c5464;
    border: 2px solid #b3e5fc;
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sections du formulaire */
.ksm-form-section {
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 2px solid #f0f0f0;
}

.ksm-form-section:last-of-type {
    border-bottom: none;
}

.ksm-form-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 25px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ksm-form-section-title .dashicons {
    font-size: 24px;
    color: #667eea;
}

/* Rangées de formulaire */
.ksm-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.ksm-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ksm-form-field-full {
    width: 100%;
}

.ksm-form-field-half {
    flex: 1;
}

/* Labels */
.ksm-form-field label {
    font-weight: 700;
    color: #2d3748;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ksm-required {
    color: #e53e3e;
    font-weight: 700;
}

.ksm-field-hint {
    display: block;
    font-weight: 400;
    color: #718096;
    font-size: 13px;
    margin-top: 4px;
}

/* Champs de saisie */
.ksm-input,
.ksm-select,
.ksm-textarea {
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
    color: #2d3748;
}

.ksm-input:focus,
.ksm-select:focus,
.ksm-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ksm-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23667eea' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 45px;
}

.ksm-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* Zone d'upload d'images */
.ksm-upload-button-container {
    margin-bottom: 15px;
}

.ksm-file-input-hidden {
    display: none;
}

.ksm-upload-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.ksm-upload-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.ksm-upload-button .dashicons {
    font-size: 20px;
    line-height: 1;
}

.ksm-upload-button-secondary {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.ksm-upload-button-secondary:hover {
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.4);
}

/* Aperçu image principale */
.ksm-single-image-preview {
    margin-top: 15px;
}

.ksm-single-image-preview.has-image {
    position: relative !important;
    width: 200px !important;
    height: 200px !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

.ksm-single-image-preview img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.ksm-single-image-remove {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    background: rgba(229, 62, 62, 0.95) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

.ksm-single-image-remove:hover {
    background: #c53030;
    transform: rotate(90deg) scale(1.1);
}

.ksm-single-image-remove .dashicons {
    font-size: 20px;
    line-height: 1;
}

/* Aperçu galerie */
.ksm-gallery-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.ksm-gallery-image-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    aspect-ratio: 1 / 1;
    -webkit-touch-callout: none;
}

.ksm-gallery-image-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.ksm-gallery-image-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.ksm-gallery-image-remove {
    position: absolute !important;
    top: 5px !important;
    right: 5px !important;
    background: rgba(229, 62, 62, 0.95) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 32px !important; 
    height: 32px !important; 
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    z-index: 10 !important; 
}

.ksm-gallery-image-remove:hover {
    background: #c53030 !important;
    transform: rotate(90deg) scale(1.1) !important;
}

.ksm-gallery-image-remove .dashicons {
    font-size: 18px !important; 
    line-height: 1 !important;
}

/* ⬇️ ⬇️ ⬇️ NOUVEAUX STYLES POUR LA POIGNÉE DE GLISSEMENT ⬇️ ⬇️ ⬇️ */
.ksm-gallery-drag-handle {
    position: absolute !important;
    bottom: 4px !important;
    right: 4px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    color: white !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: grab !important;
    z-index: 11 !important; /* Plus haut que le bouton supprimer */
    transition: all 0.3s ease !important;
    touch-action: none !important; /* TRÈS IMPORTANT: Indique au navigateur que cette zone gère le toucher */
}

.ksm-gallery-drag-handle:hover {
    background: rgba(0, 0, 0, 0.9) !important;
    transform: scale(1.1) !important;
}

.ksm-gallery-drag-handle:active {
    cursor: grabbing !important;
}

.ksm-gallery-drag-handle .dashicons {
    font-size: 20px !important;
    line-height: 1 !important;
}
/* ⬆️ ⬆️ ⬆️ FIN DES NOUVEAUX STYLES ⬆️ ⬆️ ⬆️ */

/* Bouton de soumission */
.ksm-form-submit {
    margin-top: 40px;
    text-align: center;
}

.ksm-submit-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.ksm-submit-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
}

.ksm-submit-button:active:not(:disabled) {
    transform: translateY(-1px);
}

.ksm-submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.ksm-submit-button .dashicons {
    font-size: 22px;
    line-height: 1;
}

.ksm-loading-spinner .dashicons {
    animation: spin 1s linear infinite;
}

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

/* Message d'erreur */
.ksm-add-product-error {
    max-width: 600px;
    margin: 40px auto;
    padding: 25px 30px;
    background: #fff5f5;
    border: 2px solid #fc8181;
    border-radius: 12px;
    text-align: center;
}

.ksm-add-product-error p {
    margin: 0;
    color: #c53030;
    font-weight: 600;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ksm-add-product-container {
        margin: 20px;
    }

    .ksm-add-product-header {
        padding: 30px 20px;
    }

    .ksm-add-product-header h2 {
        font-size: 24px;
    }

    .ksm-add-product-form {
        padding: 10px 5px;
    }

    .ksm-form-row {
        flex-direction: column;
        gap: 10px;
    }

    .ksm-gallery-preview-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .ksm-submit-button {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   🆕 STYLES POUR LE DRAG & DROP DES IMAGES
   ======================================== */

/* Animation pour l'élément survolé pendant le drag */
.ksm-gallery-image-item.drag-over {
    border: 3px dashed #667eea !important;
    background: rgba(102, 126, 234, 0.1) !important;
    transform: scale(1.05) !important;
}

/* Clone de l'image pendant le drag sur mobile */
.ksm-gallery-image-item.dragging-clone {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); !important
    transform: rotate(5deg) !important;
}

/* Curseur pendant le drag */
.ksm-gallery-image-item[draggable="true"] {
    cursor: move !important;
    cursor: grab !important;
}

.ksm-gallery-image-item[draggable="true"]:active {
    cursor: grabbing !important;
}

/* Touch feedback sur mobile */
@media (hover: none) and (pointer: coarse) {
    .ksm-gallery-image-item {
        user-select: none !important;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    .ksm-gallery-image-item:active {
        transform: scale(0.95) !important;
    }
}

/* ========================================
   🆕 STYLES POUR LES BOUTONS D'ACTION (MODIFIER/SUPPRIMER)
   ======================================== */

.ksm-card-edit-actions {
    display: flex !important;
    gap: 5px !important;
    margin-top: 5px !important;
}

.ksm-edit-button,
.ksm-delete-button {
    flex: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 2px 5px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.ksm-edit-button .dashicons,
.ksm-delete-button .dashicons {
    font-size: 12px !important;
    line-height: 1 !important;
}

/* Bouton Modifier */
.ksm-edit-button {
    background: #e0e7ff !important;
    color: #4338ca !important;
}

.ksm-edit-button:hover {
    background: #c7d2fe !important;
    color: #3730a3 !important;
    transform: translateY(-2px) !important;
}

/* Bouton Supprimer */
.ksm-delete-button {
    background: #fee2e2 !important;
    color: #b91c1c !important;
}

.ksm-delete-button:hover {
    background: #fecaca !important;
    color: #991b1b;
    transform: translateY(-2px) !important;
}

.ksm-delete-button:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}


/* ========================================
   STYLES POUR LE FORMULAIRE D'ÉDITION
   ======================================== */

/* Message d'info (ex: pour "pas d'édition d'image") */
.ksm-form-message-info {
    background: #e0f2fe;
    color: #0c5464;
    padding: 15px 20px;
    border-radius: 10px;
    font-weight: 600;
    margin-bottom: 20px;
    border: 2px solid #b3e5fc;
}

/* Aperçu des images existantes en mode édition 
   (Le sélecteur de preview de galerie existant fonctionne déjà)
*/
.ksm-single-image-preview.has-image img,
.ksm-gallery-image-item img {
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
}

/* ========================================
   📦 SHORTCODE [ksm_ventes_vendeurs]
   ======================================== */

.ksm-vendor-sales-grid {
    display: grid;
    /* Utilise la même grille responsive que les produits */
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.ksm-order-card {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.ksm-order-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* --- En-tête de la carte --- */
.- {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 2px solid #f1f5f9;
}

.ksm-order-id {
    font-size: 16px;
    font-weight: 700;
    color: #334155;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ksm-order-id .dashicons {
    font-size: 18px;
    color: #64748b;
}

.ksm-order-status-badge {
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
}

/* --- Corps de la carte (Liste des articles) --- */
.ksm-order-body {
    padding: 5px;
    min-height: 100px; /* Hauteur minimale */
}

.ksm-order-item-list {
    display: flex;
    gap: 12px;
    overflow-x: auto; /* Permet de scroller horizontalement si trop d'articles */
    padding-bottom: 10px; /* Espace pour la barre de scroll */
}

/* --- Article individuel (compact) --- */
.ksm-order-item {
    flex-shrink: 0; /* Empêche les articles de se réduire */
    width: 80px;
    text-align: center;
}

.ksm-order-item-image {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    position: relative;
    border: 2px solid #e2e8f0;
}

.ksm-order-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ksm-order-item-qty {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-bottom-left-radius: 10px;
}

.ksm-order-item-price {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-top: 5px;
    white-space: nowrap;
}

/* --- Pied de la carte --- */
.ksm-order-footer {
    padding: 12px 15px;
    background: #f8fafc;
    border-top: 2px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto; /* Pousse le pied en bas */
}

.ksm-order-item-count {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.ksm-order-total-group {
    text-align: right;
}

.ksm-order-total-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    line-height: 1;
}

.ksm-order-total-amount {
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}

/* --- Couleurs des statuts de commande --- */
.ksm-order-status-processing,
.ksm-order-status-completed {
    border-color: #22c55e; /* Vert */
}
.ksm-order-status-processing .ksm-order-status-badge,
.ksm-order-status-completed .ksm-order-status-badge {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.ksm-order-status-pending,
.ksm-order-status-on-hold {
    border-color: #f59e0b; /* Orange */
}
.ksm-order-status-pending .ksm-order-status-badge,
.ksm-order-status-on-hold .ksm-order-status-badge {
    background: linear-gradient(135deg, #f0ad4e 0%, #f5a623 100%);
}

.ksm-order-status-cancelled,
.ksm-order-status-refunded,
.ksm-order-status-failed {
    border-color: #ef4444; /* Rouge */
}
.ksm-order-status-cancelled .ksm-order-status-badge,
.ksm-order-status-refunded .ksm-order-status-badge,
.ksm-order-status-failed .ksm-order-status-badge {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

/* --- Responsive (similaire à la grille de produits) --- */
@media (max-width: 1024px) {
    .ksm-vendor-sales-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ksm-vendor-sales-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   📦 [ksm_ventes_vendeurs] - AMÉLIORATIONS
   ======================================== */

/* --- Modification de l'en-tête --- */
.ksm-order-header {
    gap: 10px; /* Ajoute un espace entre les éléments */
}

.ksm-order-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: auto; /* Pousse le badge de statut à droite */
}

.ksm-order-id {
    line-height: 1.2; /* Resserre la ligne */
}

.ksm-order-date {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    line-height: 1;
}

.ksm-order-status-badge {
    flex-shrink: 0; /* Empêche le badge de se compresser */
}

/* --- Effet de survol sur l'image de l'article --- */
.ksm-order-item-link .ksm-order-item-image img {
    transition: transform 0.3s ease;
}

.ksm-order-item-link:hover .ksm-order-item-image img {
    transform: scale(1.1);
}

/* ========================================
   🆕 STYLES POUR LES LIENS STATS CARTE
   ======================================== */

.ksm-stat-link {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 5px; /* Ajoute une petite zone cliquable */
}

.ksm-stat-link:hover {
    background-color: #f7fafc; /* Léger fond au survol */
    transform: scale(1.05); /* Effet de zoom léger */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* ========================================
   🆕 STYLES POUR LES PAGES D'HISTORIQUE
   [ksm_info_produit_stock] & [ksm_info_produit_vendu]
   ======================================== */

.ksm-history-container {
    max-width: 900px;
    margin: 30px auto;
    background: white;
    border-radius: 16px;
    padding: 25px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.ksm-history-container h3 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.ksm-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.ksm-history-table th,
.ksm-history-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.ksm-history-table th {
    background-color: #f8fafc;
    font-size: 13px;
    font-weight: 700;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ksm-history-table tbody tr:hover {
    background-color: #f7fafc;
}

.ksm-history-table td {
    font-size: 15px;
    color: #2d3748;
}

.ksm-text-danger {
    color: #e53e3e;
    font-weight: 700;
}

/* --- STATUTS DE COMMANDE (réutilisés et adaptés) --- */
.ksm-order-status-badge.small-badge {
    padding: 3px 8px;
    font-size: 10px;
}

.ksm-status-processing,
.ksm-status-completed {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.ksm-status-pending,
.ksm-status-on-hold {
    background: linear-gradient(135deg, #f0ad4e 0%, #f5a623 100%);
}

.ksm-status-cancelled,
.ksm-status-refunded,
.ksm-status-failed {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

/* --- SHORTCODE RETRAITS (ksm_retraits) --- */

.ksm-payouts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 10px;
}

.ksm-payout-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-left: 5px solid #cbd5e0; /* Gris par défaut (pending) */
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.ksm-payout-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

/* Couleurs selon statut */
.ksm-payout-card.ksm-pay-status-paid { border-left-color: #48bb78; } /* Vert */
.ksm-payout-card.ksm-pay-status-refused { border-left-color: #f56565; } /* Rouge */
.ksm-payout-card.ksm-pay-status-pending { border-left-color: #ecc94b; } /* Jaune */

.ksm-payout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e2e8f0;
}

.ksm-payout-id {
    font-weight: 800;
    color: #2d3748;
    font-size: 1.1em;
}

.ksm-payout-date {
    font-size: 0.85em;
    color: #a0aec0;
}

.ksm-payout-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95em;
    color: #4a5568;
}

.ksm-payout-divider {
    height: 1px;
    background: #edf2f7;
    margin: 10px 0;
}

.ksm-net-row .ksm-value {
    font-weight: 800;
    font-size: 1.2em;
    color: #2b6cb0;
}

.ksm-value.negative {
    color: #e53e3e;
    font-size: 0.9em;
}

/* Footer et Actions */
.ksm-payout-footer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #f7fafc;
    text-align: right;
}

/* Badge Vendeur */
.ksm-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
}
.ksm-pay-status-paid .ksm-status-badge { background: #c6f6d5; color: #22543d; }
.ksm-pay-status-pending .ksm-status-badge { background: #fefcbf; color: #744210; }
.ksm-pay-status-refused .ksm-status-badge { background: #fed7d7; color: #822727; }

/* Admin Inputs */
.ksm-admin-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.ksm-payout-select {
    font-size: 0.85em;
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.ksm-btn-save-payout {
    background: #4a5568 !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    width: 32px !important;
    height: 32px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s !important;
}

.ksm-btn-save-payout:hover { background: #2d3748 !important; }
.ksm-btn-save-payout.updating { opacity: 0.7; cursor: wait; animation: pulse 1s infinite; }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* --- FILTRE SIMPLE (Nouveau style pour [ksm_retraits]) --- */
.ksm-filters-simple {
    background: #f7fafc;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid #e2e8f0;
    display: inline-block; /* Prend juste la largeur nécessaire */
    width: 100%;
}

.ksm-filters-simple form {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Aligner à droite */
}

.ksm-filters-simple select {
    min-width: 200px;
    padding: 8px 12px;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-weight: 600;
    color: #2d3748;
}

/* --- LE GRAND STATUT (H2) --- */
.ksm-big-status-text {
    font-size: 22px;
    font-weight: 900;
    text-align: center;
    margin: 10px 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}

/* Couleurs du texte H2 */
.ksm-big-status-text.ksm-pay-status-paid { color: #2f855a; } /* Vert foncé */
.ksm-big-status-text.ksm-pay-status-refused { color: #c53030; } /* Rouge foncé */
.ksm-big-status-text.ksm-pay-status-pending { color: #d69e2e; } /* Jaune/Orange */


/* --- AJUSTEMENTS FOOTER CARTE --- */
.ksm-payout-footer {
    padding-top: 15px;
    border-top: 2px solid #f7fafc;
    display: flex;
    flex-direction: column; /* Pour empiler H2 et Formulaire */
    align-items: center;
}

.ksm-admin-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0; /* Petite séparation entre H2 et Admin */
}

.ksm-payout-select {
    width: 70%; /* Plus large pour l'admin */
}

/* Assurer que la carte a les bonnes bordures */
.ksm-payout-card.ksm-pay-status-paid { border-left-color: #48bb78; }
.ksm-payout-card.ksm-pay-status-refused { border-left-color: #f56565; }
.ksm-payout-card.ksm-pay-status-pending { border-left-color: #ecc94b; }

/* ========================================
   📦 STYLE SHORTCODE [ksm_stockage]
   ======================================== */

.ksm-storage-container {
    max-width: 1000px;
    margin: 30px auto;
}

.ksm-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 26px;
    color: #2d3748;
    margin-bottom: 30px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
    display: inline-block;
}

.ksm-storage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.ksm-storage-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: transform 0.3s ease;
    position: relative;
}

.ksm-storage-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.ksm-storage-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.ksm-storage-icon {
    font-size: 32px;
    color: rgba(255,255,255,0.9);
    width: 32px;
    height: 32px;
}

.ksm-storage-title {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 700;
}

.ksm-storage-body {
    padding: 25px;
}

.ksm-storage-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 15px;
}

.ksm-storage-info-row .label {
    color: #718096;
    font-weight: 500;
}

.ksm-storage-info-row .value {
    color: #2d3748;
    font-weight: 700;
}

.ksm-storage-divider {
    height: 1px;
    background: #edf2f7;
    margin: 15px 0;
}

.ksm-storage-expiry {
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
}

.ksm-storage-expiry .expiry-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    color: #a0aec0;
    font-weight: 600;
    margin-bottom: 5px;
}

.ksm-storage-expiry .expiry-days {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #2d3748;
}

/* Couleurs d'urgence */
.ksm-storage-expiry.warning .expiry-days { color: #dd6b20; } /* Orange */
.ksm-storage-expiry.critical .expiry-days { color: #e53e3e; } /* Rouge */
.ksm-storage-expiry.critical { border-color: #feb2b2; background: #fff5f5; }

.ksm-storage-date-fin {
    text-align: center;
    font-size: 12px;
    color: #a0aec0;
    margin-top: 10px;
    font-style: italic;
}

/* ========================================
   GESTION COMMISSION MANUELLE (ADMIN)
   ======================================== */

.ksm-admin-commission-edit {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #f8fafc !important;
    padding: 6px !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02) !important;
}

.ksm-commission-input {
    width: 90px !important;
    padding: 6px 10px !important;
    border: 1px solid #cbd5e0 !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    color: #e53e3e !important;
    text-align: right !important;
    margin: 0 !important;
    height: 36px !important;
    background: #fff !important;
    box-shadow: none !important;
}

.ksm-commission-input:focus {
    border-color: #667eea !important;
    outline: none !important;
}

.ksm-save-comm-btn {
    background: #48bb78 !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer !important;
    border-radius: 6px !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 5px rgba(72, 187, 120, 0.3) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ksm-save-comm-btn:hover {
    background: #2f855a !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(72, 187, 120, 0.4) !important;
}

/* Force l'affichage des icônes Dashicons quoi qu'il arrive */
.ksm-save-comm-btn.dashicons {
    font-family: 'dashicons' !important;
    font-size: 20px !important;
    text-decoration: none !important;
}

/* ========================================
   ⭐ BOUTON MISE EN AVANT (FEATURED)
   ======================================== */

.ksm-featured-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin-left: 1px; /* Espace après le formulaire de stock */
    border-radius: 50%;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ksm-featured-toggle .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
    line-height: 1;
}

/* État : Actif (Mis en avant) - Or/Jaune */
.ksm-star-active .dashicons {
    color: #f59e0b; /* Jaune doré */
    text-shadow: 0 2px 5px rgba(245, 158, 11, 0.3);
}

.ksm-featured-toggle.ksm-star-active:hover {
    background: rgba(245, 158, 11, 0.1);
    transform: scale(1.2);
}

/* État : Inactif - Gris */
.ksm-star-inactive .dashicons {
    color: #cbd5e0; /* Gris clair */
}

.ksm-featured-toggle.ksm-star-inactive:hover .dashicons {
    color: #f59e0b; /* Devient jaune au survol pour suggérer l'action */
}

.ksm-featured-toggle.ksm-star-inactive:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

/* Animation de chargement */
.ksm-featured-toggle.ksm-loading {
    opacity: 0.6;
    pointer-events: none;
    animation: pulse 1s infinite;
}

/* Mise à jour du conteneur d'actions pour aligner le bouton */
.ksm-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* ========================================
   🧠 KSM SMART AUDIT STYLES
   ======================================== */

.ksm-audit-wrap {
    max-width: 1200px;
}

.ksm-audit-dashboard {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.ksm-audit-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    flex: 1;
    min-width: 300px;
    border: 1px solid #e2e8f0;
}

/* Jauge de Santé */
.ksm-health-card h3, .ksm-cash-card h3 {
    margin-top: 0;
    font-size: 16px;
    color: #4a5568;
    text-transform: uppercase;
    font-weight: 700;
}

.ksm-health-bar-container {
    background: #edf2f7;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin: 15px 0;
}

.ksm-health-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 1s ease-in-out;
}

.ksm-health-details {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.ksm-score-big {
    font-size: 32px;
    font-weight: 900;
}

.ksm-health-label {
    font-size: 14px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
}

/* Trésorerie */
.ksm-cash-amount {
    font-size: 32px;
    font-weight: 900;
    color: #e53e3e;
    margin: 10px 0;
}

/* Tableaux et Badges */
.ksm-audit-row-panier_perce { background-color: #fff5f5; }
.ksm-audit-row-tresor { background-color: #f0fff4; }

.button-small {
    margin-bottom: 4px !important;
}

/* ========================================
   FIX FRONTEND POUR L'AUDIT
   ======================================== */
.ksm-frontend-audit .wp-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border: 1px solid #e2e8f0;
}

.ksm-frontend-audit th {
    text-align: left;
    background: #f8fafc;
    padding: 15px;
    font-weight: 700;
    color: #4a5568;
    border-bottom: 2px solid #edf2f7;
}

.ksm-frontend-audit td {
    padding: 15px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

/* Cacher le titre H1 de l'admin si on est sur le frontend */
.ksm-frontend-audit h1.wp-heading-inline {
    display: none; 
}

/* ========================================
   📦 MODALE COMMANDE (STYLE TEM)
   ======================================== */
.ksm-clickable-order {
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
}
.ksm-clickable-order:hover {
    color: #f75c03; /* Orange Tem */
    transform: translateX(3px);
}
.ksm-open-icon {
    font-size: 15px;
    margin-left: 6px;
    color: #f75c03;
    opacity: 0.7;
}

/* Overlay de la modale */
.ksm-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInModal 0.3s ease;
}

/* Contenu (La Carte) */
.ksm-modal-content {
    background: #ffffff;
    width: 92%;
    max-width: 420px;
    border-radius: 28px; 
    padding: 30px 25px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    animation: slideUpPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Bouton Fermer */
.ksm-modal-close {
    position: absolute;
    top: 15px !important; right: 15px !important;
    background: #fcdcdc !important;
    border: none;
    width: 36px; height: 36px;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #64748b #f1f5f9;
    transition: all 0.2s ease;
}
.ksm-modal-close:hover {
    background: #ff0000 !important; color: #000000 !important; transform: rotate(90deg);
}

/* En-tête */
.ksm-modal-header { text-align: center; margin-bottom: 25px; }
.ksm-modal-icon { font-size: 50px; margin-bottom: 10px; line-height: 1; }
.ksm-modal-header h2 { margin: 0; font-size: 22px; font-weight: 800; color: #1e293b; }

/* Bloc d'informations Client */
.ksm-info-block {
    background: #f8fafc;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 20px;
    border: 2px solid #e2e8f0;
}
.ksm-info-block p { margin: 8px 0; font-size: 15px; color: #334155; }
.ksm-info-block .ksm-label { color: #64748b; margin-right: 5px; }

/* Liste des produits */
.ksm-products-block h4 { margin: 0 0 12px 0; font-size: 16px; font-weight: 800; color: #1e293b; }
.ksm-tem-product-list { list-style: none; padding: 0; margin: 0; max-height: 180px; overflow-y: auto; }
.ksm-tem-product-list li {
    padding: 12px 0;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 14px; color: #475569;
    display: flex; align-items: center; gap: 10px;
}
.ksm-qty-badge {
    background: #fff0e6; color: #f75c03;
    padding: 4px 8px; border-radius: 8px; font-weight: 800; font-size: 13px;
}

/* Bouton d'action vibrant */
.ksm-modal-footer { margin-top: 25px; }
.ksm-btn-tem {
    background: linear-gradient(135deg, #ff8a00 0%, #f75c03 100%);
    color: #ffffff !important;
    border: none;
    padding: 16px 30px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 800;
    width: 100%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    box-shadow: 0 8px 25px rgba(247, 92, 3, 0.35);
    transition: all 0.2s ease;
}
.ksm-btn-tem:hover {
    transform: translateY(-3px); box-shadow: 0 12px 30px rgba(247, 92, 3, 0.45);
}
.ksm-btn-tem.ksm-loading { opacity: 0.7; cursor: wait; }
.ksm-btn-tem.ksm-loading .dashicons { animation: spin 1s linear infinite; }

/* Animations */
@keyframes fadeInModal { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUpPop {
    0% { opacity: 0; transform: translateY(40px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Statut Colis Prêt (Bleu) */
.ksm-order-status-colis-pret {
    border-color: #3b82f6; 
}
.ksm-order-status-colis-pret .ksm-order-status-badge {
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
    color: white;
}

/* Statut Colis Livré (Violet) */
.ksm-order-status-colis-livre {
    border-color: #df32fa; 
}
.ksm-order-status-colis-livre .ksm-order-status-badge {
    background: linear-gradient(135deg, #d883fc 0%, #8d06c7 100%);
    color: white;
}

.ksm-order-meta {
    display: flex;
    align-items: center; /* Aligne verticalement au centre */
    gap: 10px;           /* Espace entre la date et le badge */
    margin-top: 5px;    /* Petit espace sous le titre H3 */
}

/* Optionnel : si vous voulez que le badge soit à l'extrémité droite */

.ksm-order-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === Quick-Edit : groupe auteur + bouton === */
.ksm-card-author-group {
    display: flex !important;
    align-items: center;
    gap: 8px !important;
}

.ksm-quick-edit-trigger {
    background: none !important;
    border: 1px solid #6366f1 !important;
    border-radius: 6px !important;
    color: #6366f1 !important;
    padding: 3px 7px !important;
    cursor: pointer;
    line-height: 1 !important;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
}

.ksm-quick-edit-trigger:hover {
    background: #6366f1 !important;
    color: #fff !important;
}

.ksm-quick-edit-trigger .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}

/* ══════════════════════════════════════════════════════════════════
   BADGE STATUT PAIEMENT — [ksm_ventes_vendeurs] footer carte commande
   ══════════════════════════════════════════════════════════════════ */

.ksm-pay-status-badge {
    display:         inline-flex;
    align-items:     center;
    gap:             4px;
    padding:         5px 12px;
    border-radius:   20px;
    font-size:       12px;
    font-weight:     700;
    white-space:     nowrap;
    letter-spacing:  0.2px;
    border:          1px solid transparent;
    transition:      transform .15s, opacity .15s, box-shadow .15s;
}

/* Couleurs par statut */
.ksm-pay-status-badge.ksm-pay-status-pending {
    background: #fef9c3;
    color:      #713f12;
    border-color: #fde047;
}
.ksm-pay-status-badge.ksm-pay-status-paid {
    background: #dcfce7;
    color:      #14532d;
    border-color: #86efac;
}
.ksm-pay-status-badge.ksm-pay-status-refused {
    background: #fee2e2;
    color:      #7f1d1d;
    border-color: #fca5a5;
}

/* Version bouton (admin) */
button.ksm-pay-status-badge {
    cursor:  pointer;
    outline: none;
    font-family: inherit;
}
button.ksm-pay-status-badge:hover {
    opacity:    .85;
    transform:  scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
button.ksm-pay-status-badge:active {
    transform: scale(.98);
}

/* ══════════════════════════════════════════════════════════════════
   MODAL PAIEMENT VENDEUR  #ksm-payout-modal
   ══════════════════════════════════════════════════════════════════ */

/* Largeur spécifique au modal paiement */
#ksm-payout-modal .ksm-modal-content {
    max-width: 480px;
}

/* Notice "déjà payé" */
.ksm-pm-notice-warning {
    background:   #fffbeb;
    color:        #78350f;
    border:       1px solid #fcd34d;
    border-radius: 8px;
    padding:      10px 14px;
    font-size:    13px;
    font-weight:  600;
    margin-top:   14px;
}

/* Feedback résultat AJAX dans le modal */
.ksm-pm-feedback-msg {
    padding:       10px 14px;
    border-radius: 8px;
    font-size:     13px;
    font-weight:   600;
    border:        1px solid transparent;
}

/* Spin animation pour les icônes en chargement */
.ksm-spin {
    animation: ksm-rotate 1s linear infinite;
    display:   inline-block;
}
@keyframes ksm-rotate {
    from { transform: rotate(0deg);   }
    to   { transform: rotate(360deg); }
}


/* ══════════════════════════════════════════════════════════════════
   BARRE DE FILTRES ADMIN — [ksm_ventes_vendeurs]
   ══════════════════════════════════════════════════════════════════ */

.ksm-vs-admin-filters {
    background:    #ffffff;
    border:        1px solid #e2e8f0;
    border-radius: 14px;
    padding:       18px 20px 14px;
    margin-bottom: 22px;
    box-shadow:    0 2px 8px rgba(0,0,0,.05);
}

/* Ligne de formulaire */
.ksm-vs-filter-form {
    display:   flex;
    flex-wrap: wrap;
    gap:       12px;
    align-items: flex-end;
}

/* Groupe label + select */
.ksm-vs-filter-group {
    display:        flex;
    flex-direction: column;
    gap:            5px;
    flex:           1 1 180px;
    min-width:      160px;
}

.ksm-vs-filter-label {
    font-size:   11px;
    font-weight: 700;
    color:       #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    display:     flex;
    align-items: center;
    gap:         4px;
}
.ksm-vs-filter-label .dashicons {
    font-size: 14px;
    width:     14px;
    height:    14px;
    color:     #6366f1;
}

.ksm-vs-select {
    padding:       8px 10px;
    border:        1px solid #cbd5e1;
    border-radius: 8px;
    font-size:     13px;
    color:         #1e293b;
    background:    #f8fafc;
    cursor:        pointer;
    transition:    border-color .15s, box-shadow .15s;
    width:         100%;
}
.ksm-vs-select:focus {
    outline:      none;
    border-color: #6366f1;
    box-shadow:   0 0 0 3px rgba(99,102,241,.12);
}

/* Boutons filtre / reset */
.ksm-vs-filter-actions {
    display:     flex;
    gap:         8px;
    align-items: flex-end;
    flex-shrink: 0;
    padding-bottom: 1px;
}

.ksm-vs-btn-filter,
.ksm-vs-btn-reset {
    display:       inline-flex;
    align-items:   center;
    gap:           5px;
    padding:       8px 16px;
    border-radius: 8px;
    font-size:     13px;
    font-weight:   600;
    cursor:        pointer;
    text-decoration: none;
    white-space:   nowrap;
    transition:    background .15s, transform .1s;
    border:        none;
}

.ksm-vs-btn-filter {
    background: #6366f1;
    color:      #ffffff;
}
.ksm-vs-btn-filter:hover {
    background: #4f46e5;
    transform:  translateY(-1px);
}

.ksm-vs-btn-reset {
    background: #f1f5f9;
    color:      #475569;
    border:     1px solid #cbd5e1;
}
.ksm-vs-btn-reset:hover {
    background: #e2e8f0;
    color:      #1e293b;
}

/* Tags de filtres actifs */
.ksm-vs-active-filters {
    display:     flex;
    flex-wrap:   wrap;
    gap:         6px;
    align-items: center;
    margin-top:  12px;
    padding-top: 12px;
    border-top:  1px dashed #e2e8f0;
}

.ksm-vs-active-label {
    font-size:   11px;
    font-weight: 700;
    color:       #94a3b8;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-right: 2px;
}

.ksm-vs-tag {
    display:       inline-flex;
    align-items:   center;
    gap:           5px;
    background:    #eef2ff;
    color:         #3730a3;
    border:        1px solid #c7d2fe;
    border-radius: 20px;
    padding:       3px 10px 3px 10px;
    font-size:     12px;
    font-weight:   600;
}
.ksm-vs-tag a {
    color:       #6366f1;
    font-weight: 700;
    font-size:   14px;
    line-height: 1;
    text-decoration: none;
    margin-left: 2px;
}
.ksm-vs-tag a:hover { color: #dc2626; }

/* Compteur de résultats */
.ksm-vs-results-count {
    margin-top:  10px;
    font-size:   12px;
    color:       #94a3b8;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 600px) {
    .ksm-vs-filter-form { flex-direction: column; }
    .ksm-vs-filter-group { flex: 1 1 100%; }
    .ksm-vs-filter-actions { width: 100%; justify-content: flex-start; }
}
