/**
 * Super Product Options Pro - Frontend Styles
 * Version: 2.0.0
 */

/* ==========================================================================
   Container
   ========================================================================== */
.spo-options-container {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ==========================================================================
   Option Group
   ========================================================================== */
.spo-option-group {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.spo-option-group:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.spo-group-title {
    margin: 0 0 12px;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.spo-group-title .required {
    color: #e74c3c;
    font-weight: normal;
    text-decoration: none;
    border: none;
}

.spo-group-options {
    margin-top: 10px;
}

/* Hidden state for conditional groups */
.spo-option-group.spo-hidden {
    display: none;
}

/* ==========================================================================
   Included Items
   ========================================================================== */
.spo-included-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #f0f9f0;
    border: 1px solid #c3e6c3;
    border-radius: 6px;
    color: #2d5a2d;
    font-size: 0.95em;
}

.spo-included-icon {
    color: #27ae60;
    font-weight: bold;
}

.spo-included-item .spo-choice-description {
    color: #5a855a;
}

/* ==========================================================================
   Radio & Checkbox Choices
   ========================================================================== */
.spo-choice-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spo-choice-label:hover {
    border-color: #667eea;
    background: #f5f6ff;
}

.spo-choice-label.spo-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f5;
}

.spo-choice-label.spo-disabled:hover {
    border-color: #e0e0e0;
    background: #f5f5f5;
}

.spo-choice-label input[type="radio"],
.spo-choice-label input[type="checkbox"] {
    margin-top: 3px;
    accent-color: #667eea;
}

.spo-choice-label input:checked + .spo-choice-text {
    color: #333;
    font-weight: 500;
}

.spo-choice-label:has(input:checked) {
    border-color: #667eea;
    background: #f0f2ff;
}

.spo-choice-text {
    flex: 1;
    line-height: 1.4;
}

.spo-choice-description {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-top: 4px;
}

/* ==========================================================================
   Price Display
   ========================================================================== */
.spo-price-addon {
    color: #667eea;
    font-weight: 600;
    font-size: 0.95em;
    margin-left: 5px;
}

/* Stock Labels */
.spo-out-of-stock {
    color: #e74c3c;
    font-size: 0.85em;
    font-weight: 500;
}

.spo-low-stock {
    color: #f39c12;
    font-size: 0.85em;
    font-weight: 500;
}

/* ==========================================================================
   Select Dropdown
   ========================================================================== */
.spo-select {
    width: 100%;
    max-width: 400px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.spo-select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.spo-select option:disabled {
    color: #999;
}

/* ==========================================================================
   Text & Textarea Inputs
   ========================================================================== */
.spo-text-wrapper,
.spo-textarea-wrapper,
.spo-number-wrapper,
.spo-date-wrapper {
    position: relative;
}

.spo-text-input,
.spo-textarea-input,
.spo-number-input,
.spo-date-input {
    width: 100%;
    max-width: 400px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.2s ease;
}

.spo-textarea-input {
    max-width: 100%;
    resize: vertical;
    min-height: 100px;
}

.spo-text-input:focus,
.spo-textarea-input:focus,
.spo-number-input:focus,
.spo-date-input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.spo-char-counter {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #888;
}

.spo-chars-remaining {
    font-weight: 600;
    color: #667eea;
}

.spo-text-price,
.spo-number-price,
.spo-date-price {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    color: #667eea;
}

/* ==========================================================================
   Color Swatches
   ========================================================================== */
.spo-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.spo-swatch {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.spo-swatch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.spo-color-swatch .spo-swatch-color {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.spo-color-swatch:hover .spo-swatch-color {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.spo-color-swatch input:checked + .spo-swatch-color {
    border-color: #667eea;
    box-shadow: 0 0 0 3px #667eea, 0 4px 12px rgba(0, 0, 0, 0.2);
}

.spo-swatch-label {
    margin-top: 6px;
    font-size: 0.8em;
    color: #666;
    text-align: center;
    max-width: 60px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spo-swatch-price {
    font-size: 0.75em;
    color: #667eea;
    font-weight: 600;
}

.spo-swatch.spo-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spo-swatch.spo-disabled .spo-swatch-color::after,
.spo-swatch.spo-disabled .spo-swatch-image::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e74c3c;
    transform: rotate(-45deg);
}

/* ==========================================================================
   Image Swatches
   ========================================================================== */
.spo-image-swatch {
    width: 80px;
}

.spo-image-swatch .spo-swatch-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 3px solid #e0e0e0;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.spo-image-swatch .spo-swatch-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.spo-image-swatch .spo-no-image {
    color: #ccc;
    font-size: 24px;
}

.spo-image-swatch:hover .spo-swatch-image {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.spo-image-swatch input:checked + .spo-swatch-image {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.spo-image-swatch .spo-swatch-label {
    max-width: 80px;
}

/* ==========================================================================
   Date Picker
   ========================================================================== */
.spo-date-input {
    max-width: 200px;
}

/* ==========================================================================
   Validation Errors
   ========================================================================== */
.spo-option-group.spo-error .spo-group-title {
    color: #e74c3c;
}

.spo-option-group.spo-error .spo-choice-label,
.spo-option-group.spo-error .spo-select,
.spo-option-group.spo-error .spo-text-input,
.spo-option-group.spo-error .spo-textarea-input,
.spo-option-group.spo-error .spo-number-input,
.spo-option-group.spo-error .spo-date-input {
    border-color: #e74c3c;
}

.spo-error-message {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: 5px;
}

/* ==========================================================================
   Price Summary
   ========================================================================== */
.spo-price-summary {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.spo-price-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.spo-price-summary-row:last-child {
    margin-bottom: 0;
    padding-top: 8px;
    border-top: 1px solid #ddd;
    font-weight: 600;
}

.spo-price-summary-label {
    color: #666;
}

.spo-price-summary-value {
    color: #333;
}

/* ==========================================================================
   Animation
   ========================================================================== */
@keyframes spo-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

.spo-option-group.spo-shake {
    animation: spo-shake 0.5s ease-in-out;
}

/* Fade in for conditional groups */
@keyframes spo-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spo-option-group.spo-fade-in {
    animation: spo-fade-in 0.3s ease-out;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .spo-swatches {
        gap: 8px;
    }
    
    .spo-color-swatch .spo-swatch-color {
        width: 40px;
        height: 40px;
    }
    
    .spo-image-swatch,
    .spo-image-swatch .spo-swatch-image {
        width: 60px;
        height: 60px;
    }
    
    .spo-text-input,
    .spo-textarea-input,
    .spo-number-input,
    .spo-date-input,
    .spo-select {
        max-width: 100%;
    }
}

/* ==========================================================================
   Dark Mode Support (for themes that use it)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .spo-choice-label {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .spo-choice-label:hover {
        background: #333;
    }
    
    .spo-group-title {
        color: #f0f0f0;
    }
    
    .spo-choice-text {
        color: #e0e0e0;
    }
    
    .spo-choice-description {
        color: #aaa;
    }
}
