/**
 * Form Components
 *
 * Depth-based form inputs with layered backgrounds
 * No borders - uses color hierarchy for visual depth
 *
 * @package MattressProtectorReviews
 * @version 2.0.0 - Design System Transformation
 */

/* ============================================
   PRODUCT SELECTOR BAR
   ============================================ */
.product-selector-bar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background-color: var(--gray-900);
    padding: 1rem 0;
    box-shadow: var(--shadow-medium);
}

.product-selector {
    width: 100%;
    max-width: 500px;
    padding: var(--input-padding-y) var(--input-padding-x);
    min-height: 44px;
    font-size: var(--text-base);
    border: none;
    border-radius: var(--input-border-radius);
    background: var(--layer-3);
    box-shadow: var(--shadow-small);
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text-heading);
}

.product-selector:hover {
    background: var(--layer-4);
    box-shadow: var(--shadow-medium);
}

.product-selector:focus {
    outline: none;
    background: var(--white);
    box-shadow: 0 0 0 3px var(--blue-100), var(--shadow-medium);
}

/* ============================================
   FORM CONTROLS
   ============================================ */
.mpr-form-group {
    margin-bottom: var(--space-md);
}

.mpr-form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
}

.mpr-form-label.required::after {
    content: '*';
    color: var(--red-600);
    margin-left: 0.25rem;
}

.mpr-form-help {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 0.375rem;
}

/* ============================================
   INPUT FIELDS
   ============================================ */
.mpr-form-control,
.mpr-input,
.mpr-textarea,
.mpr-select {
    width: 100%;
    padding: var(--input-padding-y) var(--input-padding-x);
    font-size: var(--text-base);
    font-family: inherit;
    color: var(--text-heading);
    background: var(--layer-3);
    border: none;
    border-radius: var(--input-border-radius);
    box-shadow: var(--shadow-small);
    transition: all var(--transition-base);
    appearance: none;
}

.mpr-form-control:hover,
.mpr-input:hover,
.mpr-textarea:hover,
.mpr-select:hover {
    background: var(--layer-4);
}

.mpr-form-control:focus,
.mpr-input:focus,
.mpr-textarea:focus,
.mpr-select:focus {
    outline: none;
    background: var(--white);
    box-shadow: 0 0 0 3px var(--blue-100), var(--shadow-large);
}

.mpr-form-control:disabled,
.mpr-input:disabled,
.mpr-textarea:disabled,
.mpr-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--layer-2);
}

/* Textarea specific */
.mpr-textarea {
    min-height: 120px;
    resize: vertical;
}

/* ============================================
   SELECT DROPDOWNS
   ============================================ */
.mpr-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%234B5563' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

.mpr-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%232563EB' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E");
}

/* ============================================
   CHECKBOX & RADIO
   ============================================ */
.mpr-checkbox-wrapper,
.mpr-radio-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: var(--space-sm);
    cursor: pointer;
}

.mpr-checkbox,
.mpr-radio {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    background: var(--layer-3);
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-small);
    cursor: pointer;
    transition: all var(--transition-base);
    appearance: none;
    position: relative;
}

.mpr-radio {
    border-radius: 50%;
}

.mpr-checkbox:hover,
.mpr-radio:hover {
    background: var(--layer-4);
    box-shadow: var(--shadow-medium);
}

.mpr-checkbox:checked,
.mpr-radio:checked {
    background: var(--gradient-primary);
    box-shadow: var(--highlight-top), 0 2px 4px rgba(37, 99, 235, 0.3);
}

.mpr-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.5rem;
    height: 0.75rem;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: translate(-50%, -60%) rotate(45deg);
}

.mpr-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.5rem;
    height: 0.5rem;
    background: white;
    border-radius: 50%;
}

.mpr-checkbox:focus,
.mpr-radio:focus {
    outline: 2px solid var(--blue-300);
    outline-offset: 2px;
}

.mpr-checkbox-label,
.mpr-radio-label {
    font-size: var(--text-sm);
    color: var(--text-body);
    user-select: none;
}

/* ============================================
   FORM VALIDATION STATES
   ============================================ */
.mpr-form-control.is-valid,
.mpr-input.is-valid {
    background: var(--green-50);
    box-shadow: inset 0 0 0 1px var(--green-200), var(--shadow-small);
}

.mpr-form-control.is-invalid,
.mpr-input.is-invalid {
    background: var(--red-50);
    box-shadow: inset 0 0 0 1px var(--red-200), var(--shadow-small);
}

.mpr-form-control.is-warning,
.mpr-input.is-warning {
    background: var(--yellow-50);
    box-shadow: inset 0 0 0 1px var(--yellow-200), var(--shadow-small);
}

.mpr-feedback {
    display: block;
    font-size: var(--text-xs);
    margin-top: 0.375rem;
    font-weight: 500;
}

.mpr-feedback.valid {
    color: var(--green-700);
}

.mpr-feedback.invalid {
    color: var(--red-700);
}

.mpr-feedback.warning {
    color: var(--yellow-700);
}

/* ============================================
   INPUT GROUPS
   ============================================ */
.mpr-input-group {
    display: flex;
    gap: 0.5rem;
}

.mpr-input-group .mpr-input {
    flex: 1;
}

.mpr-input-addon {
    display: flex;
    align-items: center;
    padding: var(--input-padding-y) var(--input-padding-x);
    background: var(--layer-3);
    border-radius: var(--input-border-radius);
    box-shadow: var(--shadow-small);
    font-size: var(--text-sm);
    color: var(--text-caption);
    white-space: nowrap;
}

/* ============================================
   SEARCH INPUT
   ============================================ */
.mpr-search-input {
    position: relative;
}

.mpr-search-input input {
    padding-left: 2.75rem;
}

.mpr-search-input::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%236B7280' d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
}

/* ============================================
   RANGE SLIDER
   ============================================ */
.mpr-range {
    width: 100%;
    height: 0.5rem;
    background: var(--layer-3);
    border-radius: var(--radius-full);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    outline: none;
    appearance: none;
}

.mpr-range::-webkit-slider-thumb {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--highlight-top), 0 2px 4px rgba(37, 99, 235, 0.3);
    transition: all var(--transition-base);
}

.mpr-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--highlight-strong), 0 3px 6px rgba(37, 99, 235, 0.4);
}

.mpr-range::-moz-range-thumb {
    width: 1.25rem;
    height: 1.25rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--highlight-top), 0 2px 4px rgba(37, 99, 235, 0.3);
    transition: all var(--transition-base);
}

.mpr-range::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--highlight-strong), 0 3px 6px rgba(37, 99, 235, 0.4);
}

/* ============================================
   FILE INPUT
   ============================================ */
.mpr-file-input-wrapper {
    position: relative;
    display: inline-block;
}

.mpr-file-input {
    position: absolute;
    opacity: 0;
    width: 0.1px;
    height: 0.1px;
}

.mpr-file-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: var(--btn-padding-y) var(--btn-padding-x);
    background: var(--layer-3);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-small);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-body);
}

.mpr-file-label:hover {
    background: var(--layer-4);
    box-shadow: var(--shadow-medium);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .mpr-form-control,
    .mpr-input,
    .mpr-select {
        font-size: var(--text-base);
        min-height: 44px;
    }

    .mpr-input-group {
        flex-direction: column;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .mpr-form-control,
    .mpr-input,
    .mpr-select,
    .mpr-checkbox,
    .mpr-radio {
        transition: none;
    }
}
