/**
 * Real-time Pricing & Preview System CSS
 * Phase 7 of Frontend Enhancement Plan
 */

/* ========================================================================
   PRICING BREAKDOWN INTERFACE
   ======================================================================== */

.sc-pricing-breakdown {
    background: var(--sc-color-background);
    border: 1px solid var(--sc-color-border);
    border-radius: var(--sc-border_radius_lg);
    overflow: hidden;
    box-shadow: var(--sc-shadow-sm);
}

.sc-breakdown-section {
    padding: var(--sc-spacing_lg);
}

.sc-breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sc-spacing_lg);
    padding-bottom: var(--sc-spacing_md);
    border-bottom: 2px solid var(--sc-color-primary);
}

.sc-breakdown-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: var(--sc-font_weight_bold);
    color: var(--sc-color-text);
}

.sc-breakdown-total {
    font-size: 1.5rem;
    font-weight: var(--sc-font_weight_bold);
    color: var(--sc-color-primary);
    background: var(--sc-color-primary-light);
    padding: var(--sc-spacing_sm) var(--sc-spacing_md);
    border-radius: var(--sc-border_radius_md);
}

/* Breakdown Items */
.sc-breakdown-items {
    display: flex;
    flex-direction: column;
    gap: var(--sc-spacing_sm);
    margin-bottom: var(--sc-spacing_lg);
}

.sc-breakdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sc-spacing_sm) var(--sc-spacing_md);
    background: var(--sc-color-surface);
    border-radius: var(--sc-border_radius_md);
    transition: all var(--sc-transition-fast);
}

.sc-breakdown-item:hover {
    background: var(--sc-color-border);
    transform: translateX(4px);
}

.sc-breakdown-item.sc-base-item {
    background: var(--sc-color-primary-light);
    font-weight: var(--sc-font_weight_semibold);
}

.sc-breakdown-item.sc-discount-item {
    background: var(--sc-color-success-light);
    color: var(--sc-color-success-dark);
}

.sc-item-label {
    font-size: 0.95rem;
    color: var(--sc-color-text);
    flex: 1;
}

.sc-item-price {
    font-weight: var(--sc-font_weight_bold);
    color: var(--sc-color-primary);
    margin-right: var(--sc-spacing_sm);
}

.sc-breakdown-detail-btn {
    background: none;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--sc-color-text-light);
    transition: all var(--sc-transition-fast);
}

.sc-breakdown-detail-btn:hover {
    background: var(--sc-color-primary);
    color: white;
    transform: scale(1.1);
}

/* Subtotal styling */
.sc-breakdown-subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sc-spacing_md);
    margin: var(--sc-spacing_md) 0;
    background: var(--sc-color-border);
    border-radius: var(--sc-border_radius_md);
    font-weight: var(--sc-font_weight_bold);
    font-size: 1.1rem;
    border-top: 2px solid var(--sc-color-primary);
    border-bottom: 2px solid var(--sc-color-primary);
}

/* Breakdown Actions */
.sc-breakdown-actions {
    display: flex;
    gap: var(--sc-spacing_sm);
    justify-content: center;
    margin-top: var(--sc-spacing_lg);
    padding-top: var(--sc-spacing_md);
    border-top: 1px solid var(--sc-color-border);
}

/* ========================================================================
   PRICING PROGRESS INDICATOR
   ======================================================================== */

.sc-pricing-progress {
    margin-bottom: var(--sc-spacing_lg);
    background: var(--sc-color-surface);
    padding: var(--sc-spacing_md);
    border-radius: var(--sc-border_radius_md);
    border: 1px solid var(--sc-color-border);
}

.sc-pricing-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sc-spacing_sm);
}

.sc-pricing-progress-label {
    font-size: 0.875rem;
    font-weight: var(--sc-font_weight_bold);
    color: var(--sc-color-text);
}

.sc-pricing-progress-text {
    font-size: 0.875rem;
    color: var(--sc-color-text-light);
}

.sc-pricing-progress-track {
    height: 8px;
    background: var(--sc-color-border);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.sc-pricing-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--sc-color-success), var(--sc-color-primary), var(--sc-color-warning));
    transition: width var(--sc-transition-normal);
    border-radius: 4px;
}

/* ========================================================================
   PRICING DISPLAY ELEMENTS
   ======================================================================== */

.sc-total-price {
    font-size: 1.75rem;
    font-weight: var(--sc-font_weight_bold);
    color: var(--sc-color-primary);
    transition: all var(--sc-transition-fast);
}

.sc-subtotal-price {
    font-size: 1.25rem;
    font-weight: var(--sc-font_weight_semibold);
    color: var(--sc-color-text);
}

.sc-price-change {
    display: inline-flex;
    align-items: center;
    padding: var(--sc-spacing_xs) var(--sc-spacing_sm);
    border-radius: var(--sc-border_radius_sm);
    font-size: 0.875rem;
    font-weight: var(--sc-font_weight_bold);
    transition: all var(--sc-transition-fast);
}

.sc-price-change.positive {
    background: var(--sc-color-error-light);
    color: var(--sc-color-error-dark);
}

.sc-price-change.negative {
    background: var(--sc-color-success-light);
    color: var(--sc-color-success-dark);
}

/* ========================================================================
   VISUAL PREVIEW SYSTEM
   ======================================================================== */

.sc-suit-preview-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: var(--sc-z-modal);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.sc-preview-header {
    background: var(--sc-color-background);
    padding: var(--sc-spacing_md) var(--sc-spacing_lg);
    border-bottom: 1px solid var(--sc-color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sc-preview-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--sc-color-text);
}

.sc-preview-controls {
    display: flex;
    align-items: center;
    gap: var(--sc-spacing_sm);
}

.sc-preview-control {
    background: var(--sc-color-surface);
    border: 1px solid var(--sc-color-border);
    border-radius: var(--sc-border_radius_md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--sc-transition-fast);
}

.sc-preview-control:hover {
    background: var(--sc-color-primary);
    color: white;
    border-color: var(--sc-color-primary);
    transform: scale(1.05);
}

.sc-zoom-level {
    font-size: 0.875rem;
    color: var(--sc-color-text-light);
    min-width: 40px;
    text-align: center;
}

.sc-preview-close {
    background: var(--sc-color-error);
    color: white;
    border: none;
    border-radius: var(--sc-border_radius_md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all var(--sc-transition-fast);
}

.sc-preview-close:hover {
    background: var(--sc-color-error-dark);
    transform: scale(1.05);
}

.sc-preview-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 300px;
    background: var(--sc-color-background);
    overflow: hidden;
}

/* Canvas Container */
.sc-preview-canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.sc-preview-canvas:active {
    cursor: grabbing;
}

/* Preview Sidebar */
.sc-preview-sidebar {
    background: var(--sc-color-surface);
    border-left: 1px solid var(--sc-color-border);
    padding: var(--sc-spacing_lg);
    display: flex;
    flex-direction: column;
    gap: var(--sc-spacing_xl);
    overflow-y: auto;
}

.sc-preview-info h4 {
    margin: 0 0 var(--sc-spacing_md) 0;
    font-size: 1.1rem;
    color: var(--sc-color-text);
    border-bottom: 2px solid var(--sc-color-primary);
    padding-bottom: var(--sc-spacing_xs);
}

.sc-selection-summary {
    display: flex;
    flex-direction: column;
    gap: var(--sc-spacing_sm);
}

.sc-summary-item {
    display: flex;
    flex-direction: column;
    gap: var(--sc-spacing_xs);
    padding: var(--sc-spacing_sm);
    background: var(--sc-color-background);
    border-radius: var(--sc-border_radius_md);
    border: 1px solid var(--sc-color-border);
}

.sc-summary-item strong {
    color: var(--sc-color-primary);
    font-size: 0.875rem;
    font-weight: var(--sc-font_weight_bold);
}

.sc-preview-actions {
    display: flex;
    flex-direction: column;
    gap: var(--sc-spacing_sm);
    margin-top: auto;
}

/* ========================================================================
   BREAKDOWN MODAL
   ======================================================================== */

.sc-breakdown-modal {
    max-width: 600px;
    width: 90vw;
    max-height: 80vh;
    border: none;
    border-radius: var(--sc-border_radius_lg);
    padding: 0;
    background: var(--sc-color-background);
    box-shadow: var(--sc-shadow-xl);
    overflow: hidden;
}

.sc-breakdown-modal::backdrop {
    background: rgba(0, 0, 0, 0.8);
}

.sc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sc-spacing_lg);
    background: var(--sc-color-surface);
    border-bottom: 1px solid var(--sc-color-border);
}

.sc-modal-header h3 {
    margin: 0;
    color: var(--sc-color-text);
}

.sc-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--sc-color-text-light);
    transition: all var(--sc-transition-fast);
}

.sc-modal-close:hover {
    background: var(--sc-color-error);
    color: white;
}

.sc-modal-body {
    padding: var(--sc-spacing_lg);
    max-height: 60vh;
    overflow-y: auto;
}

.sc-detail-breakdown {
    display: flex;
    flex-direction: column;
    gap: var(--sc-spacing_md);
}

/* ========================================================================
   INTEGRATION ELEMENTS
   ======================================================================== */

.sc-pricing-widget {
    position: sticky;
    top: var(--sc-spacing_md);
    background: var(--sc-color-background);
    border: 1px solid var(--sc-color-border);
    border-radius: var(--sc-border_radius_lg);
    padding: var(--sc-spacing_lg);
    box-shadow: var(--sc-shadow-sm);
}

.sc-pricing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sc-spacing_md);
}

.sc-pricing-title {
    font-size: 1.1rem;
    font-weight: var(--sc-font_weight_bold);
    color: var(--sc-color-text);
    margin: 0;
}

.sc-preview-toggle {
    background: var(--sc-color-primary-light);
    border: 1px solid var(--sc-color-primary);
    border-radius: var(--sc-border_radius_md);
    padding: var(--sc-spacing_xs) var(--sc-spacing_sm);
    font-size: 0.875rem;
    color: var(--sc-color-primary-dark);
    cursor: pointer;
    transition: all var(--sc-transition-fast);
}

.sc-preview-toggle:hover {
    background: var(--sc-color-primary);
    color: white;
}

/* Quick pricing summary */
.sc-pricing-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sc-spacing_md);
    background: var(--sc-color-surface);
    border-radius: var(--sc-border_radius_md);
    margin-bottom: var(--sc-spacing_md);
}

.sc-pricing-summary-label {
    font-weight: var(--sc-font_weight_semibold);
    color: var(--sc-color-text);
}

.sc-pricing-summary-value {
    font-size: 1.25rem;
    font-weight: var(--sc-font_weight_bold);
    color: var(--sc-color-primary);
}

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

@media (max-width: 1024px) {
    .sc-preview-body {
        grid-template-columns: 1fr;
    }
    
    .sc-preview-sidebar {
        border-left: none;
        border-top: 1px solid var(--sc-color-border);
        max-height: 40vh;
    }
    
    .sc-breakdown-section {
        padding: var(--sc-spacing_md);
    }
}

@media (max-width: 768px) {
    .sc-preview-controls {
        flex-wrap: wrap;
        gap: var(--sc-spacing_xs);
    }
    
    .sc-preview-control {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
    
    .sc-breakdown-header {
        flex-direction: column;
        gap: var(--sc-spacing_sm);
        align-items: stretch;
    }
    
    .sc-breakdown-total {
        text-align: center;
        font-size: 1.25rem;
    }
    
    .sc-pricing-widget {
        position: relative;
        margin-bottom: var(--sc-spacing_lg);
    }
}

@media (max-width: 480px) {
    .sc-suit-preview-container {
        padding: var(--sc-spacing_xs);
    }
    
    .sc-breakdown-modal {
        width: 95vw;
        max-height: 90vh;
    }
    
    .sc-breakdown-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sc-spacing_xs);
    }
    
    .sc-item-price {
        margin-right: 0;
        align-self: flex-end;
    }
    
    .sc-breakdown-actions {
        flex-direction: column;
    }
}

/* ========================================================================
   ANIMATIONS & TRANSITIONS
   ======================================================================== */

@keyframes priceUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.sc-total-price.updating {
    animation: priceUpdate 0.3s ease-out;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.sc-breakdown-item {
    animation: slideInFromRight 0.3s ease-out;
}

/* Stagger animation for breakdown items */
.sc-breakdown-item:nth-child(1) { animation-delay: 0ms; }
.sc-breakdown-item:nth-child(2) { animation-delay: 50ms; }
.sc-breakdown-item:nth-child(3) { animation-delay: 100ms; }
.sc-breakdown-item:nth-child(4) { animation-delay: 150ms; }
.sc-breakdown-item:nth-child(5) { animation-delay: 200ms; }

/* Preview loading animation */
@keyframes previewLoad {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.sc-suit-preview-container[style*="flex"] .sc-preview-canvas {
    animation: previewLoad 0.4s ease-out;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .sc-breakdown-item,
    .sc-total-price.updating,
    .sc-preview-canvas {
        animation: none !important;
    }
    
    * {
        transition: none !important;
    }
}
