/**
 * Bozar Configurator - Frontend Styles
 * Modern luxury clean UI matching the design
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --bozar-primary: #c9a227;
    --bozar-primary-hover: #b8931f;
    --bozar-primary-light: #f5edd6;
    --bozar-secondary: #1a1a1a;
    --bozar-text: #333333;
    --bozar-text-light: #666666;
    --bozar-text-muted: #999999;
    --bozar-border: #e5e5e5;
    --bozar-border-light: #f0f0f0;
    --bozar-background: #fafafa;
    --bozar-white: #ffffff;
    --bozar-error: #dc3545;
    --bozar-success: #28a745;
    --bozar-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --bozar-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --bozar-radius: 12px;
    --bozar-radius-sm: 8px;
    --bozar-transition: all 0.2s ease;
}

/* ============================================
   Base Configurator Container
   ============================================ */
.bozar-configurator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    color: var(--bozar-text);
    line-height: 1.5;
}

.bozar-configurator * {
    box-sizing: border-box;
}

/* ============================================
   Loading State
   ============================================ */
.bozar-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.bozar-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bozar-border);
    border-top-color: var(--bozar-primary);
    border-radius: 50%;
    animation: bozar-spin 0.8s linear infinite;
}

.bozar-spinner-small {
    width: 24px;
    height: 24px;
    border: 2px solid var(--bozar-border);
    border-top-color: var(--bozar-primary);
    border-radius: 50%;
    animation: bozar-spin 0.8s linear infinite;
    margin: 20px auto;
}

@keyframes bozar-spin {
    to {
        transform: rotate(360deg);
    }
}

.bozar-loading p {
    margin-top: 16px;
    color: var(--bozar-text-muted);
    font-size: 14px;
}

/* ============================================
   Step Navigation
   ============================================ */
.bozar-steps-nav {
    margin-bottom: 40px;
    padding: 0 20px;
}

.bozar-steps-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
}

.bozar-step-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    cursor: pointer;
    transition: var(--bozar-transition);
    position: relative;
}

.bozar-step-nav-item:not(.active):not(.completed) {
    cursor: default;
    opacity: 0.5;
}

.bozar-step-nav-item.completed {
    cursor: pointer;
}

.bozar-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bozar-border);
    color: var(--bozar-text-muted);
    font-size: 13px;
    font-weight: 600;
    transition: var(--bozar-transition);
}

.bozar-step-nav-item.active .bozar-step-number {
    background: var(--bozar-primary);
    color: var(--bozar-white);
}

.bozar-step-nav-item.completed .bozar-step-number {
    background: var(--bozar-primary-light);
    color: var(--bozar-primary);
}

.bozar-step-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--bozar-text-muted);
    transition: var(--bozar-transition);
    white-space: nowrap;
}

.bozar-step-nav-item.active .bozar-step-title {
    color: var(--bozar-primary);
    font-weight: 600;
}

.bozar-step-nav-item.completed .bozar-step-title {
    color: var(--bozar-text);
}

.bozar-step-connector {
    width: 40px;
    height: 2px;
    background: var(--bozar-border);
    margin: 0 4px;
}

/* ============================================
   Steps Content
   ============================================ */
.bozar-steps-content {
    margin-bottom: 30px;
}

.bozar-step {
    display: none;
}

.bozar-step.active {
    display: block;
    animation: bozar-fadeIn 0.3s ease;
}

@keyframes bozar-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Category Cards
   ============================================ */
.bozar-category-card {
    background: var(--bozar-white);
    border-radius: var(--bozar-radius);
    box-shadow: var(--bozar-shadow);
    margin-bottom: 24px;
    padding: 24px;
    transition: var(--bozar-transition);
    border: 2px solid transparent;
}

.bozar-category-card.has-error {
    border-color: var(--bozar-error);
}

.bozar-category-header {
    margin-bottom: 20px;
}

.bozar-category-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--bozar-secondary);
    margin: 0 0 4px 0;
}

.bozar-required-badge {
    color: var(--bozar-error);
    margin-left: 4px;
}

.bozar-category-subtitle {
    font-size: 14px;
    color: var(--bozar-text-muted);
    margin: 4px 0 0 0;
}

.bozar-quantity-label {
    display: inline-block;
    background: var(--bozar-primary-light);
    color: var(--bozar-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
}

/* ============================================
   Products Grid
   ============================================ */
.bozar-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.bozar-products-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
}

.bozar-no-products {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--bozar-text-muted);
    padding: 40px;
}

/* ============================================
   Product Cards
   ============================================ */
.bozar-product-card {
    background: var(--bozar-background);
    border-radius: var(--bozar-radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: var(--bozar-transition);
    border: 2px solid transparent;
    position: relative;
}

.bozar-product-card:hover {
    box-shadow: var(--bozar-shadow-hover);
    transform: translateY(-2px);
}

.bozar-product-card.selected {
    border-color: var(--bozar-primary);
    background: var(--bozar-white);
}

.bozar-product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--bozar-radius-sm);
    overflow: hidden;
    background: var(--bozar-white);
    margin-bottom: 12px;
}

.bozar-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--bozar-transition);
}

.bozar-product-card:hover .bozar-product-image img {
    transform: scale(1.05);
}

.bozar-product-link {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--bozar-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--bozar-shadow);
    opacity: 0;
    transition: var(--bozar-transition);
    z-index: 2;
}

.bozar-product-card:hover .bozar-product-link {
    opacity: 1;
}

.bozar-product-link:hover {
    background: var(--bozar-primary);
    color: var(--bozar-white);
}

.bozar-external-icon {
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.bozar-product-info {
    text-align: center;
    margin-bottom: 8px;
}

.bozar-product-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--bozar-text);
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.bozar-product-price {
    font-size: 12px;
    color: var(--bozar-text-muted);
}

/* ============================================
   Radio Button Custom Style
   ============================================ */
.bozar-product-select {
    display: flex;
    justify-content: center;
}

.bozar-radio-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.bozar-product-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.bozar-radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bozar-border);
    border-radius: 50%;
    position: relative;
    transition: var(--bozar-transition);
}

.bozar-product-radio:checked + .bozar-radio-custom {
    border-color: var(--bozar-primary);
}

.bozar-product-radio:checked + .bozar-radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--bozar-primary);
    border-radius: 50%;
}

/* ============================================
   Navigation Buttons
   ============================================ */
.bozar-nav-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 0;
    border-top: 1px solid var(--bozar-border-light);
}

.bozar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--bozar-radius-sm);
    cursor: pointer;
    transition: var(--bozar-transition);
    border: none;
    font-family: inherit;
}

.bozar-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bozar-btn-primary {
    background: var(--bozar-primary);
    color: var(--bozar-white);
}

.bozar-btn-primary:hover:not(:disabled) {
    background: var(--bozar-primary-hover);
}

.bozar-btn-secondary {
    background: var(--bozar-white);
    color: var(--bozar-text);
    border: 1px solid var(--bozar-border);
}

.bozar-btn-secondary:hover:not(:disabled) {
    background: var(--bozar-background);
    border-color: var(--bozar-text-muted);
}

.bozar-btn-icon {
    font-size: 16px;
    line-height: 1;
}

/* ============================================
   Validation Messages
   ============================================ */
.bozar-validation-messages {
    background: #fff5f5;
    border: 1px solid var(--bozar-error);
    border-radius: var(--bozar-radius-sm);
    padding: 16px;
    margin-bottom: 20px;
}

.bozar-validation-messages ul {
    margin: 0;
    padding: 0 0 0 20px;
    color: var(--bozar-error);
}

.bozar-validation-messages li {
    margin-bottom: 4px;
}

.bozar-validation-messages li:last-child {
    margin-bottom: 0;
}

/* ============================================
   Error State
   ============================================ */
.bozar-error-state {
    text-align: center;
    padding: 60px 20px;
}

.bozar-error-message {
    color: var(--bozar-error);
    margin-bottom: 20px;
}

.bozar-error {
    color: var(--bozar-error);
    text-align: center;
    padding: 20px;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 992px) {
    .bozar-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .bozar-step-connector {
        width: 20px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .bozar-configurator {
        padding: 12px;
    }
    
    .bozar-steps-nav {
        padding: 0;
        margin-bottom: 24px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .bozar-steps-list {
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding: 0 10px;
        min-width: max-content;
    }
    
    .bozar-step-nav-item {
        padding: 10px 12px;
    }
    
    .bozar-step-title {
        font-size: 13px;
    }
    
    .bozar-step-connector {
        width: 16px;
    }
    
    .bozar-category-card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .bozar-category-title {
        font-size: 16px;
    }
    
    .bozar-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .bozar-product-card {
        padding: 10px;
    }
    
    .bozar-product-name {
        font-size: 12px;
    }
    
    .bozar-nav-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .bozar-btn {
        width: 100%;
        justify-content: center;
    }
    
    .bozar-btn-back {
        order: 2;
    }
    
    .bozar-btn-next,
    .bozar-btn-confirm {
        order: 1;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .bozar-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .bozar-product-image {
        aspect-ratio: 1;
    }
    
    .bozar-step-number {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
}

/* ============================================
   Theme Compatibility
   ============================================ */
.bozar-configurator a {
    color: var(--bozar-primary);
    text-decoration: none;
}

.bozar-configurator a:hover {
    color: var(--bozar-primary-hover);
}

.bozar-configurator button {
    font-family: inherit;
}

.bozar-configurator input[type="radio"] {
    margin: 0;
}

/* Elementor Compatibility */
.elementor-widget-container .bozar-configurator {
    max-width: 100%;
}

/* Hide default WP styles that might interfere */
.bozar-configurator img {
    max-width: 100%;
    height: auto;
}
