/**
 * Module PS Delivery Estimate
 * Styles pour l'affichage de l'estimation de livraison
 */

/* Container principal */
.ps-delivery-estimate {
    margin: 15px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Boîte de livraison commune */
.delivery-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    border: 2px solid var(--delivery-color, #28a745);
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,249,250,0.95) 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.delivery-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Icône */
.delivery-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--delivery-color, #28a745);
    border-radius: 50%;
    padding: 8px;
}

.delivery-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

/* Contenu */
.delivery-content {
    flex: 1;
    min-width: 0;
}

/* Titre avec badge */
.delivery-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.delivery-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
    background-color: var(--delivery-color, #28a745);
    border-radius: 4px;
}

.delivery-check {
    color: var(--delivery-color, #28a745);
    font-size: 18px;
    font-weight: bold;
}

/* Date de livraison */
.delivery-date {
    font-size: 15px;
    color: #333;
    line-height: 1.4;
}

.delivery-date strong {
    color: var(--delivery-color, #28a745);
    font-weight: 600;
}

/* Variante Colis */
.delivery-colis {
    --delivery-color: #28a745;
}

/* Variante Palette */
.delivery-palette {
    --delivery-color: #17a2b8;
}

/* ===== ALERTE RETOUR EN STOCK ===== */

.delivery-alert {
    --delivery-color: #dc3545;
}

/* Badge warning (réapprovisionnement) */
.delivery-badge-warning {
    background-color: #e67e22 !important;
}

/* Info date de réapprovisionnement */
.expected-delivery-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 12px;
    font-size: 15px;
    color: #333;
}

.expected-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    background-color: #e67e22;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

.expected-text {
    line-height: 1.4;
}

.expected-text strong {
    color: #e67e22;
    font-weight: 600;
}

.alert-description {
    margin: 0 0 12px;
    font-size: 14px;
    color: #555;
}

/* Formulaire d'alerte */
.stock-alert-form {
    margin-top: 12px;
}

.alert-form-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.alert-input-wrapper {
    flex: 1;
    min-width: 0;
}

.alert-email-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.alert-email-input:focus {
    outline: none;
    border-color: var(--delivery-color, #dc3545);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.alert-email-input::placeholder {
    color: #999;
}

.alert-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background-color: var(--delivery-color, #dc3545);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}

.alert-submit-btn:hover:not(:disabled) {
    background-color: #c82333;
    transform: translateY(-1px);
}

.alert-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.alert-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
}

.btn-loading .spinner {
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
}

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

/* Messages */
.alert-form-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-form-message.alert-success,
.alert-message.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-form-message.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
}

.alert-message svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    min-width: 16px;
    max-width: 16px;
}

/* Mention confidentialité */
.alert-privacy {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 12px 0 0;
    font-size: 11px;
    color: #888;
}

.alert-privacy svg {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    min-width: 12px;
    max-width: 12px;
}

/* ===== RESPONSIVE ===== */

/* Tablettes */
@media (max-width: 991px) {
    .delivery-box {
        padding: 14px;
    }
    
    .delivery-icon {
        width: 36px;
        height: 36px;
    }
    
    .delivery-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .delivery-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .delivery-date {
        font-size: 14px;
    }
}

/* Mobile */
@media (max-width: 575px) {
    .ps-delivery-estimate {
        margin: 12px 0;
    }
    
    .delivery-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 16px 12px;
        gap: 10px;
    }
    
    .delivery-icon {
        width: 44px;
        height: 44px;
    }
    
    .delivery-icon svg {
        width: 26px;
        height: 26px;
    }
    
    .delivery-title {
        justify-content: center;
    }
    
    .delivery-badge {
        font-size: 11px;
    }
    
    .delivery-date {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .delivery-date strong {
        display: inline-block;
    }
    
    /* Alerte stock responsive */
    .delivery-alert .delivery-content {
        text-align: left;
        width: 100%;
    }
    
    .alert-form-row {
        flex-direction: column;
    }
    
    .alert-submit-btn {
        width: 100%;
        padding: 14px 20px;
    }
    
    .alert-privacy {
        justify-content: center;
        text-align: center;
    }
}

/* Très petit écran */
@media (max-width: 359px) {
    .delivery-box {
        padding: 12px 10px;
    }
    
    .delivery-date {
        font-size: 13px;
    }
    
    .delivery-badge {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* ===== MODE SOMBRE (si supporté par le thème) ===== */
@media (prefers-color-scheme: dark) {
    .delivery-box {
        background: linear-gradient(135deg, rgba(30,30,30,0.95) 0%, rgba(40,40,40,0.95) 100%);
    }
    
    .delivery-date {
        color: #e0e0e0;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.delivery-check {
    animation: pulse 2s ease-in-out infinite;
}

/* ===== ACCESSIBILITÉ ===== */
@media (prefers-reduced-motion: reduce) {
    .delivery-box {
        transition: none;
    }
    
    .delivery-check {
        animation: none;
    }
}

/* Focus visible pour navigation clavier */
.delivery-box:focus-visible {
    outline: 3px solid var(--delivery-color, #28a745);
    outline-offset: 2px;
}

/* ===== IMPRESSION ===== */
@media print {
    .delivery-box {
        border: 1px solid #333;
        box-shadow: none;
        background: white;
    }
    
    .delivery-icon {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .delivery-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
