/**
 * Copyright (c) 2025 Tecnoo
 *
 * @author    Tecnoo
 * @copyright 2025 Tecnoo
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/* Front-office styles */

/* Unavailable product message */
.pz-unavailable {
    color: #666;
    font-style: italic;
    font-size: 15px;
    font-weight: 600;
    padding: 15px;
    background-color: #f5f5f5;
    border-left: 4px solid #d9534f;
    margin: 15px 0;
    text-align: center;
}

/* Masquer les boutons natifs selon l'état du produit */

/* CAS UNAVAILABLE (cas 2 et 3) : Masquer TOUS les boutons natifs */
.pz-availability-container[data-pz-state="unavailable"] ~ * button[data-button-action="add-to-cart"],
.pz-availability-container[data-pz-state="unavailable"] ~ * button[data-button-action="buy-now"],
.pz-availability-container[data-pz-state="unavailable"] ~ * .buy,
.pz-availability-container[data-pz-state="unavailable"] ~ .buy {
    display: none !important;
}

/* CAS PREORDER (cas 1) : Masquer les boutons "Acheter" ET "Ajouter au panier" */
/* Le bouton "Précommande" déclenchera le bouton natif masqué pour la popup */
.pz-availability-container[data-pz-state="preorder"] ~ * button[data-button-action="add-to-cart"],
.pz-availability-container[data-pz-state="preorder"] ~ * button[data-button-action="buy-now"],
.pz-availability-container[data-pz-state="preorder"] ~ * .buy,
.pz-availability-container[data-pz-state="preorder"] ~ .buy {
    display: none !important;
}

/* Availability container */
.pz-availability-container {
    margin: 20px 0;
}

/* Delivery week selection */
.pz-delivery-week-select {
    margin-top: 10px;
    margin-bottom: 15px;
}

.pz-delivery-week-select label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
}

.pz-delivery-week-select select {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Add to cart button */
.pz-add-to-cart-button {
    margin-top: 10px;
}

.pz-add-to-cart-button button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Preorder button specific styling */
.pz-preorder-btn {
    background-color: #ff9800 !important;
    border-color: #ff9800 !important;
}

.pz-preorder-btn:hover {
    background-color: #f57c00 !important;
    border-color: #f57c00 !important;
}

.pz-preorder-btn:disabled {
    opacity: 0.7;
    cursor: wait !important;
}

/* Spinner animation */
.icon-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Cart info banner */
.pz-cart-info {
    margin-top: 15px;
    padding: 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

.pz-cart-info i {
    margin-right: 8px;
}

/* Delivery week badge in order list */
.pz-delivery-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    padding: 3px 6px;
    white-space: nowrap;
    vertical-align: middle;
    border-radius: 3px;
}

.pz-delivery-badge.badge-success {
    background-color: #28a745 !important;
    color: white !important;
}

.pz-delivery-badge.badge-warning {
    background-color: #ffc107 !important;
    color: #333 !important;
}

.pz-delivery-badge .material-icons {
    font-size: 12px;
    vertical-align: middle;
    margin-right: 2px;
}

/* Back-office styles */

/* Weeks configuration panel */
#pz-weeks-config .panel-heading {
    font-size: 16px;
    font-weight: 600;
}

#pz-weeks-config .help-block {
    font-size: 13px;
    margin-bottom: 20px;
}

#pz-weeks-config .table-responsive {
    max-height: 600px;
    overflow-y: auto;
    margin-bottom: 20px;
}

#pz-weeks-config table thead {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#pz-weeks-config table th {
    font-weight: 600;
    font-size: 14px;
    padding: 12px;
}

#pz-weeks-config table td {
    padding: 10px;
    vertical-align: middle;
}

/* Checkbox styling for admin */
.pz-can-order,
.pz-is-available {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Save button */
#pz-save-btn {
    font-size: 14px;
    padding: 10px 20px;
}

#pz-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Messages */
#pz-save-message,
#pz-error-message {
    font-size: 14px;
    font-weight: 600;
}

#pz-save-message i,
#pz-error-message i {
    margin-right: 5px;
}

/* Symfony form widget styles */
#plantzone-weekly-availability-widget .table {
    margin-bottom: 0;
}

#plantzone-weekly-availability-widget .table tbody tr:hover {
    background-color: #f5f5f5;
}

#plantzone-weekly-availability-widget .md-checkbox {
    margin: 0;
    display: inline-block;
}

#plantzone-weekly-availability-widget .table td {
    vertical-align: middle;
}

#plantzone-weekly-availability-widget .panel {
    margin-top: 20px;
    margin-bottom: 20px;
}

#plantzone-weekly-availability-widget .panel-heading {
    background-color: #f7f7f7;
    border-bottom: 1px solid #ddd;
    padding: 10px 15px;
    font-weight: 600;
}

#plantzone-weekly-availability-widget .help-block {
    margin-bottom: 15px;
    color: #737373;
    font-size: 13px;
}

#plantzone-weekly-availability-widget .table-responsive {
    max-height: 500px;
    overflow-y: auto;
}

#plantzone-weekly-availability-widget table thead {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pz-delivery-week-select select {
        max-width: 100%;
    }

    #pz-weeks-config .table-responsive {
        max-height: 400px;
    }

    #plantzone-weekly-availability-widget .table-responsive {
        max-height: 350px;
    }
}
