/* WP Comparator Frontend Styles */

.wp-comparator-grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.wp-comparator-grid-container-Box {
    display: grid;
    gap: 2rem;
}

/* Layout en 2 colonnes stables dès tablette: sidebar filtres fixe + contenu flexible */
@media only screen and (min-width: 768px) {
    .wp-comparator-grid-container-Box {
        grid-template-columns: 340px 1fr;
        align-items: start;
    }
}

.comparator-header {
    text-align: center;
    margin-bottom: 30px;
}

.comparator-header h2 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #333;
}

.comparator-description {
    font-size: 1.1em;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* Filtres */
.comparator-filters {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.comparator-filters h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Filtre catégorie de contrat (en haut) */
.filter-contract-category {
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
}

.filter-contract-category label {
    font-weight: 600;
    color: #0073aa;
    font-size: 16px;
}

/* Groupes de filtres par catégorie */
.filter-category-group {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.filter-category-title {
    margin: 0 0 15px 0;
    font-weight: 600;
    color: #0073aa;
    font-size: 16px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 8px;
}

.filter-category-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

/* Stabiliser le nombre de colonnes par breakpoint pour éviter les reflows à quelques pixels près */
@media only screen and (min-width: 768px) {
    .filter-category-fields {
        //grid-template-columns: repeat(2, 1fr);
    }
}

@media only screen and (min-width: 1024px) {
    .filter-category-fields {
       // grid-template-columns: repeat(3, 1fr);
    }
}

.filter-sub-group {
    margin-left: 0;
}

.filter-sub-group label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-group label,
.checkbox-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    margin-bottom: 0;
}

.radio-group input,
.checkbox-group input {
    margin-right: 8px;
}

.filter-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.results-count {
    font-weight: 600;
    color: #0073aa;
    font-size: 14px;
}

/* Grille des éléments */
.comparator-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;

}

.comparator-grid[data-columns="2"] {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.comparator-grid[data-columns="3"] {
    //grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
  align-content: start; 
}
@media only screen and (min-width: 768px) {
.comparator-grid[data-columns="3"] {
    //grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
  align-content: start; 
}
}

.comparator-grid[data-columns="4"] {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.comparator-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.comparator-item:hover {
    transform: translateY(-2px);
}

.item-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s ease;
    position: relative;
    overflow: visible;
}

.item-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.item-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 8px rgba(40, 167, 69, 0.4);
    z-index: 10;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 3px 8px rgba(40, 167, 69, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(40, 167, 69, 0.6);
    }
}

.item-header {
    text-align: center;
    margin-bottom: 15px;
}

.item-categories {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
     display: none;
}

.category-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid #bbdefb;
}

.item-logo {
    margin-bottom: 10px;
}

.item-logo img {
    max-width: 120px;
    max-height: 60px;
    object-fit: contain;
}

.item-title {
    font-size: 1.3em;
    margin: 0;
    color: #333;
    font-weight: 600;
}

.item-description {
    flex-grow: 1;
    margin-bottom: 20px;
    display: none;
}

.item-description p {
    color: #666;
    line-height: 1.5;
    margin: 0;
}

.item-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.compare-checkbox {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.compare-checkbox:hover {
    background: #e9ecef;
}

.compare-checkbox input[type="checkbox"] {
    margin-right: 10px;
}

.checkmark {
    font-weight: 600;
    color: #0073aa;
}

.button-view-single,
.button-external,
.button-document {
    display: inline-block;
    padding: 8px 16px;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.button-view-single {
    background: #0073aa;
    color: white;
}

.button-view-single:hover {
    background: #005a87;
    color: white;
}

.button-external {
    background: #28a745;
    color: white;
}

.button-external:hover {
    background: #218838;
    color: white;
}

.button-document {
    background: #dc3545;
    color: white;
    display: none;
}

.button-document:hover {
    background: #c82333;
    color: white;
}

/* Section de comparaison */
.comparison-section {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #0073aa;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,115,170,0.1);
}

.comparison-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.comparison-info h3 {
    margin: 0 0 10px 0;
    color: #0073aa;
    font-size: 1.4em;
    font-weight: 600;
}

.selected-count {
    display: block;
    font-weight: 600;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.selection-help {
    display: block;
    color: #666;
    font-size: 0.95em;
    font-style: italic;
}

.comparison-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.button-large {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.button-large:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.button-large:disabled,
.button-large.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-primary,
.button-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-primary,
.button-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-primary {
    background: #0073aa;
    color: white;
}

.button-primary:hover {
    background: #005a87;
}

.button-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.button-secondary {
    background: #f1f1f1;
    color: #333;
}

.button-secondary:hover {
    background: #e1e1e1;
}

/* Messages d'état */
.no-items {
    text-align: center;
    font-size: 1.1em;
    color: #666;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Styles pour la page single */
.wp-comparator-single-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.item-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-grow: 1;
}

.item-header .item-logo img {
    max-width: 150px;
    max-height: 80px;
    margin-bottom: 15px;
}

.item-header .item-title {
    font-size: 1.2em;
    margin: 0 0 15px 0;
    color: #333;
}

.item-header .item-description {
    font-size: 1.1em;
    color: #666;
    max-width: 600px;
    margin: 0 auto 20px auto;
}

.item-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.category-section {
    margin-bottom: 40px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    //overflow: hidden;
}

.category-title {
    background: #f8f9fa;
    margin: 0;
    padding: 20px;
    position: relative; /* ancre des tooltips de catégories */
}

.field-column,
.item-column {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 60px;
    position: relative; /* ancre des tooltips de champs en comparaison */
}

.field-column {
    background: #f1f3f4;
    border-right: 2px solid #e9ecef;
    font-weight: 600;
    color: #333;
}

.field-row:last-child {
    border-bottom: none;
}

.field-label {
    flex: 0 0 300px;
    padding: 20px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #333;
    position: relative; /* ancre des tooltips de champs en page single */
}

.field-value {
    flex: 1;
    padding: 20px;
    //display: flex;
    align-items: center;
    color: #666;
    line-height: 1.5;
}

.field-more-info {
    margin-top: 10px;
}

.btn-more-info {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 0;
}

.btn-more-info:hover {
    color: #005a87;
}

.btn-more-info {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 0;
}

.more-info-content {
    display: none !important;
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.more-info-content.show {
    display: block !important;
}

/* Styles pour la page de comparaison */
.wp-comparator-compare-page .more-info-content {
    display: none;
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.wp-comparator-compare-page .more-info-content.show {
    display: block !important;
}

.wp-comparator-compare-page .btn-more-info {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 0;
    margin-top: 8px;
}

.wp-comparator-compare-page .btn-more-info:hover {
    color: #005a87;
}




.comparator-actions {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.button-back,
.button-compare {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    margin: 0 10px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.button-back {
    background: #6c757d;
    color: white;
}

.button-back:hover {
    background: #5a6268;
    color: white;
}

.button-compare {
    background: #28a745;
    color: white;
}

.button-compare:hover {
    background: #218838;
    color: white;
}

.no-data-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1em;
}

.info-tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 5px;
    background: #333;
    color: white;
    padding: 0;
    border-radius: 6px;
    font-size: 14px;
    max-width: 300px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    line-height: 1.4;
    display: none;
    cursor: default;
}

.info-tooltip-header {
    background: #444;
    padding: 8px 12px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #555;
}

.info-tooltip-content {
    padding: 10px 12px;
}

.info-tooltip-close {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.info-tooltip-close:hover {
    background: #666;
    color: white;
}

.info-btn,
.info-btn-small {
    background: none;
    border: none;
    cursor: pointer;
    color: #0073aa;
    padding: 0;
    display: inline-flex;
    align-items: center;
    font-size: 16px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    justify-content: center;
    transition: all 0.2s ease;
}

.info-btn:hover,
.info-btn-small:hover {
    background: #0073aa;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .wp-comparator-grid-container {
        padding: 15px;
    }
    
    .comparator-header h2 {
        font-size: 2em;
    }
    
    .filter-category-fields {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .comparator-grid {
        grid-template-columns: 1fr;
    }
    
    .comparison-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .comparison-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .button-large {
        width: 100%;
        justify-content: center;
    }
    
    .item-actions {
        gap: 8px;
    }
    
    .button-view-single,
    .button-external,
    .button-document {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .field-row {
        flex-direction: column;
    }
    
    .field-label {
        flex: none;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .field-value {
        flex: none;
    }
    
    .item-header .item-title {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .item-card {
        padding: 15px;
    }
    
    .item-title {
        font-size: 1.1em;
    }
    
    .comparison-section {
        margin-top: 20px;
        padding: 20px 15px;
    }
}