/*
 * BricoCamp Multi Installatore - Frontend Styles
 * 
 * @package BricoCamp\MultiInstallatore
 */

/* ==========================================================================
   Dynamic Price Display in WooCommerce
   ========================================================================== */

.bcmi-dynamic-price {
    margin: 15px 0 20px 0 !important;
    padding: 20px;
    background: linear-gradient(135deg, #e8f4fd 0%, #f0f8ff 100%);
    border: 2px solid #3498db;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.15);
    position: relative;
    overflow: hidden;
}

.bcmi-dynamic-price::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
}

.bcmi-dynamic-price .bcmi-price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bcmi-dynamic-price .bcmi-product-price-row,
.bcmi-dynamic-price .bcmi-installation-price-row,
.bcmi-dynamic-price .bcmi-total-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    transition: all 0.3s ease;
}

.bcmi-dynamic-price .bcmi-installation-price-row {
    border-bottom: 1px solid rgba(52, 152, 219, 0.2);
    padding-bottom: 12px;
    margin-bottom: 8px;
}

.bcmi-dynamic-price .bcmi-total-price-row {
    border-top: 2px solid #2980b9;
    margin-top: 12px;
    padding-top: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    padding-left: 10px;
    padding-right: 10px;
}

.bcmi-dynamic-price .bcmi-price-label {
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

.bcmi-dynamic-price .bcmi-product-price-value,
.bcmi-dynamic-price .bcmi-installation-price-value {
    color: #27ae60;
    font-weight: 700;
    font-size: 15px;
}

.bcmi-dynamic-price .bcmi-total-price-value {
    color: #e74c3c;
    font-weight: 800;
    font-size: 20px;
}

.bcmi-dynamic-price .bcmi-total-price-row .bcmi-price-label {
    font-size: 16px;
    color: #2c3e50;
}

/* Animation when price updates */
.bcmi-dynamic-price.updating {
    animation: bcmi-price-pulse 0.6s ease-in-out;
}

@keyframes bcmi-price-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); box-shadow: 0 6px 12px rgba(52, 152, 219, 0.25); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Installation Options Component
   ========================================================================== */

.bcmi-installation-options {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    transition: all 0.3s ease;
}

.bcmi-installation-options:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bcmi-installation-options h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2271b1;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}

/* Installer Selection */
.bcmi-installer-selection {
    margin: 25px 0;
    padding: 25px;
    background: #fafafa;
    border: 1px solid #e1e1e1;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.bcmi-form-title {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 700;
}

.bcmi-installer-description {
    margin: 10px 0 20px 0;
    color: #5f6c7b;
    font-size: 15px;
}

.bcmi-installation-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.bcmi-installation-toggle .bcmi-toggle-label {
    font-weight: 600;
    color: #34495e;
    margin-right: 10px;
}

.bcmi-installation-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 500;
    color: #34495e;
    cursor: pointer;
}

.bcmi-installation-toggle input[type="radio"] {
    accent-color: #2271b1;
}

.bcmi-installer-fields {
    margin-top: 10px;
}

.bcmi-section-title {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    position: relative;
    padding-bottom: 10px;
}

.bcmi-section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 2px;
}

.bcmi-installer-selection label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.bcmi-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #34495e;
    font-size: 15px;
}

.bcmi-installer-select,
.bcmi-installer-dropdown {
    width: 100%;
    max-width: none;
    padding: 15px;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    font-size: 16px;
    background: white;
    color: #495057;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 15px;
}

.bcmi-installer-select:focus,
.bcmi-installer-dropdown:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    transform: translateY(-1px);
}

.bcmi-installer-select:hover,
.bcmi-installer-dropdown:hover {
    border-color: #bdc3c7;
}

/* Price Display in Selection */
.bcmi-price-display {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.bcmi-price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bcmi-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.bcmi-price-row:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.bcmi-total-price {
    border-top: 2px solid #3498db;
    margin-top: 15px;
    padding-top: 20px;
    background: rgba(52, 152, 219, 0.05);
    border-radius: 6px;
    padding-left: 15px;
    padding-right: 15px;
}

/* Installation Details */
.bcmi-installation-details {
    background: var(--bcmi-info-bg, #ffffff);
    border: 1px solid var(--bcmi-info-border, #e9ecef);
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
    animation: bcmi-fadeIn 0.3s ease;
}

.bcmi-installer-details h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--bcmi-heading-color, #2c3e50);
    font-weight: 600;
}

.bcmi-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 15px;
    border-bottom: 1px solid var(--bcmi-summary-border, #eef1f4);
}

.bcmi-summary-row:last-child {
    border-bottom: 0;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 2px solid var(--bcmi-summary-total-border, #2271b1);
}

.bcmi-summary-row:last-child .bcmi-summary-label {
    font-weight: 700;
}

.bcmi-summary-row:last-child .bcmi-summary-value {
    font-weight: 700;
    color: var(--bcmi-summary-total-color, #2271b1);
}

.bcmi-summary-label {
    color: var(--bcmi-summary-label-color, #6c7a89);
    font-weight: 500;
}

.bcmi-summary-value {
    font-weight: 600;
    color: var(--bcmi-summary-value-color, #2c3e50);
}

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

/* Price Breakdown */
.bcmi-price-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 16px;
}

.bcmi-price-line:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

.bcmi-total-price-line {
    border-top: 2px solid #2271b1;
    margin-top: 12px;
    padding-top: 12px;
    font-weight: 600;
    font-size: 18px;
    color: #2271b1;
}

.bcmi-price-label {
    color: #6c757d;
}

.bcmi-price-value {
    font-weight: 600;
    color: #2271b1;
}

.bcmi-price-value.installation {
    color: #28a745;
}

.bcmi-price-value.total {
    color: #2271b1;
    font-size: 20px;
}

/* Loading and Error States */
.bcmi-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 30px;
    color: #7f8c8d;
    font-size: 16px;
}

.bcmi-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: bcmi-spin 1s linear infinite;
}

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

.bcmi-error {
    padding: 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    text-align: center;
    color: #721c24;
}

.bcmi-error-message {
    margin: 0 0 15px 0;
    font-weight: 600;
}

.bcmi-retry-btn {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 600;
}

.bcmi-retry-btn:hover {
    background: #c82333;
}

/* Installation Controls */
.bcmi-installation-options-controls {
    margin: 20px 0;
    padding: 16px;
    background: #e8f4f8;
    border-radius: 6px;
    border-left: 4px solid #2271b1;
}

.bcmi-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    transition: color 0.2s ease;
}

.bcmi-checkbox-label:hover {
    color: #2271b1;
}

.bcmi-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    accent-color: #2271b1;
}

/* Installer Information */
.bcmi-installer-info {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    margin-top: 16px;
}

.bcmi-installer-info h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.bcmi-installer-details {
    color: #6c757d;
    line-height: 1.5;
}

.bcmi-installer-details strong {
    color: #2271b1;
    font-weight: 600;
}

/* Context Indicator */
.bcmi-context-indicator {
    position: fixed;
    top: 50px;
    right: 20px;
    background: #2271b1;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 9999;
    font-size: 14px;
    max-width: 300px;
}

.bcmi-context-indicator a {
    color: white;
    text-decoration: underline;
    margin-left: 8px;
}

.bcmi-context-indicator a:hover {
    text-decoration: none;
}

/* Cart Item Styling */
.bcmi-installer-note {
    color: #6c757d;
    font-style: italic;
}

.bcmi-installation-price {
    color: #28a745;
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .bcmi-installer-selection {
        margin: 20px 0;
        padding: 20px;
    }
    
    .bcmi-section-title {
        font-size: 18px;
    }
    
    .bcmi-dynamic-price {
        margin: 10px 0 15px 0;
        padding: 15px;
    }
    
    .bcmi-dynamic-price .bcmi-total-price-value {
        font-size: 18px;
    }
    
    .bcmi-installer-select,
    .bcmi-installer-dropdown {
        padding: 12px;
        font-size: 15px;
        max-width: 100%;
    }
    
    .bcmi-price-row,
    .bcmi-price-line {
        font-size: 14px;
    }
    
    .bcmi-total-price-line {
        font-size: 16px;
    }
    
    .bcmi-context-indicator {
        position: static;
        margin: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .bcmi-dynamic-price .bcmi-product-price-row,
    .bcmi-dynamic-price .bcmi-installation-price-row,
    .bcmi-dynamic-price .bcmi-total-price-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .bcmi-dynamic-price .bcmi-total-price-value {
        align-self: flex-end;
    }
    
    .bcmi-installation-options {
        padding: 10px;
    }
    
    .bcmi-price-breakdown {
        padding: 12px;
    }
}

/* WooCommerce Integration */
.woocommerce div.product .bcmi-installer-selection {
    margin: 25px 0;
}

.woocommerce div.product form.cart .bcmi-installer-selection {
    margin-bottom: 25px;
}

.woocommerce div.product .bcmi-dynamic-price {
    margin: 20px 0 25px 0;
}

/* Ensure dynamic price appears before add to cart button */
.woocommerce div.product form.cart .bcmi-dynamic-price {
    order: -1;
    margin-bottom: 20px;
}

/* Updated price display */
.bcmi-price-overridden {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bcmi-price-overridden .bcmi-updated-price-label {
    font-size: 12px;
    color: #7f8c8d;
    font-style: italic;
    text-transform: none;
}

.bcmi-price-overridden .bcmi-updated-price-amount {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.bcmi-price-overridden .woocommerce-Price-amount,
.bcmi-price-overridden .amount {
    text-decoration: none !important;
    opacity: 1 !important;
}

.bcmi-installer-details .woocommerce-Price-amount,
.bcmi-installer-details .amount {
    text-decoration: none !important;
}

/* Theme Compatibility */
.bcmi-installer-selection *,
.bcmi-dynamic-price * {
    box-sizing: border-box;
}

/* Success Messages */
.bcmi-success {
    color: #155724;
    font-weight: 600;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
}