/* =========================================================
   custom_login.css — 登录页样式 +【全站主题色变量】
   下面 :root 里的 --login-* 是全站通用的主题令牌，
   custom_dashboard.css 等文件都直接引用它们。
   layout.php 在 custom_dashboard.css 之前加载本文件，
   所以这些变量对后者可见。改主题色就改这里。
   ========================================================= */

/* custom_login.css */

/* Define variables for Light Theme */
:root {
    --login-bg: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --login-card-bg: #ffffff;
    --login-text-color: #333333;
    --login-input-bg: #f1f3f5;
    --login-input-text: #495057;
    --login-input-placeholder: #adb5bd;
    --login-icon-color: #ced4da;
    --login-icon-focus: #f39c12; /* Rich yellow/orange for light mode focus */
    --login-btn-bg: #ffe066; /* Bright yellow */
    --login-btn-hover: #ffd43b;
    --login-btn-text: #212529;
    --login-shadow: 0 15px 35px rgba(0,0,0,0.05);
    --login-btn-shadow: 0 8px 24px rgba(255, 224, 102, 0.4);
}

/* Define variables for Dark Theme using prefers-color-scheme */
@media (prefers-color-scheme: dark) {
    :root {
        --login-bg: #1f2029; /* Dark background */
        --login-card-bg: #2a2b38; /* Slightly lighter card */
        --login-text-color: #f8f9fa;
        --login-input-bg: #1f2029;
        --login-input-text: #f8f9fa;
        --login-input-placeholder: #6c757d;
        --login-icon-color: #495057;
        --login-icon-focus: #ffeba7;
        --login-btn-bg: #ffeba7;
        --login-btn-hover: #ffe066;
        --login-btn-text: #1f2029;
        --login-shadow: 0 15px 35px rgba(0,0,0,0.2);
        --login-btn-shadow: 0 8px 24px rgba(255, 235, 167, 0.15);
    }
}

/* Ensure body takes full height and uses Flexbox for centering on login page */
body:has(.login-page-wrapper) {
    background: var(--login-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--login-text-color);
}

/* Hide header if it appears on login page */
body:has(.login-page-wrapper) header {
    display: none;
}
body:has(.login-page-wrapper) .page {
    margin: 0;
    padding: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Card Container */
.login-page-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    box-sizing: border-box;
}

.login-page-wrapper .form-login {
    background: var(--login-card-bg);
    border-radius: 20px;
    padding: 25px 30px 25px 30px;
    box-shadow: var(--login-shadow);
    text-align: center;
    border: none;
    margin: 0;
}

.login-page-wrapper .form-login h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 26px;
    font-weight: 600;
    color: var(--login-text-color);
    border: none;
}

.login-page-wrapper .form-login h2::after {
    display: none;
}

/* Input Icon Wrapper */
.input-icon-wrapper {
    position: relative;
    margin-bottom: 25px;
    text-align: left;
}

.input-icon-wrapper label {
    display: none; /* Hide original labels, rely on placeholders and icons */
}

.input-icon-wrapper i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--login-icon-color);
    transition: color 0.3s ease;
    font-size: 18px;
    pointer-events: none; /* Let clicks pass through to input */
}

.input-icon-wrapper input[type="text"],
.input-icon-wrapper input[type="password"] {
    width: 100%;
    background: var(--login-input-bg);
    border: 2px solid transparent;
    border-radius: 50px;
    padding: 16px 20px 16px 50px; /* Space for icon */
    font-size: 15px;
    color: var(--login-input-text);
    transition: all 0.3s ease;
    box-sizing: border-box;
    box-shadow: none;
}

/* Add placeholder styling */
.input-icon-wrapper input::placeholder {
    color: var(--login-input-placeholder);
    opacity: 1;
}

.input-icon-wrapper input:focus {
    outline: none;
    background: var(--login-card-bg);
    border-color: var(--login-icon-focus);
    box-shadow: 0 0 0 4px rgba(243, 156, 18, 0.1);
}

.input-icon-wrapper:focus-within i {
    color: var(--login-icon-focus);
}

/* Button */
.login-page-wrapper .form-actions {
    margin-top: 25px;
    text-align: center;
}

.login-page-wrapper .btn {
    background: var(--login-btn-bg);
    color: var(--login-btn-text);
    border: none;
    border-radius: 50px;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--login-btn-shadow);
    width: 100%; /* Full width */
}

.login-page-wrapper .btn:hover {
    background: var(--login-btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 235, 167, 0.3);
}

/* Links */
.login-page-wrapper .reset-password {
    margin-top: 15px;
}

.login-page-wrapper .reset-password a {
    color: var(--login-input-placeholder);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.login-page-wrapper .reset-password a:hover {
    color: var(--login-icon-focus);
}

/* Remember me */
.login-page-wrapper .remember-me-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 10px;
}

.login-page-wrapper input[type="checkbox"] {
    margin: 0;
    margin-right: 10px;
    accent-color: var(--login-icon-focus);
    width: 16px;
    height: 16px;
}
.login-page-wrapper label.remember-me-label {
    color: var(--login-input-placeholder);
    font-size: 14px;
    display: inline-block;
    cursor: pointer;
}

/* Error messages */
.login-page-wrapper .alert-error {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: none;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 14px;
}
