/* Styles pour le système de catégories */
.categories-tree {
    margin: 15px 0;
    position: relative;
}

.categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.categories-list li {
    margin: 5px 0;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: var(--text-color);
    text-decoration: none;
}

.category-item:hover {
    background-color: #f5f5f5;
}

.category-item.active {
    background-color: #e8f4ff;
    font-weight: 600;
}

.category-toggle {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    color: var(--primary-color);
    transition: transform 0.3s ease;
    position: relative;
}

.category-toggle.has-children::before {
    content: '▶';
    font-size: 12px;
    transition: transform 0.3s ease;
}

.category-toggle.expanded.has-children::before {
    transform: rotate(90deg);
}

.category-toggle.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.category-name {
    flex: 1;
}

.subcategories-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: 20px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.subcategories-container.expanded {
    max-height: 1000px;
    opacity: 1;
    transform: translateY(0);
}

.loading {
    color: #666;
    padding: 10px;
    text-align: center;
    font-style: italic;
}

.empty {
    color: #666;
    padding: 10px;
    text-align: center;
    font-style: italic;
}

.error {
    padding: 10px;
}

.error-message {
    background-color: #fff3f3;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    padding: 10px;
    color: #d32f2f;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message button {
    margin-left: auto;
    background: none;
    border: 1px solid #d32f2f;
    border-radius: 4px;
    padding: 4px 8px;
    color: #d32f2f;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.error-message button:hover {
    background-color: #d32f2f;
    color: white;
}

.category-count {
    margin-left: 8px;
    color: #666;
    font-size: 0.9em;
}

.collapse-all-btn {
    background: none;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 4px 12px;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9em;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.collapse-all-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.product-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    margin-bottom: 30px;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.product-image {
    width: 100%;
    height: 250px;
    border-radius: 12px;
    margin-bottom: 20px;
    object-fit: contain;
    background-color: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    line-height: 1.2;
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    max-height: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.product-price {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-old {
    text-decoration: line-through;
    color: #999;
    font-size: 1rem;
}

.price-new {
    color: #000;
    font-weight: 600;
    font-size: 1.4rem;
    animation: priceHighlight 0.3s ease-out;
}

.product-offer {
    color: #34A853;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
    line-height: 1.4;
}

.color-options {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding: 10px 0;
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    box-shadow: 0 0 0 2px #4285f4;
}

.total-back {
    display: inline-block;
    background: #E8F5E9;
    padding: 8px 16px;
    border-radius: 20px;
    color: #34A853;
    font-weight: 600;
    margin-top: 15px;
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .product-card {
        padding: 15px;
    }

    .product-title {
        font-size: 1rem;
        display: block;
        -webkit-line-clamp: unset;
        line-clamp: unset;
        max-height: none;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    .product-offer {
        font-size: 1rem;
    }

    .price-new {
        font-size: 1.2rem;
    }
}

/* Animation for price changes */
@keyframes priceHighlight {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}
