/**
 * Styles pour le plugin Marché Bio
 */

/* Styles généraux */
.mb-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Bande verte en haut avec le bouton d'ajout */
.mb-archive-header {
  background-color: #6e9f33;
  padding: 20px;
  margin-top: 30px !important;
  margin-bottom: 30px !important;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.mb-archive-title {
  color: white !important;
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.mb-archive-actions {
  display: flex;
  align-items: center;
}

/* CORRECTION: Inverser les couleurs du bouton dans la bande verte */
.mb-archive-header .mb-archive-actions .mb-button,
.mb-archive-header .mb-archive-actions a.mb-button,
.mb-archive-header .mb-button.mb-button-action,
.mb-archive-header a.mb-button.mb-button-action {
  background-color: #3F6731 !important;
  color: white !important;
  padding: 10px 20px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid white !important;
}

/* État au survol */
.mb-archive-header .mb-archive-actions .mb-button:hover,
.mb-archive-header .mb-archive-actions a.mb-button:hover,
.mb-archive-header .mb-button.mb-button-action:hover,
.mb-archive-header a.mb-button.mb-button-action:hover {
  background-color: #345a2a !important;
  color: white !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Description de terme de taxonomie */
.mb-term-description {
  background-color: #f8f9fa;
  padding: 20px;
  margin-bottom: 30px;
  border-radius: 5px;
  border-left: 4px solid #6e9f33;
}

.mb-term-description h2 {
  margin-top: 0;
  color: #3F6731;
}

/* Styles pour la pagination */
.mb-pagination {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    padding: 0;
    list-style: none;
}

.mb-pagination li {
    margin: 0 5px;
}

.mb-pagination a,
.mb-pagination span {
    display: block;
    padding: 8px 15px;
    border-radius: 4px;
    background-color: #f5f5f5;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.mb-pagination a:hover {
    background-color: #6e9f33;
    color: white;
}

.mb-pagination .current {
    background-color: #3F6731;
    color: white;
}

.mb-pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Grille des catégories */
.mb-categories-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-gap: 20px !important;
    margin: 30px 0 !important;
}

.mb-category-card {
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.mb-category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.mb-category-image {
    height: 200px;
    background-size: cover;
    background-position: center;
}

.mb-category-title {
    padding: 15px;
    margin: 0;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* Grille des offres */
.mb-offers-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-gap: 25px !important;
    margin: 30px 0 !important;
}

.mb-offer-card {
    border: none !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08) !important;
    background: white !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.mb-offer-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 15px 30px rgba(0,0,0,0.12) !important;
}

.mb-offer-image {
    height: 200px !important;
    overflow: hidden !important;
}

.mb-offer-image img {
    width: 100% !important;
    height: 200px !important;
    object-fit: cover !important;
    transition: transform 0.5s ease !important;
}

.mb-offer-card:hover .mb-offer-image img {
    transform: scale(1.05) !important;
}

.mb-offer-content {
    padding: 20px !important;
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.mb-offer-type {
    display: inline-block;
    background-color: #3F6731;
    color: white !important;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.mb-achat .mb-offer-type {
    background: #2196F3;
}

.mb-offer-title {
    font-size: 18px !important;
    margin-top: 0 !important;
    margin-bottom: 15px !important;
    color: #333 !important;
    font-weight: 600 !important;
}

.mb-offer-info {
    margin-bottom: 15px !important;
    color: #666 !important;
    font-size: 14px !important;
    flex-grow: 1;
    padding: 0 15px 15px;
}

.mb-offer-info div,
.mb-offer-category,
.mb-offer-quantity,
.mb-offer-zone,
.mb-offer-date {
    margin-bottom: 5px;
}

.mb-offer-link {
    margin-top: auto !important;
    text-align: center !important;
    padding: 15px;
    border-top: 1px solid #eaeaea;
}

/* MISE À JOUR: correction des couleurs pour les boutons standards */
.mb-button,
.mb-offer-link .mb-button,
div.mb-offer-link > a.mb-button,
a.mb-button:not(.mb-archive-header .mb-button) {
    background-color: #3f6731 !important;
    color: white !important;
    padding: 8px 15px !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    display: block;
    width: 100%;
}

.mb-button:hover,
.mb-offer-link .mb-button:hover {
    background-color: #5c8929 !important;
}

/* Pagination améliorée */
.mb-pagination {
    margin: 40px 0 !important;
    display: flex !important;
    justify-content: center !important;
}

.mb-pagination .page-numbers {
    display: inline-block !important;
    margin: 0 5px !important;
    padding: 8px 15px !important;
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    text-decoration: none !important;
    color: #333 !important;
    transition: all 0.3s ease !important;
}

.mb-pagination .page-numbers.current {
    background-color: #6e9f33 !important;
    border-color: #6e9f33 !important;
    color: white !important;
}

.mb-pagination .page-numbers:hover:not(.current) {
    background-color: #f5f5f5 !important;
}

/* Message d'information */
.mb-notice {
    padding: 15px 20px;
    border-radius: 5px;
    margin: 20px 0;
    background: #f5f5f5;
    border-left: 4px solid #ccc;
}

.mb-notice-info {
    background-color: #e8f4fd;
    border-left: 4px solid #3498db;
    color: #2980b9;
}

.mb-notice-success {
    background: #f0f9f0;
    border-left-color: #4CAF50;
    color: #2c7a2c;
}

.mb-notice-error {
    background: #fff6f6;
    border-left-color: #ff6b6b;
    color: #cc5555;
}

/* RÈGLES SPÉCIFIQUES POUR LE PLUGIN MARCHÉ BIO - VERSION PLUS PRÉCISE */
/* Ces sélecteurs sont hautement spécifiques pour éviter les conflits */
.mb-offer-card .mb-offer-title a,
.mb-category-card .mb-category-title a,
.mb-offer-single .mb-offer-title a,
.mb-certificate-link a,
.mb-offer-link a:not(.mb-button),
.page-template-mb-archive .mb-offer-title a,
.page-template-mb-archive .mb-category-title a,
.mb-single-template .mb-offer-title a,
.mb-single-template .mb-category-title a {
    color: #333 !important;
    text-decoration: none !important;
}

.mb-offer-card .mb-offer-title a:hover,
.mb-category-card .mb-category-title a:hover,
.mb-offer-single .mb-offer-title a:hover,
.mb-certificate-link a:hover,
.mb-offer-link a:not(.mb-button):hover,
.page-template-mb-archive .mb-offer-title a:hover,
.page-template-mb-archive .mb-category-title a:hover,
.mb-single-template .mb-offer-title a:hover,
.mb-single-template .mb-category-title a:hover {
    color: #3F6731 !important;
    opacity: 0.9 !important;
    text-decoration: none !important;
}

/* RÈGLES SPÉCIFIQUES POUR LE TEXTE DES BOUTONS DU PLUGIN MARCHÉ BIO */
a.mb-button,
.mb-button,
.mb-offer-link a.mb-button,
div.mb-offer-link > a.mb-button,
a[href*="offre-vente"].mb-button,
a[href*="soumettre-une-offre"].mb-button,
.mb-archive-actions a.mb-button,
html body a[class*="mb-button"],
html body div[class*="mb-offer"] a[class*="mb-button"] {
    color: white !important;
    text-decoration: none !important;
}

/* Style au survol pour le texte des boutons */
a.mb-button:hover,
.mb-button:hover,
.mb-offer-link a.mb-button:hover,
div.mb-offer-link > a.mb-button:hover,
a[href*="offre-vente"].mb-button:hover,
a[href*="soumettre-une-offre"].mb-button:hover,
.mb-archive-actions a.mb-button:hover,
html body a[class*="mb-button"]:hover,
html body div[class*="mb-offer"] a[class*="mb-button"]:hover {
    color: white !important;
    opacity: 0.9 !important;
    text-decoration: none !important;
}

/* Correction spécifique pour les formulaires du plugin */
.mb-form input::placeholder,
.mb-form textarea::placeholder {
    text-transform: none !important;
}

/* Page de détail d'offre */
.mb-offer-details {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.mb-offer-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.mb-offer-thumbnail {
    flex: 0 0 150px;
    margin-right: 20px;
}

.mb-offer-thumbnail img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.mb-offer-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eaeaea;
}

.mb-offer-section:last-child {
    border-bottom: none;
}

.mb-offer-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #4CAF50;
}

.mb-info-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    grid-gap: 15px !important;
    margin: 30px 0 !important;
}

.mb-info-item {
    margin-bottom: 10px;
}

.mb-info-label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.mb-info-value {
    color: #333;
}

.mb-description-content {
    line-height: 1.6;
}

.mb-certificate-link a {
    display: inline-block;
    padding: 8px 15px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #ddd;
    transition: all 0.3s ease;
}

.mb-certificate-link a:hover {
    background: #eaeaea;
}

/* Formulaires - Styles améliorés */
.mb-form {
    max-width: 600px;
    margin: 30px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    font-family: Arial, sans-serif;
}

.mb-form-title {
    text-align: center;
    font-size: 28px;
    color: #4CAF50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eaeaea;
}

.mb-form-section {
    margin-bottom: 20px;
}

.mb-form-section-title {
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
}

.mb-form-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 15px;
    gap: 20px;
}

.mb-form-group {
    flex: 1 0 200px;
    margin-bottom: 20px;
}

.mb-form-group label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.mb-form-group input[type="text"],
.mb-form-group input[type="email"],
.mb-form-group input[type="password"],
.mb-form-group input[type="tel"],
.mb-form-group input[type="number"],
.mb-form-group select,
.mb-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    margin-top: 5px;
    background-color: #f9f9f9;
}

.mb-form-group input[type="text"]:focus,
.mb-form-group input[type="email"]:focus,
.mb-form-group input[type="password"]:focus,
.mb-form-group input[type="tel"]:focus,
.mb-form-group input[type="number"]:focus,
.mb-form-group select:focus,
.mb-form-group textarea:focus {
    border-color: #4CAF50;
    outline: none;
    background-color: #fff;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.2);
}

.mb-form-group input[type="file"] {
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
    background: #f9f9f9;
    width: 100%;
}

.mb-form-submit {
    margin-top: 20px;
    text-align: center;
}

.mb-form-submit button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s ease;
}

.mb-form-submit button:hover {
    background-color: #45a049;
}

.mb-form-submit button:disabled {
    background-color: #ccc;
}

/* Styles pour les erreurs de validation */
.mb-field-error {
    border-color: #ff6b6b !important;
}

.mb-error-message {
    color: #ff6b6b;
    font-size: 14px;
    margin-top: 5px;
    font-weight: 600;
}

/* Message d'information amélioré */
.mb-notice {
    padding: 15px 20px;
    border-radius: 5px;
    margin: 20px 0;
    background: #f5f5f5;
    border-left: 4px solid #ccc;
    font-size: 16px;
}

.mb-notice-info {
    background-color: #e8f4fd;
    border-left: 4px solid #3498db;
    color: #2980b9;
}

.mb-notice-success {
    background: #f0f9f0;
    border-left-color: #4CAF50;
    color: #2c7a2c;
}

.mb-notice-error {
    background: #fff6f6;
    border-left-color: #ff6b6b;
    color: #cc5555;
}

/* Liens entre connexion et inscription */
.mb-form-links {
    text-align: center;
    margin-top: 20px;
}

.mb-form-links a {
    color: #4CAF50;
    text-decoration: none;
    font-size: 16px;
}

.mb-form-links a:hover {
    text-decoration: underline;
}

/* Styles pour le spinner de chargement */
.mb-loading-spinner {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.mb-loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles pour la popup de succès */
#mb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
}

#mb-success-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    max-width: 500px;
    width: 90%;
    display: none;
}

.mb-popup-content {
    text-align: center;
}

.mb-popup-content h3 {
    color: #3f6731;
    margin-top: 0;
    margin-bottom: 15px;
}

.mb-popup-content p {
    margin-bottom: 20px;
    line-height: 1.5;
}

#mb-popup-close {
    padding: 8px 20px;
    background: #3f6731;
    border: none;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#mb-popup-close:hover {
    background: #2a4621;
}

/* Responsive */
@media (max-width: 992px) {
    .mb-offers-grid,
    .mb-categories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .mb-categories-grid {
        grid-template-columns: 1fr !important;
    }
    
    .mb-offers-grid {
        grid-template-columns: 1fr !important;
    }
    
    .mb-info-grid {
        grid-template-columns: 1fr !important;
    }
  
    .mb-archive-header {
        flex-direction: column;
        text-align: center;
    }
  
    .mb-archive-title {
        margin-bottom: 15px;
    }
    
    /* Corrections de mise en page verticale */
    .mb-offer-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .mb-offer-thumbnail {
        margin-right: 0 !important;
        margin-bottom: 15px !important;
        width: 100% !important;
    }
    
    .mb-form-row {
        flex-direction: column;
    }
    
    .mb-form-group {
        flex: 1 0 100%;
    }
    
    #mb-success-popup {
        width: 95%;
        padding: 20px;
    }
    
    .mb-form {
        padding: 20px;
    }

    .mb-form-title {
        font-size: 24px;
    }

    .mb-form-group input[type="text"],
    .mb-form-group input[type="email"],
    .mb-form-group input[type="password"],
    .mb-form-group input[type="tel"],
    .mb-form-group textarea {
        padding: 10px;
    }

    .mb-form-submit button {
        padding: 12px;
    }
}
