/* Frontend Styles for Product Customization */

/* Preview Section */
.customization-preview {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border: 2px solid #000;
    border-radius: 0;
}

.customization-preview h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #000;
    font-weight: 600;
}

.customization-preview .preview-disclaimer {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.preview-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.preview-back-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.preview-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.preview-text {
    position: absolute;
    white-space: nowrap;
    user-select: none;
    font-size-adjust: 0.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Outline will be applied via JavaScript with custom color */
.preview-text.outlined {
    /* Text shadow will be set dynamically */
}

.preview-name {
    /* Positioning will be set via JavaScript from previewConfig */
}

.preview-number {
    /* Positioning will be set via JavaScript from previewConfig */
}


.product-customization-fields h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
    color: #333;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}

.customization-section {
    background: rgb(234, 235, 240);
    padding: 15px;
    margin-bottom: 20px;
}

.customization-section:last-child {
    margin-bottom: 0;
}

.customization-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 400;
    color: #000000;
}

.custom-field-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    align-items: flex-end;
}

.custom-field-row .custom-field-group {
    flex: 1;
    margin-bottom: 0;
}

.custom-field-row .custom-field-group.checkbox-group {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.custom-field-row .custom-field-group.checkbox-group label {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.custom-field-row .custom-field-group.checkbox-group input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.custom-field-row.color-row {
    align-items: flex-end;
    justify-content: flex-start;
    background: #fafafa;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.custom-field-row.color-row .custom-field-group {
    flex: 0 0 auto;
}

.custom-field-row.color-row .custom-field-group:first-child,
.custom-field-row.color-row .custom-field-group:last-child {
    flex: 0 0 120px;
}

.custom-field-group {
    margin-bottom: 15px;
}

.custom-field-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

.custom-field-group .custom-input,
.custom-field-group .custom-select {
    width: 100%;
    max-width: 500px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.custom-field-group .custom-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.custom-field-group .custom-input:focus,
.custom-field-group .custom-select:focus,
.custom-field-group .custom-textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.custom-field-group .custom-color {
    width: 80px;
    height: 40px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.custom-field-group.checkbox-group {
    margin-top: 10px;
}

.custom-field-group.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.custom-field-group.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

.custom-file-input {
    display: block;
    margin-top: 8px;
    font-size: 14px;
}

.file-preview {
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border: 1px dashed #ddd;
    border-radius: 4px;
    display: none;
}

.file-preview.active {
    display: block;
}

.file-preview img {
    max-width: 200px;
    max-height: 200px;
    display: block;
    margin-top: 10px;
    border-radius: 4px;
}

.file-preview .file-name {
    font-weight: 600;
    color: #333;
    word-break: break-all;
}

.file-preview .remove-file {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: #dc3232;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s;
}

.file-preview .remove-file:hover {
    background: #c62d2d;
}

.description {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Loading Overlay */
.customization-loading {
    position: relative;
}

.customization-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Responsive */
@media (max-width: 768px) {
    .product-customization-fields {
        padding: 15px;
    }
    
    .customization-section {
        padding: 15px;
    }
    
    .custom-field-group .custom-input,
    .custom-field-group .custom-select {
        max-width: 100%;
    }
    
    .custom-field-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .custom-field-row .custom-field-group {
        margin-bottom: 0;
    }
    
    /* Scale down preview text on mobile */
    .preview-text {
        font-size: 0.7em !important;
    }
    
    .customization-preview {
        padding: 15px;
    }
}

/* Custom Font Select Styling */
.custom-font-select option {
    padding: 10px 12px;
    font-size: 16px;
}

/* Font preview in select - each option will have its font applied */
.custom-font-select option[class*="font-option-"] {
    padding: 12px;
    font-size: 18px;
}
