/* WooCommerce Product Configurator - Frontend Styles */

/* Configure Button Wrapper */
.wpc-configure-wrapper {
    display: inline-block;
    margin: 0;
    padding: 0;
    border: none;
    width: auto;
}

/* Configure Button */
.wpc-configure-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #FFCC00;
    color: #000 !important;
    border: none;
    padding: 6px 12px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(255, 204, 0, 0.3);
    min-width: 140px;
}

.wpc-configure-button:hover {
    background-color: #E6B800;
    color: #000 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 204, 0, 0.4);
}

.wpc-configure-button:active {
    transform: translateY(0);
}

.wpc-configure-button .dashicons {
    margin-right: 5px;
    font-size: 16px;
}

.wpc-required-notice {
    margin-top: 10px;
    color: #d63638;
    font-size: 14px;
    font-weight: 500;
    font-style: italic;
}

.wpc-no-materials-message {
    margin-top: 10px;
    padding: 12px;
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
    font-size: 14px;
    border-radius: 4px;
}

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

.wpc-modal.wpc-modal-open {
    display: block;
}

.wpc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    animation: wpc-fade-in 0.3s ease;
}

/* Modal Content */
.wpc-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 92%;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: wpc-slide-in 0.3s ease;
}

/* Modal Header */
.wpc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 2px solid #FFCC00;
    background: linear-gradient(135deg, #FFFBF0 0%, #ffffff 100%);
}

.wpc-modal-header h2 {
    margin: 0;
    font-size: 26px;
    color: #222;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.wpc-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.wpc-modal-close:hover {
    color: #333;
    background-color: #f0f0f0;
}

/* Modal Body */
.wpc-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.wpc-configuration-section {
    margin-bottom: 35px;
}

.wpc-configuration-section:last-of-type {
    margin-bottom: 0;
}

.wpc-configuration-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid #FFCC00;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wpc-required-badge {
    font-size: 12px;
    font-weight: 500;
    color: #d63638;
    background-color: #fff0f0;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #ffb3b3;
}

/* Materials Grid */
.wpc-materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.wpc-material-option {
    position: relative;
}

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

.wpc-material-label {
    display: block;
    padding: 18px;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background-color: #fff;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.wpc-material-label:hover {
    border-color: #FFCC00;
    box-shadow: 0 4px 12px rgba(255, 204, 0, 0.15);
    transform: translateY(-2px);
}

.wpc-material-option input[type="radio"]:checked + .wpc-material-label {
    border-color: #FFCC00;
    background: linear-gradient(135deg, #FFFDF7 0%, #FFFBF0 100%);
    box-shadow: 0 4px 16px rgba(255, 204, 0, 0.25);
}

.wpc-material-option input[type="radio"]:checked + .wpc-material-label::before {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background-color: #FFCC00;
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.wpc-material-label.wpc-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.5);
}

.wpc-material-name {
    font-weight: 600;
    font-size: 15px;
    color: #222;
    margin-bottom: 6px;
    line-height: 1.3;
}

.wpc-material-description {
    font-size: 12px;
    color: #777;
    margin-bottom: 8px;
    line-height: 1.4;
}

.wpc-material-price {
    font-size: 14px;
    color: #CC9900;
    font-weight: 700;
    margin-top: auto;
}

/* Price Summary */
.wpc-price-summary {
    background: linear-gradient(135deg, #FFFDF7 0%, #FFF9E6 100%);
    padding: 20px 24px;
    border-radius: 10px;
    margin-top: 20px;
    border: 2px solid #FFCC00;
    box-shadow: 0 2px 8px rgba(255, 204, 0, 0.1);
}

.wpc-price-summary > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 15px;
    align-items: center;
}

.wpc-price-summary > div:last-child {
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 2px solid #FFCC00;
    margin-top: 12px;
}

.wpc-total-price {
    font-size: 19px !important;
}

.wpc-total-price strong {
    color: #222;
}

.wpc-additional-prices {
    margin-top: 8px;
    padding: 8px 0;
}

.wpc-category-price {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    padding: 6px 10px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
}

.wpc-category-price span:first-child {
    font-weight: 500;
}

.wpc-category-price span:last-child {
    color: #CC9900;
    font-weight: 700;
}

/* Modal Footer */
.wpc-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 32px 24px;
    border-top: 2px solid #f0f0f0;
    background: #fafafa;
}

.wpc-skip-configuration-wrapper {
    width: 100%;
    padding: 8px 0;
}

.wpc-skip-configuration-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    user-select: none;
    transition: color 0.2s;
}

.wpc-skip-configuration-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    accent-color: #FFCC00;
}

.wpc-skip-configuration-label:hover {
    color: #333;
}

.wpc-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.wpc-modal-footer .button {
    padding: 12px 28px;
    font-size: 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    border: none;
}

.wpc-cancel-btn {
    background-color: #f5f5f5;
    color: #555;
    border: 2px solid #ddd;
}

.wpc-cancel-btn:hover {
    background-color: #e8e8e8;
    border-color: #ccc;
}

.wpc-add-to-cart-configured {
    background-color: #FFCC00;
    color: #000;
    border: none;
    box-shadow: 0 2px 6px rgba(255, 204, 0, 0.3);
}

.wpc-add-to-cart-configured:hover:not(:disabled) {
    background-color: #E6B800;
    box-shadow: 0 4px 12px rgba(255, 204, 0, 0.4);
    transform: translateY(-1px);
}

.wpc-add-to-cart-configured:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading State */
.wpc-loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.wpc-loading .wpc-btn-text {
    opacity: 0;
}

.wpc-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #FFCC00;
    border-radius: 50%;
    animation: wpc-spin 1s linear infinite;
}

/* Success and Error Messages */
.wpc-success-message,
.wpc-error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000000;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}

.wpc-success-message {
    background-color: #46b450;
    color: #fff;
}

.wpc-error-message {
    background-color: #dc3232;
    color: #fff;
}

.wpc-message-show {
    transform: translateX(0);
    opacity: 1;
}

.wpc-message-icon {
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

/* Animations */
@keyframes wpc-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes wpc-slide-in {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes wpc-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Prevent body scroll when modal is open */
body.wpc-modal-active {
    overflow: hidden !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wpc-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .wpc-materials-grid {
        grid-template-columns: 1fr;
    }
    
    .wpc-modal-header {
        padding: 20px;
    }
    
    .wpc-modal-header h2 {
        font-size: 20px;
    }
    
    .wpc-modal-body {
        padding: 20px;
    }
    
    .wpc-modal-footer {
        padding: 15px 20px;
    }
    
    .wpc-modal-buttons {
        flex-direction: column;
    }
    
    .wpc-modal-footer .button {
        width: 100%;
    }
    
    .wpc-success-message,
    .wpc-error-message {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
}

@media (max-width: 480px) {
    .wpc-configure-button {
        width: 100%;
        justify-content: center;
    }
}

/* Hide default add to cart when configuration is required */
/* This is handled by inline CSS in PHP for product-specific control */
