/**
 * TFloatingTextBox Control Styles
 * 
 * Floating label textbox control with modern UI styling
 * Compatible with .NET Framework 4.8
 * 
 * Usage:
 * <T:TFloatingTextBox ID="txtUsername" runat="server" LabelText="Username" />
 * 
 * @version 1.0.0
 * @copyright Tenrox Inc.
 */

/* Floating Label Group Container */
.floating-label-group {
    position: relative;
    margin-bottom: 24px;
}

/* Input Field Base Styles */
.form-input {
    width: 100%;
    height: 40px;
    padding: 10px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    color: #1a1a1a;
    transition: all 0.3s ease;
    background-color: #ffffff;
    box-sizing: border-box;
}

/* Input Focus State */
.form-input:focus {
    outline: none;
    border: solid 2px #0C5CC5 !important;
    padding: 9px 15px; /* Compensate for thicker border */
    box-shadow: none;
}

/* Placeholder Styles */
.form-input::placeholder {
    color: #999999;
}

/* Hide placeholder when input has value or is focused */
.form-input:focus::placeholder,
.form-input:not(:placeholder-shown)::placeholder {
    opacity: 0;
}

/* Disabled/ReadOnly State */
.form-input:disabled {
    background-color: #f5f5f5;
    color: #999999;
    cursor: not-allowed;
}

/* Floating Label */
.floating-label {
    position: absolute;
    left: 16px;
    top: -8px;
    background: #ffffff;
    padding: 0 4px;
    color: #525C69;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    z-index: 1;
}

/* Show floating label when input has focus, value, or has-value class */
.form-input:focus ~ .floating-label,
.form-input:not(:placeholder-shown) ~ .floating-label,
.form-input.has-value ~ .floating-label {
    opacity: 1;
    transform: translateY(0);
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

/* Password Input - Extra padding for toggle icon */
.form-input.password-input {
    padding-right: 44px;
}

.form-input.password-input:focus {
    padding-right: 43px; /* Compensate for thicker border */
}

/* Password Toggle Icon */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666666;
    font-size: 20px;
    transition: color 0.2s ease;
    user-select: none;
    z-index: 2;
}

.password-toggle:hover {
    color: #1e5bb8;
}

/* Error State */
.form-input.error {
    border-color: #d32f2f !important;
    border-width: 2px !important;
}

.form-input.error:focus {
    border-color: #d32f2f !important;
    border-width: 2px !important;
    padding: 9px 15px; /* Compensate for thicker border */
}

.floating-label.error {
    color: #d32f2f !important;
}

/* Validation Message Label */
.validation-message {
    display: none;
    color: #d32f2f;
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.4;
    min-height: 17px;
}

.validation-message.show {
    display: block;
}

/* Textarea Styles */
textarea.form-input {
    min-height: 80px;
    resize: vertical;
    padding: 10px 16px;
}

textarea.form-input:focus {
    padding: 9px 15px;
}

textarea.form-input.error {
    padding: 9px 15px;
}

/* IE11-Specific Fixes */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .form-input {
        line-height: 20px;
        padding: 10px 16px;
    }

    .form-input::placeholder {
        line-height: 20px;
    }

    .form-input:focus {
        line-height: 20px;
        padding: 9px 15px !important;
    }

    .form-input.password-input:focus {
        line-height: 20px;
        padding-right: 43px !important;
    }

    input[type="text"],
    input[type="password"] {
        height: 40px !important;
        box-sizing: border-box;
    }

    textarea.form-input {
        line-height: 20px;
    }

    .password-toggle {
        margin-top: -2px;
    }

    .floating-label {
        top: -10px;
    }
}

/* Responsive Adjustments */
@media screen and (max-width: 768px) {
    .form-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}
