/* Redolance Woo Product Configurator Frontend Styles - Compact Design */

.wpc-configurator-wrapper {
    margin: 20px 0;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wpc-configurator-header {
    margin-bottom: 20px;
    text-align: center;
}

.wpc-configurator-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #111827;
}

.wpc-configurator-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.wpc-component-group {
    margin-bottom: 12px;
}

.wpc-component-group:last-child {
    margin-bottom: 0;
}

.wpc-component-header {
    margin-bottom: 6px;
}

.wpc-component-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 2px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wpc-required-indicator {
    color: #ef4444;
    font-weight: 700;
}

.wpc-component-description {
    font-size: 11px;
    color: #6b7280;
    margin: 0;
    line-height: 1.3;
}

.wpc-options-grid {
    display: flex;
    gap: 5px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.wpc-option-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 6px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.1s ease;
    min-height: 32px;
    text-align: center;
    user-select: none;
    font-size: 18px;
}

.wpc-option-card:hover {
    border-color: var(--rwpc-primary-color, #3b82f6);
    box-shadow: 0 1px 3px var(--rwpc-primary-shadow, rgba(59, 130, 246, 0.2));
    transform: scale(1.02);
    background: var(--rwpc-hover-bg, rgba(59, 130, 246, 0.04));
}

.wpc-option-card input[type="radio"],
.wpc-option-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.wpc-option-card.selected {
    padding-left: 26px;
    background: var(--rwpc-selected-bg, rgba(37, 99, 235, 0.08));
    border-color: var(--rwpc-primary-color, #2563eb);
    border-width: 2px;
    box-shadow: 0 0 0 1px var(--rwpc-primary-shadow, rgba(37, 99, 235, 0.1));
}

.wpc-selected-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: var(--rwpc-primary-color, #2563eb);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid #ffffff;
}

.wpc-option-card.selected .wpc-selected-indicator {
    display: flex;
}

.wpc-selected-indicator svg {
    width: 11px;
    height: 11px;
    fill: white;
}

.wpc-card-content {
    /*position: relative;*/
}

.wpc-card-header {
    margin-bottom: 1px;
}

.wpc-option-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.wpc-option-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    line-height: 1;
    margin: 0;
    text-align: center;
    word-break: break-word;
    hyphens: auto;
}

.wpc-default-badge {
    font-size: 11px;
    padding: 0px 2px;
    background: #10b981;
    color: white;
    border-radius: 1px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.wpc-option-description {
    font-size: 9px;
    color: #6b7280;
    margin: 2px 0;
    line-height: 1.2;
    text-align: center;
}

.wpc-card-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2px;
    gap: 2px;
}

.wpc-price-info {
    text-align: center;
}

.wpc-price-modifier {
    font-size: 12px;
    font-weight: 700;
    display: block;
    line-height: 1;
}

.wpc-price-modifier.wpc-price-positive {
    color: #059669;
}

.wpc-price-modifier.wpc-price-negative {
    color: #dc2626;
}

.wpc-price-modifier.wpc-price-included {
    color: #6b7280;
    font-weight: 500;
    font-style: italic;
}

.wpc-more-info-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0px;
    border-radius: 1px;
    transition: color 0.2s ease;
}

.wpc-more-info-btn:hover {
    color: #3b82f6;
}

.wpc-more-info-btn .dashicons {
    font-size: 8px;
    width: 8px;
    height: 8px;
}

/* Disabled Card State */
.wpc-option-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Price Summary Section - Compact */
.wpc-price-summary {
    margin: 20px 0 12px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.wpc-price-summary-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
    color: #111827;
    text-align: center;
}

.wpc-price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wpc-price-breakdown > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.wpc-base-price,
.wpc-upgrades-price {
    color: #6b7280;
}

.wpc-total-price {
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
    padding-top: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.wpc-price-label {
    font-weight: 500;
}

.wpc-price-value {
    font-weight: 600;
}

.wpc-total-price .wpc-price-value {
    color: var(--rwpc-primary-color, #3b82f6);
    font-size: 20px;
}

/* Price Update Animation */
@keyframes priceChange {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        color: #3b82f6;
    }
    100% {
        transform: scale(1);
    }
}

.wpc-total-price .amount.updating {
    animation: priceChange 0.3s ease;
}

/* Configuration Actions */
.wpc-config-actions {
    margin: 12px 0 8px;
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.wpc-reset-defaults-btn {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.wpc-reset-defaults-btn:hover {
    background: #e5e7eb;
    color: #374151;
    border-color: #9ca3af;
}

/* Validation Error Styles */
.wpc-validation-messages {
    margin: 16px 0;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: 4px;
}

.wpc-validation-error h4 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #dc2626;
    font-weight: 600;
}

.wpc-validation-error ul {
    margin: 0;
    padding: 0 0 0 20px;
    list-style-type: disc;
}

.wpc-validation-error li {
    font-size: 13px;
    color: #dc2626;
    margin-bottom: 4px;
}

.wpc-component-group.wpc-error .wpc-component-title::after {
    content: " ⚠️";
    color: #dc2626;
}

.wpc-component-group.wpc-error {
    padding: 16px;
    border: 2px dashed #fecaca;
    border-radius: 6px;
    background: #fef2f2;
    margin-bottom: 20px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Modal Styles */
.wpc-more-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

.wpc-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.wpc-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 480px;
    margin: 10vh auto 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 10000;
}

.wpc-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wpc-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.wpc-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    color: #6b7280;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.wpc-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.wpc-modal-body {
    padding: 20px;
}

.wpc-modal-description {
    margin: 0;
    line-height: 1.6;
    color: #374151;
    font-size: 14px;
}

body.wpc-modal-open {
    overflow: hidden;
}

/* Tablet Responsive: 768px - 1024px */
@media (min-width: 768px) and (max-width: 1024px) {
    .wpc-options-grid {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
        gap: 2px;
    }

    .wpc-option-card {
        min-height: 28px;
        padding: 2px 4px;
    }

    .wpc-option-name {
        font-size: 7px;
    }
}

/* Mobile Responsive: < 768px */
@media (max-width: 767px) {
    .wpc-configurator-wrapper {
        margin: 16px 0;
        padding: 16px;
    }

    .wpc-configurator-title {
        font-size: 18px;
    }

    .wpc-component-title {
        font-size: 15px;
    }

    .wpc-options-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 1px;
    }

    .wpc-option-card {
        min-height: 24px;
        padding: 1px 2px;
    }

    .wpc-option-name {
        font-size: 6px;
    }

    .wpc-option-description {
        font-size: 8px;
        margin: 1px 0;
    }

    .wpc-price-modifier {
        font-size: 6px;
    }

    .wpc-default-badge {
        font-size: 5px;
        padding: 0px 2px;
    }

    .wpc-price-summary {
        margin: 16px 0 8px;
        padding: 14px;
        position: sticky;
        bottom: 0;
        background: #fff;
        border-top: 2px solid #e5e7eb;
        border-radius: 0;
        margin-left: -16px;
        margin-right: -16px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    }

    .wpc-configurator-wrapper {
        margin-bottom: 60px; /* Space for sticky summary */
    }

    .wpc-modal-content {
        margin: 5vh 16px 0;
        max-width: none;
    }

    .wpc-modal-header,
    .wpc-modal-body {
        padding: 16px;
    }
}

/* Small Mobile: < 480px */
@media (max-width: 479px) {
    .wpc-options-grid {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
        gap: 1px;
    }

    .wpc-option-card {
        min-height: 20px;
        padding: 1px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .wpc-card-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .wpc-option-info {
        flex-direction: row;
        align-items: center;
        gap: 4px;
        flex-grow: 1;
    }

    .wpc-card-footer {
        margin-top: 0;
        margin-left: auto;
    }

    .wpc-selected-indicator {
        position: static;
        margin-left: 8px;
    }

    .wpc-price-breakdown > div {
        font-size: 13px;
    }

    .wpc-total-price {
        font-size: 16px;
    }

    .wpc-total-price .wpc-price-value {
        font-size: 18px;
    }
}

/* Focus styles for accessibility */
.wpc-option-card:focus {
    outline: 2px solid var(--rwpc-primary-color, #3b82f6);
    outline-offset: 2px;
}

.wpc-reset-defaults-btn:focus,
.wpc-more-info-btn:focus,
.wpc-modal-close:focus {
    outline: 2px solid var(--rwpc-primary-color, #3b82f6);
    outline-offset: 1px;
}

/* Print styles */
@media print {
    .wpc-config-actions,
    .wpc-more-info-btn {
        display: none !important;
    }

    .wpc-configurator-wrapper {
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .wpc-option-card {
        border-color: #000;
        box-shadow: none;
    }

    .wpc-option-card.selected {
        background: #f0f0f0;
    }
}

/* Layout Style Variations - Controlled by Admin Settings */

/* CSS Variables for Dynamic Colors - Set by PHP */
:root {
    --rwpc-primary-color: #2563eb;
    --rwpc-secondary-color: #6b7280;
    --rwpc-primary-rgb: 37, 99, 235;
    --rwpc-hover-bg: rgba(37, 99, 235, 0.04);
    --rwpc-selected-bg: rgba(37, 99, 235, 0.08);
    --rwpc-minimal-selected-bg: rgba(37, 99, 235, 0.1);
    --rwpc-classic-selected-bg: rgba(37, 99, 235, 0.06);
    --rwpc-primary-shadow: rgba(37, 99, 235, 0.2);
}

/* Modern Layout (Default - Ultra Compact) */
.wpc-layout-modern .wpc-option-card {
    /* Current ultra-compact styles are the default */
}

/* Minimal Layout - Clean and Simple */
.wpc-layout-minimal .wpc-option-card {
    background: transparent;
    border: 1px solid #e5e7eb;
    box-shadow: none;
}

.wpc-layout-minimal .wpc-option-card:hover {
    background: var(--rwpc-hover-bg, rgba(37, 99, 235, 0.04));
    border-color: var(--rwpc-primary-color, #2563eb);
    box-shadow: none;
    transform: none;
}

.wpc-layout-minimal .wpc-option-card.selected {
    background: var(--rwpc-minimal-selected-bg, rgba(37, 99, 235, 0.1));
    color: inherit;
    border-color: var(--rwpc-primary-color, #2563eb);
}

.wpc-layout-minimal .wpc-option-card.selected .wpc-option-name,
.wpc-layout-minimal .wpc-option-card.selected .wpc-price-modifier {
    color: inherit;
}

.wpc-layout-minimal .wpc-selected-indicator {
    background: var(--rwpc-primary-color, #2563eb);
    color: white;
}

/* Classic Layout - Traditional Style */
.wpc-layout-classic .wpc-option-card {
    border-radius: 0;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.12),
        0 1px 2px rgba(0, 0, 0, 0.24);
    border: 2px solid #e5e7eb;
    background: #ffffff;
}

.wpc-layout-classic .wpc-option-card:hover {
    box-shadow:
        0 3px 6px rgba(0, 0, 0, 0.16),
        0 3px 6px rgba(0, 0, 0, 0.23);
    transform: translateY(-1px);
    border-color: var(--rwpc-primary-color, #2563eb);
}

.wpc-layout-classic .wpc-option-card.selected {
    border-color: var(--rwpc-primary-color, #2563eb);
    border-width: 3px;
    background: var(--rwpc-classic-selected-bg, rgba(37, 99, 235, 0.06));
}

.wpc-layout-classic .wpc-selected-indicator {
    background: var(--rwpc-primary-color, #2563eb);
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Secondary color applications */
.wpc-component-description,
.wpc-option-description {
    color: var(--rwpc-secondary-color, #6b7280);
}

/* Price Modifier Visibility Control */
.wpc-hide-price-modifiers .wpc-price-modifier {
    display: none !important;
}
