/* ==========================================================================
   Reusable form input component — The Dentist theme
   Used across the whole project wherever a text/password input is needed.
   Include this file once, then build inputs with the markup below:

   <div class="td-form-group">
       <input type="text" class="td-input" placeholder="Username">
       <div class="td-form-error"></div>
   </div>

   With a trailing icon button (e.g. password show/hide):

   <div class="td-form-group">
       <input type="password" class="td-input td-input--icon" placeholder="Password">
       <button type="button" class="td-input-icon-btn">...</button>
       <div class="td-form-error"></div>
   </div>
   ========================================================================== */

:root {
    --orange: #f46a00;
    --orange-dark: #d95e00;
    --td-input-bg: #f2f2f2;
    --td-input-bg-focus: #ffffff;
    --td-input-border: #e6e6e6;
    --td-input-text: #343434;
    --td-input-placeholder: #9a9a9a;
    --td-input-error: #e03131;
}

.td-form-group {
    position: relative;
    margin-bottom: 16px;
}

.td-input {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0 18px;
    border: 1px solid var(--td-input-border);
    border-radius: 10px;
    background: var(--td-input-bg);
    font-family: inherit;
    font-size: 14.5px;
    line-height: normal;
    color: var(--td-input-text);
    outline: none;
    appearance: none;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.td-input::placeholder {
    color: var(--td-input-placeholder);
}

.td-input:hover {
    border-color: #d8d8d8;
}

.td-input:focus {
    background: var(--td-input-bg-focus);
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(244, 106, 0, .12);
}

.td-input:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.td-input--icon {
    padding-right: 46px;
}

.td-input.is-invalid {
    border-color: var(--td-input-error);
    background: #fff5f5;
}

.td-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(224, 49, 49, .1);
}

/* Edge/IE inject their own "reveal password" button inside password
   inputs at the same spot as our custom toggle — it eats the first
   click (dismissing itself) before our button ever receives it, which
   is why a custom eye toggle otherwise needs two clicks to work. */
.td-input[type="password"]::-ms-reveal,
.td-input[type="password"]::-ms-clear {
    display: none;
    width: 0;
    height: 0;
}

.td-input-icon-btn {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding: 0;
    background: none;
    border: none;
    color: var(--orange);
    cursor: pointer;
}

.td-input-icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Reusable colorable icon: renders an SVG from public/asset/icons/ as a
   CSS mask, so it inherits currentColor/background-color instead of
   being locked to whatever fill the SVG file itself has.
   <span class="td-icon" style="--td-icon: url('/asset/icons/eye.svg')"></span> */
.td-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask: var(--td-icon) no-repeat center / contain;
    mask: var(--td-icon) no-repeat center / contain;
}

.td-form-error {
    min-height: 16px;
    margin: 6px 0 0 4px;
    font-size: 12.5px;
    line-height: 1.3;
    color: var(--td-input-error);
}
