.text-input-container {
    position: relative;
    width: 100%;
}

.text-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--text-border-color);
    border-radius: 0.5rem;
    padding: 0 1rem;
    background: white;
    transition: all 0.2s ease;
    min-height: 4rem;
}

.text-input-container.focused .text-input-wrapper {
    border-color: var(--primary-blue);
}

.text-input-field {
    flex: 1;
    border: none;
    outline: none;
    padding: 1.25rem 0 0.5rem 0;
    font-size: 1rem;
    font-family: inherit;
    color: #333;
    background: transparent;
    transition: all 0.2s ease;
}

.text-input-field::placeholder {
    color: transparent;
}

.text-input-label {
    position: absolute;
    left: 1rem;
    font-size: 1rem;
    color: #757575;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left center;
    top: 50%;
    transform: translateY(-50%);
}

.text-input-label.shrink {
    top: 0.5rem;
    font-size: 0.75rem;
    color: var(--primary-blue);
    transform: translateY(0);
}

/* Override shrink color for disabled containers - must come after .text-input-label.shrink */
.text-input-container.disabled .text-input-label.shrink,
.text-input-container.disabled.focused .text-input-label.shrink {
    color: #666 !important;
}

.text-input-container.focused .text-input-label:not(.shrink) {
    color: var(--primary-blue);
}

.text-input-underline {
    display: none;
}

/* Password toggle button */
.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.password-toggle:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

.password-toggle .icon-eye-open,
.password-toggle .icon-eye-closed {
    width: 18px;
    height: 18px;
    display: none;
}

/* Show eye-open when pressed (password visible) */
.password-toggle[aria-pressed="true"] .icon-eye-open { display: block; }

/* Show eye-closed when not pressed (password hidden) */
.password-toggle[aria-pressed="false"] .icon-eye-closed { display: block; }

/* Sprite-based eye icon (closed on left, open on right) */
.password-toggle .icon-eye {
    width: 20px;
    height: 20px;
    display: inline-block;
    background-image: url('https://simages.ecampus.com/images/auth/visibility_sprite.svg');
    background-repeat: no-repeat;
    /* sprite contains two 20x20 scaled icons side-by-side → total width 40px */
    background-size: 40px 20px;
    background-position: 0 0; /* closed (left) */
}

.password-toggle[aria-pressed="true"] .icon-eye {
    background-position: -20px 0; /* open (right) */
}

.text-input-hint {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0;
    min-height: 0;
}

.text-input-hint:not(:empty) {
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.text-input-error {
    color: var(--primary-error);
}

/* Focus visible indicator */
.text-input-field:focus-visible {
    outline: none;
}

/* Disabled state */
.text-input-field:disabled {
    color: #999;
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Readonly state - using lightest accessible gray (#757575 meets WCAG AA 4.5:1) */
.text-input-field[readonly] {
    color: #757575;
    cursor: default;
}

.text-input-container.disabled .text-input-wrapper {
    border-color: #e0e0e0;
    background-color: #f5f5f5;
}

.text-input-container.disabled .text-input-label {
    color: #666 !important;
}

.text-input-container.disabled .text-input-label.shrink {
    color: #666 !important;
}

.text-input-container.disabled.focused .text-input-label.shrink {
    color: #666 !important;
}

.text-input-container.readonly .text-input-label {
    color: #666 !important;
}

.text-input-container.readonly.focused .text-input-label.shrink {
    color: #666 !important;
}

/* Error state */
.text-input-container.error .text-input-wrapper {
    border-color: var(--primary-error);
}

.text-input-container.error .text-input-label {
    color: var(--primary-error);
}

.text-input-container.focused.error .text-input-wrapper {
    box-shadow: none;
}