/**
 * PhotoSoul Product Personalizer Frontend Stylesheet
 */

.psp-personalizer-wrapper {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0 25px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    font-family: inherit;
    box-sizing: border-box;
}

.psp-personalizer-wrapper * {
    box-sizing: border-box;
}

.psp-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 20px !important;
    padding-bottom: 10px;
    border-bottom: 2px solid #edf2f7;
}

.psp-form-field-group {
    margin-bottom: 20px;
}

.psp-form-field-group:last-child {
    margin-bottom: 0;
}

.psp-input-label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: #4a5568;
    margin-bottom: 8px;
}

.psp-required {
    color: #e53e3e;
    margin-left: 2px;
}

.psp-label-hint {
    font-weight: 400;
    font-size: 0.75rem;
    color: #718096;
    margin-left: 4px;
}

.psp-char-limit-hint {
    float: right;
    font-size: 0.75rem;
    color: #a0aec0;
}

/* Form Inputs */
.psp-text-input,
.psp-textarea-input,
.psp-date-input,
.psp-number-input,
.psp-email-input,
.psp-select-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.925rem;
    color: #334155;
    background-color: #f8fafc;
    transition: all 0.2s ease-in-out;
}

.psp-text-input:focus,
.psp-textarea-input:focus,
.psp-date-input:focus,
.psp-number-input:focus,
.psp-email-input:focus,
.psp-select-input:focus {
    border-color: #6366f1;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    outline: none;
}

.psp-textarea-input {
    min-height: 90px;
    resize: vertical;
}

.psp-checkbox-label {
    display: inline-flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: #334155;
    user-select: none;
}

.psp-checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 3px;
    accent-color: #6366f1;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.psp-checkbox-label .psp-addon-price {
    font-weight: 600;
    color: #4f46e5;
}

/* Drag & Drop Zone */
.psp-drag-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.psp-drag-drop-zone:hover,
.psp-drag-drop-zone.psp-drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.04);
}

.psp-drag-drop-inside {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.psp-upload-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.7;
    transition: transform 0.2s ease-in-out;
}

.psp-drag-drop-zone:hover .psp-upload-icon {
    transform: translateY(-3px);
}

.psp-upload-text {
    font-weight: 500;
    font-size: 0.9rem;
    color: #475569;
    margin: 0 0 5px 0 !important;
}

.psp-upload-limits {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0 !important;
}

/* Previews Grid */
.psp-upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.psp-preview-item {
    position: relative;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    user-select: none;
}

.psp-preview-item:active {
    cursor: grabbing;
}

.psp-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Remove button overlay */
.psp-remove-preview-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: background 0.15s ease-in-out;
}

.psp-remove-preview-btn:hover {
    background: rgb(220, 38, 38);
}

/* Progress bar inside preview */
.psp-preview-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
}

.psp-preview-progress-bar {
    width: 0%;
    height: 100%;
    background: #6366f1;
    transition: width 0.1s linear;
}

/* Sorting handles */
.psp-preview-item.ui-sortable-placeholder {
    background: #edf2f7;
    border: 2px dashed #cbd5e1;
    visibility: visible !important;
}

/* Dynamic Addon wrappers */
.psp-addons-section {
    border-top: 1px solid #edf2f7;
    padding-top: 15px;
    margin-top: 15px;
}

.psp-addon-item {
    margin-bottom: 12px;
}

.psp-addon-item:last-child {
    margin-bottom: 0;
}

/* Image Cropper Modal */
.psp-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.psp-modal.psp-modal-show {
    display: flex;
}

.psp-modal-content {
    background-color: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: pspScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pspScaleUp {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

.psp-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 !important;
}

.psp-modal-close {
    font-size: 24px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease-in-out;
}

.psp-modal-close:hover {
    color: #0f172a;
}

.psp-modal-body {
    padding: 20px;
    background: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
}

.psp-cropper-container {
    max-height: 350px;
    width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.psp-cropper-container img {
    max-width: 100%;
    max-height: 350px;
}

.psp-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.psp-modal-btn {
    padding: 8px 16px !important;
    font-size: 0.875rem !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
}

.psp-modal-btn-cancel {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
}

.psp-modal-btn-cancel:hover {
    background: #f1f5f9 !important;
}

.psp-modal-btn-crop {
    background: #6366f1 !important;
    border-color: #6366f1 !important;
    color: #ffffff !important;
}

.psp-modal-btn-crop:hover {
    background: #4f46e5 !important;
}
