/* ──────────────────────────────────────────────
   rhx-file-input — Styled file drop zone with
   drag-and-drop, file list, and size validation
   ────────────────────────────────────────────── */

.rhx-file-input {
    display: flex;
    flex-direction: column;
    gap: var(--rhx-space-sm);
    width: 100%;
}

/* ── Label ── */

.rhx-file-input__label {
    font-size: var(--rhx-font-size-sm);
    font-weight: var(--rhx-font-weight-medium);
    color: var(--rhx-color-text);
}

/* ── Drop zone ── */

.rhx-file-input__dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--rhx-space-sm);
    padding: var(--rhx-space-xl) var(--rhx-space-lg);
    border: 2px dashed var(--rhx-color-border);
    border-radius: var(--rhx-radius-lg);
    background: var(--rhx-color-surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    text-align: center;
}

.rhx-file-input__dropzone:hover {
    border-color: var(--rhx-color-brand-500);
    background: var(--rhx-color-neutral-50, rgba(0, 0, 0, 0.02));
}

/* Drag-over state (set by JS) */
.rhx-file-input__dropzone[data-rhx-dragover] {
    border-color: var(--rhx-color-brand-500);
    background: var(--rhx-color-brand-50, rgba(59, 130, 246, 0.05));
}

/* Focus ring when native input is focused */
.rhx-file-input__dropzone:focus-within {
    outline: 2px solid var(--rhx-color-brand-500);
    outline-offset: 2px;
}

/* ── Upload icon ── */

.rhx-file-input__icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--rhx-color-text-muted);
}

/* ── Text ── */

.rhx-file-input__text {
    font-size: var(--rhx-font-size-sm);
    color: var(--rhx-color-text-muted);
}

.rhx-file-input__text strong {
    color: var(--rhx-color-brand-500);
    font-weight: var(--rhx-font-weight-medium);
}

/* ── File list ── */

.rhx-file-input__file-list {
    display: flex;
    flex-direction: column;
    gap: var(--rhx-space-xs);
}

.rhx-file-input__file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--rhx-space-sm) var(--rhx-space-md);
    background: var(--rhx-color-neutral-50, rgba(0, 0, 0, 0.02));
    border-radius: var(--rhx-radius-md);
    font-size: var(--rhx-font-size-sm);
}

.rhx-file-input__file-name {
    color: var(--rhx-color-text);
    font-weight: var(--rhx-font-weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.rhx-file-input__file-size {
    color: var(--rhx-color-text-muted);
    font-size: var(--rhx-font-size-xs);
    margin-left: var(--rhx-space-sm);
    flex-shrink: 0;
}

.rhx-file-input__file-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: none;
    background: none;
    color: var(--rhx-color-text-muted);
    cursor: pointer;
    padding: 0;
    margin-left: var(--rhx-space-sm);
    border-radius: var(--rhx-radius-full);
    flex-shrink: 0;
}

.rhx-file-input__file-remove:hover {
    color: var(--rhx-color-danger-500);
    background: var(--rhx-color-danger-50, rgba(239, 68, 68, 0.1));
}

.rhx-file-input__file-error {
    color: var(--rhx-color-danger-500);
    font-size: var(--rhx-font-size-xs);
}

/* ── Hint ── */

.rhx-file-input__hint {
    font-size: var(--rhx-font-size-xs);
    color: var(--rhx-color-text-muted);
}

/* ── Error ── */

.rhx-file-input__error {
    font-size: var(--rhx-font-size-xs);
    color: var(--rhx-color-danger-500);
}

.rhx-file-input--error .rhx-file-input__dropzone,
.rhx-file-input[data-rhx-invalid] .rhx-file-input__dropzone {
    border-color: var(--rhx-color-danger-500);
}

/* ── Disabled ── */

.rhx-file-input--disabled {
    opacity: 0.5;
    pointer-events: none;
}

.rhx-file-input--disabled .rhx-file-input__dropzone {
    cursor: default;
}

/* ── Size variants ── */

.rhx-file-input--small .rhx-file-input__dropzone {
    padding: var(--rhx-space-md) var(--rhx-space-md);
}

.rhx-file-input--small .rhx-file-input__icon {
    width: 1.75rem;
    height: 1.75rem;
}

.rhx-file-input--large .rhx-file-input__dropzone {
    padding: var(--rhx-space-2xl) var(--rhx-space-xl);
}

.rhx-file-input--large .rhx-file-input__icon {
    width: 3rem;
    height: 3rem;
}

/* ── Screen-reader only ── */

.rhx-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
    .rhx-file-input__dropzone {
        transition: none;
    }
}
