/* Reset et styles de base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

/* En-tête */
header {
    background-color: #2c3e50;
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

h1 {
    font-size: 24px;
    margin-bottom: 5px;
    text-align: center;
}

/* Formulaire de sélection */
.filters {
    background-color: white;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 16px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

/* Résultats */
.results {
    margin-top: 20px;
}

.category {
    background-color: white;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.category-header {
    background-color: #34495e;
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-name {
    font-size: 18px;
    font-weight: 600;
}

.category-total {
    font-weight: bold;
}

.subcategories {
    padding: 0;
}

.subcategory {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.subcategory:last-child {
    border-bottom: none;
}

.subcategory-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.subcategory-name {
    font-weight: 600;
    font-size: 16px;
}

.brand-prices {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
}

.brand-price {
    flex: 1 1 calc(33.333% - 10px);
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.brand-type {
    font-size: 14px;
    color: #555;
    margin-bottom: 5px;
}

.price-value {
    font-weight: bold;
    font-size: 18px;
    color: #2c3e50;
}

.no-data {
    font-style: italic;
    color: #999;
    text-align: center;
    padding: 20px;
}

.price-unit {
    font-size: 14px;
    color: #777;
}

/* Badge pour les types de marques */
.brand-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 5px;
}

.brand-badge.premier-prix {
    background-color: #2ecc71;
    color: white;
}

.brand-badge.marque-distributeur {
    background-color: #f39c12;
    color: white;
}

.brand-badge.marque-nationale {
    background-color: #e74c3c;
    color: white;
}

/* Responsivité */
@media (max-width: 768px) {
    .brand-prices {
        flex-direction: column;
    }
    
    .brand-price {
        flex: 1 1 100%;
    }
    
    .category-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .category-total {
        margin-top: 5px;
    }
}

/* Mise en page pour les informations complémentaires */
.info-section {
    margin-top: 30px;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.info-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
}

.info-content {
    font-size: 14px;
    color: #555;
}

/* Pied de page */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
    color: #777;
    font-size: 14px;
    border-top: 1px solid #eee;
}

/* Styles pour les éléments cliquables */
.clickable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.clickable:hover {
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: 4px;
}

/* Styles pour les prix estimés */
.estimated-price {
    color: #e67e22;
}

.estimated-indicator {
    font-size: 0.9em;
    color: #e67e22;
    margin-left: 5px;
}

.estimated-price-legend {
    margin-top: 5px;
    font-size: 14px;
    color: #666;
}

.category-estimated-indicator,
.subcategory-estimated-indicator {
    font-size: 0.8em;
    vertical-align: super;
    color: #e67e22;
    margin-left: 5px;
}

.estimated-warning {
    margin-top: 10px;
    padding: 5px 10px;
    background-color: #fff3e0;
    border-left: 3px solid #e67e22;
    border-radius: 4px;
    color: #e67e22;
}

.estimated-row {
    background-color: #fff3e0 !important;
}

/* Styles pour la fenêtre modale */
.price-details-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
}

#modal-title {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

#price-summary {
    margin-bottom: 20px;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
}

.summary-info p {
    margin: 5px 0;
}

#price-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#price-details-table th,
#price-details-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

#price-details-table th {
    background-color: #f2f2f2;
    position: sticky;
    top: 0;
}

#price-details-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

#price-details-table tr:hover {
    background-color: #f1f1f1;
}

.info-message {
    background-color: #e7f3fe;
    padding: 15px;
    border-left: 4px solid #2196F3;
    margin-bottom: 15px;
}

.temporarily-hidden {
    display: none !important;
}

.error {
    background-color: #ffebee;
    padding: 15px;
    border-left: 4px solid #f44336;
    margin-bottom: 15px;
    color: #b71c1c;
}

/* Styles pour le prix total du panier */
.basket-price {
    background-color: #34495e;
    color: white;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.basket-title {
    font-size: 18px;
    font-weight: 600;
    margin-right: 15px;
}

.basket-total {
    font-size: 24px;
    font-weight: 700;
}

.basket-brand-totals {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px 0;
}

.basket-brand-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.basket-brand-label {
    font-size: 14px;
    font-weight: 600;
}

.basket-brand-value {
    font-weight: 700;
    font-size: 20px;
    padding: 5px 10px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.2);
}

.basket-info {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.8;
}

/* Styles spécifiques aux types de marques */
.basket-brand-total:nth-child(1) .basket-brand-value {
    background-color: rgba(46, 204, 113, 0.3);
}

.basket-brand-total:nth-child(2) .basket-brand-value {
    background-color: rgba(243, 156, 18, 0.3);
}

.basket-brand-total:nth-child(3) .basket-brand-value {
    background-color: rgba(231, 76, 60, 0.3);
}

/* Responsive pour les prix du panier */
@media (max-width: 600px) {
    .basket-brand-totals {
        flex-direction: column;
        gap: 10px;
    }
    
    .basket-brand-total {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        padding: 0 15px;
    }
    
    .basket-brand-value {
        min-width: 100px;
        text-align: right;
    }
}

/* Styles pour la fenêtre popup d'information */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.popup-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 80%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.popup-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.popup-message {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.popup-close {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s;
}

.popup-close:hover {
    background-color: #2980b9;
}

@media (max-width: 768px) {
    .popup-content {
        max-width: 95%;
        padding: 15px;
    }
    
    .popup-title {
        font-size: 18px;
    }
    
    .popup-message {
        font-size: 14px;
    }
}

/* Styles pour l'icône flottante de défilement vers le bas */
.scroll-down-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #3498db;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-down-icon:hover {
    background-color: #2980b9;
    transform: scale(1.1);
}

.scroll-down-icon svg {
    width: 25px;
    height: 25px;
}

@media (max-width: 768px) {
    .scroll-down-icon {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
    }
    
    .scroll-down-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* Styles pour les liens vers OpenFoodFacts */
.product-link {
    color: #3498db;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
}

.product-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.external-link-icon {
    font-size: 0.8em;
    margin-left: 5px;
    opacity: 0.7;
}

.product-link:hover .external-link-icon {
    opacity: 1;
}