/* Page Builder Form Controls Styles */

/* Image Upload Control */
.image-upload-container .dropzone {
    border: 2px dashed #dee2e6;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-upload-container .dropzone:hover {
    border-color: #0d6efd;
    background-color: #e7f1ff;
}

.image-upload-container .dropzone.dz-drag-hover {
    border-color: #0d6efd;
    background-color: #e7f1ff;
}

.image-upload-container .dz-message {
    margin: 0;
}

.image-upload-container .dz-button {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.image-upload-container .dz-button:hover {
    color: #0d6efd;
}

.image-upload-container .dz-preview {
    display: inline-block;
    position: relative;
    margin: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
    background: #fff;
}

.image-upload-container .dz-preview .dz-image {
    width: 120px;
    height: 120px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.image-upload-container .dz-preview .dz-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.image-upload-container .dz-preview .dz-remove {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(220, 53, 69, 0.95);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50; /* ensure above image */
    padding: 0;
    line-height: 1;
    font-size: 0; /* hide default text label */
}

/* show trash icon */
.image-upload-container .dz-preview .dz-remove::before {
    content: "";
    display: block;
    width: 16px;
    height: 16px;
    background-color: #fff; /* icon color */
    -webkit-mask: url('/assets/icons/trash.svg') no-repeat center / contain;
            mask: url('/assets/icons/trash.svg') no-repeat center / contain;
}

.image-upload-container .dz-preview .dz-remove:hover {
    background: #dc3545;
}

/* Repeater Control */
.repeater-container {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    background-color: #f8f9fa;
}

.repeater-header {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.repeater-count {
    font-weight: 600;
    color: #0d6efd;
}

.repeater-add-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.repeater-add-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.repeater-items {
    max-height: 400px;
    overflow-y: auto;
}

.repeater-item {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}

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

.repeater-item h6 {
    color: #495057;
    font-weight: 600;
    margin: 0;
}

.repeater-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
}

.repeater-remove-btn:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

/* Checkbox Group Control */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.checkbox-group .form-check {
    margin-bottom: 0;
}

.checkbox-group .form-check-input {
    margin-top: 0.125rem;
}

.checkbox-group .form-check-label {
    font-weight: normal;
    color: #495057;
}

/* Form Field Groups */
.form-field-group {
    margin-bottom: 1rem;
}

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

.form-hint {
    display: block;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    color: #6c757d;
    font-size: 0.875rem;
}

/* Select Control Enhancements */
.form-select:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .repeater-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .repeater-add-btn {
        justify-content: center;
    }
    
    .image-upload-container .dropzone {
        padding: 1rem;
        min-height: 100px;
    }
    
    .image-upload-container .dz-preview .dz-image {
        width: 80px;
        height: 80px;
    }
}

/* Animation for adding/removing items */
.repeater-item {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading states */
.repeater-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

.image-upload-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Error states */
.form-field-group.has-error .form-control,
.form-field-group.has-error .form-select {
    border-color: #dc3545;
}

.form-field-group.has-error .form-hint {
    color: #dc3545;
}

/* Success states */
.form-field-group.has-success .form-control,
.form-field-group.has-success .form-select {
    border-color: #198754;
}

.form-field-group.has-success .form-hint {
    color: #198754;
}
