/* KAP - Korence Add Product Styles */

/* Styles existants ... (non modifiés, juste pour le contexte) */
.kap-form-container,
.kap-products-list-container {
    box-sizing: border-box;
    width: 100%;
    max-width: 700px; 
    margin: 20px auto;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.kap-form-container h2,
.kap-products-list-container h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.8em;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.kap-form-field {
    margin-bottom: 15px;
}

.kap-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.kap-form-field input[type="text"],
.kap-form-field input[type="number"],
.kap-form-field input[type="file"],
.kap-form-field select,
.kap-form-field textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}

.kap-form-field input[type="file"] {
    padding: 3px;
}

.kap-form-field textarea {
    min-height: 80px;
    resize: vertical;
}

.kap-required {
    color: #d9534f;
}

.kap-image-preview {
    margin-top: 10px;
    border: 1px dashed #ccc;
    padding: 10px;
    min-height: 50px;
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
}

.kap-image-preview img {
    max-width: 100px;
    max-height: 100px;
    border: 1px solid #eee;
    border-radius: 4px;
    object-fit: cover; 
}

.kap-submit-button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background-color: #0073aa; 
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.kap-submit-button:hover {
    background-color: #005a87;
}

.kap-message {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: center;
}
.kap-message.kap-error {
    color: #a94442;
    background-color: #f2dede;
    border-color: #ebccd1;
}
.kap-message.kap-success {
    color: #3c763d;
    background-color: #dff0d8;
    border-color: #d6e9c6;
}
.kap-message.kap-info,
.kap-message.kap-warning { 
    color: #31708f;
    background-color: #d9edf7;
    border-color: #bce8f1;
}

/* Styles pour les filtres */
.kap-filters-container {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px; /* Espace entre les éléments du filtre */
}

.kap-filter-label {
    font-weight: bold;
    color: #555;
    margin-right: 5px;
    flex-shrink: 0; /* Empêche le label de rétrécir */
}

.kap-filter-button {
    padding: 6px 10px; /* Padding légèrement réduit pour mobile */
    text-decoration: none;
    border: 1px solid #ccc;
    background-color: #f7f7f7;
    color: #0073aa;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background-color 0.3s, border-color 0.3s;
    white-space: nowrap; /* Empêche le texte du bouton de passer à la ligne */
}

.kap-filter-button:hover,
.kap-filter-button:focus {
    background-color: #e9e9e9;
    border-color: #bbb;
    color: #005a87;
}

.kap-filter-button.active {
    background-color: #0073aa;
    color: white;
    border-color: #005a87;
    font-weight: bold;
}


.kap-products-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kap-product-item {
    display: flex;
    flex-wrap: wrap; 
    align-items: center;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 15px;
    padding: 15px;
    gap: 15px; 
}

.kap-product-item-thumbnail {
    flex-basis: 60px; /* Miniature légèrement plus petite sur mobile */
    flex-shrink: 0;
    height: 60px;
}
.kap-product-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
}

.kap-product-item-details {
    flex-grow: 1;
    flex-basis: calc(100% - 60px - 2*15px); 
}

@media (min-width: 480px) { 
    .kap-product-item-thumbnail {
        flex-basis: 80px;
        height: 80px;
    }
    .kap-product-item-details {
        flex-basis: calc(100% - 80px - 130px - 3*15px);
    }
}


.kap-product-item-details .kap-product-title {
    margin: 0 0 5px 0;
    font-size: 1.1em; /* Titre légèrement plus petit sur mobile */
}
.kap-product-item-details .kap-product-title a {
    text-decoration: none;
    color: #0073aa;
}
.kap-product-item-details .kap-product-title a:hover {
    text-decoration: underline;
}

.kap-product-item-details .kap-product-price {
    margin: 0 0 5px 0;
    font-weight: bold;
    color: #444;
    font-size: 0.95em;
}

.kap-product-item-details .kap-product-status,
.kap-product-item-details .kap-product-author {
    margin: 0 0 3px 0; 
    font-size: 0.85em; /* Méta-infos plus petites sur mobile */
    color: #777;
}
.kap-product-item-details .kap-product-status span,
.kap-product-item-details .kap-product-author span {
    font-weight: bold;
    color: #555;
    background-color: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 1em; /* Relatif à son parent (0.85em) */
}

.kap-product-item-actions {
    flex-basis: 100%; 
    margin-top: 10px; 
    text-align: center; 
    display: flex;
    flex-direction: row; 
    justify-content: center; 
    gap: 8px;
}

.kap-product-item-actions .kap-no-actions {
    font-size: 0.9em;
    color: #999;
    padding: 8px 12px;
}


@media (min-width: 480px) { 
    .kap-product-item-actions {
        flex-basis: 130px; 
        flex-shrink: 0;
        text-align: right; 
        margin-top: 0;
        justify-content: flex-end; 
    }
    .kap-product-item-details .kap-product-title {
        font-size: 1.2em; /* Retour à la taille normale */
    }
    .kap-product-item-details .kap-product-price {
        font-size: 1em; /* Retour à la taille normale */
    }
     .kap-product-item-details .kap-product-status,
    .kap-product-item-details .kap-product-author {
        font-size: 0.9em; /* Retour à la taille normale */
    }
}


.kap-action-button {
    display: inline-block;
    padding: 8px 10px; /* Padding légèrement réduit pour mobile */
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85em; /* Texte des boutons plus petit sur mobile */
    text-align: center;
    border: 1px solid transparent;
    transition: opacity 0.2s ease;
    flex-grow: 1; 
    white-space: nowrap;
}
@media (min-width: 480px) {
    .kap-action-button {
        flex-grow: 0; 
        font-size: 0.9em; /* Retour à la taille normale */
        padding: 8px 12px;
    }
}


.kap-edit-button {
    background-color: #ffba00; 
    color: #333;
    border-color: #e9a900;
}

.kap-delete-button {
    background-color: #d9534f; 
    color: white;
    border-color: #c9302c;
}

/* Styles pour la pagination (Mobile First) */
.kap-pagination {
    margin-top: 30px;
    text-align: center;
    padding: 0 10px; /* Ajout de padding horizontal pour éviter que ça colle aux bords */
}

.kap-pagination ul.page-numbers {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex; /* Utiliser flex pour un meilleur contrôle */
    flex-wrap: wrap; /* Permettre le retour à la ligne sur mobile */
    justify-content: center; /* Centrer les numéros de page */
    gap: 5px; /* Espace entre les numéros de page */
}

.kap-pagination ul.page-numbers li {
    display: inline; /* Les li sont inline, le flex est sur le ul */
    /* margin: 0 2px; Supprimé, gap sur ul gère l'espacement */
}

.kap-pagination .page-numbers {
    display: inline-block;
    padding: 6px 10px; /* Padding réduit pour mobile */
    border: 1px solid #ddd;
    color: #0073aa;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
    font-size: 0.9em; /* Taille de police légèrement réduite pour mobile */
    line-height: 1.5; /* Assurer une bonne hauteur de ligne */
}

.kap-pagination .page-numbers:hover,
.kap-pagination .page-numbers:focus {
    background-color: #f0f0f0;
    border-color: #ccc;
}

.kap-pagination .page-numbers.current {
    background-color: #0073aa;
    color: white;
    border-color: #005a87;
    cursor: default;
    font-weight: bold;
}

.kap-pagination .page-numbers.dots {
    border: none;
    background: none;
    padding: 6px 4px; /* Padding ajusté */
}

/* Media Queries pour tablettes et ordinateurs */
@media (min-width: 600px) {
    .kap-form-field {
        display: flex;
        align-items: flex-start; 
    }
    .kap-form-field label {
        flex-basis: 200px; 
        flex-shrink: 0;
        margin-right: 15px;
        text-align: right;
        padding-top: 10px; 
    }
    .kap-form-field input[type="text"],
    .kap-form-field input[type="number"],
    .kap-form-field input[type="file"],
    .kap-form-field select,
    .kap-form-field textarea,
    .kap-form-field .kap-image-preview {
        flex-grow: 1;
    }
    .kap-form-field .kap-image-preview {
         margin-top: 0; 
    }

    .kap-submit-button {
        width: auto;
        float: right; 
    }
    .kap-form-field:last-of-type::after { 
        content: "";
        display: table;
        clear: both;
    }

    .kap-product-item {
        flex-wrap: nowrap; 
    }
     .kap-product-item-actions {
        flex-direction: row; 
        justify-content: flex-end; 
    }
    .kap-product-item-details { 
        flex-basis: calc(100% - 80px - 130px - 3*15px);
    }

    /* Styles de pagination pour écrans plus larges (si besoin d'ajustements spécifiques) */
    .kap-pagination .page-numbers {
        padding: 8px 12px; /* Retour au padding original */
        font-size: 1em; /* Retour à la taille de police originale */
    }
    .kap-pagination ul.page-numbers {
        gap: 8px; /* Espace légèrement plus grand */
    }
}

.kap-form-field .select2-container {
    width: 100% !important; 
}

.kap-form-field .select2-container .select2-selection--multiple {
    border: 1px solid #ccc;
    border-radius: 4px;
    min-height: 40px; 
}

/* Styles pour le bouton de duplication */
.kap-duplicate-container {
    margin: 20px 0;
    text-align: center; /* Centrer le bouton */
}

a.kap-duplicate-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #5cb85c; /* Vert succès */
    color: white;
    border: 1px solid #4cae4c;
    border-radius: 4px;
    font-size: 1.1em;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

a.kap-duplicate-button:hover,
a.kap-duplicate-button:focus {
    background-color: #449d44;
    color: white;
    border-color: #398439;
}