/*
 * 浮动标签输入框样式（Floating Label）
 *
 * 用途：登录 / 注册类表单的输入框样式 —— 标签默认藏在下划线位置，
 * 聚焦或有内容时上移变小。与 account/login.html、account/signup.html
 * 里内联的同名规则保持一致（新增页面请优先引用本文件，别再复制一份）。
 *
 * 依赖：表单控件需带 class="floating-input"，且 placeholder 留一个空格
 * （触发 :placeholder-shown 伪类）。core/forms.py 的 CustomSignupForm /
 * CustomAuthenticationForm 已按此约定设置 widget 属性。
 */

.floating-group {
    position: relative;
    margin-bottom: 1.5rem;
}

/* 浮动标签：默认隐藏（避免与 placeholder 冲突） */
.floating-label {    position: absolute;
    left: 0.75rem;
    top: 1.25rem;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.3s ease;
    background-color: #ffffff;
    padding: 0 4px;
    z-index: 1;
    /* 默认隐藏，只当聚焦或输入框有值时显示 */
    opacity: 0;
    visibility: hidden;
}

/* 输入框基础样式：固定高度 44px，确保跨浏览器一致 */
.floating-input,
.floating-select,
.floating-group input[type="text"],
.floating-group input[type="email"],
.floating-group input[type="password"],
.floating-group select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    color: #374151;
    background-color: #ffffff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;

    /* 核心解決方案：使用相同的 height 和 line-height */
    line-height: 44px;
    height: 44px;
    min-height: 44px;
    max-height: 44px;

    /* 防止瀏覽器默認樣式干擾 */
    vertical-align: middle;

    /* Safari/iOS 修復 */
    -webkit-text-fill-color: #374151;
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
}

/* 聚焦或有内容时：显示标签并上移 */
.floating-input:focus ~ .floating-label,
.floating-input:not(:placeholder-shown) ~ .floating-label,
.floating-select:focus ~ .floating-label,
.floating-group input[type="text"]:focus ~ .floating-label,
.floating-group input[type="email"]:focus ~ .floating-label,
.floating-group input[type="password"]:focus ~ .floating-label,
.floating-group select:focus ~ .floating-label,
.floating-group input[type="text"]:not(:placeholder-shown) ~ .floating-label,
.floating-group input[type="email"]:not(:placeholder-shown) ~ .floating-label,
.floating-group input[type="password"]:not(:placeholder-shown) ~ .floating-label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #5D8A7C;
    font-weight: 500;
    opacity: 1;
    visibility: visible;
}

/* 聚焦或有内容时：品牌色边框 + 光晕 */
.floating-input:focus,
.floating-input:not(:placeholder-shown),
.floating-select:focus,
.floating-group input[type="text"]:focus,
.floating-group input[type="email"]:focus,
.floating-group input[type="password"]:focus,
.floating-group select:focus,
.floating-group input[type="text"]:not(:placeholder-shown),
.floating-group input[type="email"]:not(:placeholder-shown),
.floating-group input[type="password"]:not(:placeholder-shown) {
    border-color: #5D8A7C;
    box-shadow: 0 0 0 3px rgba(93, 138, 124, 0.1);
    outline: none;
}

/* 下拉框：右侧留出箭头的位置 */
.floating-select {
    padding-right: 2rem;
}

/* 复选框：统一成品牌色（登录页的「记住我」、添加密钥页的「免密登录」共用） */
input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    color: #5D8A7C;
    background-color: #ffffff;
    border-color: #d1d5db;
    border-radius: 0.25rem;
}
input[type="checkbox"]:checked {
    background-color: #5D8A7C;
    border-color: #5D8A7C;
}

/* 浏览器自动填充：去掉 Chrome 的黄色/蓝色底色与「显示密码」小图标 */
input::-webkit-credentials-auto-fill-button,
input::-webkit-contacts-auto-fill-button,
input::-webkit-strong-password-auto-fill-button {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #374151 !important;
}
