/**
 * TeaTime Frontend Tier Pricing Styles
 * Stili per il sistema di tier pricing TeaTime
 * 
 * @version 1.0.0
 */

/* =============================================================================
   PRODUCT STATUS ICONS (ADMIN TABLE)
   ============================================================================= */

/* Icona WC base */
.wc-icon, 
[class*="wc-status"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    position: relative;
    transition: all 0.3s ease;
}

/* Stato: Prodotto caricato/sincronizzato */
.wc-synced,
.wc-icon.synced,
td:has(.fa-cart-shopping) {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
}

.wc-synced::after,
.wc-icon.synced::after {
    content: "✓";
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #4caf50;
    color: white;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Stato: Non sincronizzato/In attesa */
.wc-pending,
.wc-icon.pending {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    animation: pulse-pending 2s infinite;
}

@keyframes pulse-pending {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Stato: Errore */
.wc-error,
.wc-icon.error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.wc-error::after,
.wc-icon.error::after {
    content: "!";
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #f44336;
    color: white;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Hover effects per icone stato */
.wc-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* Tooltip per stato */
.wc-icon[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 4px;
    z-index: 1000;
}

/* =============================================================================
   TIER PRICING CONTAINER
   ============================================================================= */

#teatime-tier-pricing {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    animation: fadeIn 0.3s ease-in;
    display: none; /* Hidden by default */
}

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

/* =============================================================================
   QUANTITY SECTION
   ============================================================================= */

.teatime-quantity-section {
    margin-bottom: 20px;
}

.teatime-quantity-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

#teatime-quantity-select {
    width: 100%;
    max-width: 200px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    transition: border-color 0.3s ease;
}

#teatime-quantity-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* =============================================================================
   PRICING INFO
   ============================================================================= */

.teatime-pricing-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.unit-price, 
.total-price {
    text-align: center;
    padding: 15px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.unit-price {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
}

.total-price {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    border: 1px solid #81c784;
}

.unit-price .label, 
.total-price .label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.unit-price .price, 
.total-price .price {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: 2px;
}

.total-price .price {
    color: #1b5e20;
    font-size: 28px;
}

#teatime-unit-price,
#teatime-total-price {
    /* Inherits from .price */
}

.per-piece {
    font-size: 12px;
    color: #888;
    font-style: italic;
}

/* =============================================================================
   TIER INFO
   ============================================================================= */

#teatime-tier-info {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
    display: none; /* Hidden by default */
}

#teatime-tier-info h4 {
    margin: 0 0 10px 0;
    color: #856404;
}

#teatime-tier-info p {
    margin: 0;
    color: #856404;
}

/* =============================================================================
   LOADING STATE
   ============================================================================= */

.teatime-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.teatime-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* =============================================================================
   UPDATE ANIMATION
   ============================================================================= */

.teatime-updated {
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* =============================================================================
   ERROR MESSAGE
   ============================================================================= */

.teatime-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* =============================================================================
   HIDE STANDARD ELEMENTS
   ============================================================================= */

/* Hide standard quantity input for TeaTime products */
.product[data-teatime="1"] .quantity {
    display: none !important;
}

/* Hide ALL standard prices for TeaTime products */
body.single-product .summary .price,
body.single-product .summary .woocommerce-Price-amount,
body.single-product .summary p.price,
body.single-product .summary span.price {
    display: none !important;
}

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

@media (max-width: 768px) {
    .teatime-pricing-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}