/* ============================================
   LilBuild Login Page Styles
   ============================================ */

:root {
    --login-brand-yellow: #f4ca06;
    --login-brand-yellow-hover: #e0b800;
    --login-brand-dark: #1b2033;
    --login-text-light: #a0aec0;
    --login-input-bg: rgba(255, 255, 255, 0.08);
    --login-card-bg: rgba(27, 32, 51, 0.85);
    --login-error-red: #e53e3e;
}

/* ---- Page layout ---- */
html.login-html,
html.login-html body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.login-page-v2 {
    background-image: url('/static/images/login-page-bg.png') !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
}

body.login-page-v2::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(27, 32, 51, 0.75) 0%,
        rgba(27, 32, 51, 0.55) 50%,
        rgba(27, 32, 51, 0.70) 100%
    );
    z-index: 1;
}

/* ---- Login card ---- */
.login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    margin: 20px;
    background: var(--login-card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 48px 40px 40px;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: loginCardSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes loginCardSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Logo ---- */
.login-card .login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-card .login-logo img {
    width: 200px;
    height: auto;
    filter: brightness(1.1);
}

/* ---- Welcome text ---- */
.login-welcome {
    text-align: center;
    margin-bottom: 32px;
}

.login-welcome h2 {
    color: #ffffff;
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 6px 0;
    letter-spacing: -0.3px;
}

.login-welcome p {
    color: var(--login-text-light);
    font-size: 14px;
    font-weight: 400;
    margin: 0;
}

/* ---- Alert messages ---- */
.login-alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: loginAlertFadeIn 0.3s ease;
}

.login-alert i {
    font-size: 16px;
    flex-shrink: 0;
}

.login-alert-error {
    background: rgba(229, 62, 62, 0.15);
    border: 1px solid rgba(229, 62, 62, 0.3);
    color: #fc8181;
}

.login-alert-success {
    background: rgba(56, 161, 105, 0.15);
    border: 1px solid rgba(56, 161, 105, 0.3);
    color: #68d391;
}

.login-alert-info {
    background: rgba(244, 202, 6, 0.15);
    border: 1px solid rgba(244, 202, 6, 0.3);
    color: var(--login-brand-yellow);
}

@keyframes loginAlertFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Input fields ---- */
.input-group-login {
    position: relative;
    margin-bottom: 18px;
}

.input-group-login .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--login-text-light);
    font-size: 15px;
    z-index: 2;
    transition: color 0.25s ease;
    pointer-events: none;
}

.input-group-login input.login-input {
    width: 100%;
    height: 50px;
    padding: 0 16px 0 46px;
    background: var(--login-input-bg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.25s ease;
    outline: none;
    box-shadow: none;
}

.input-group-login input.login-input::placeholder {
    color: var(--login-text-light);
    font-weight: 400;
}

.input-group-login input.login-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--login-brand-yellow);
    box-shadow: 0 0 0 3px rgba(244, 202, 6, 0.15);
}

.input-group-login input.login-input:focus ~ .input-icon {
    color: var(--login-brand-yellow);
}

.input-group-login input.login-input.field-error {
    border-color: var(--login-error-red) !important;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15) !important;
}

/* Password toggle */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--login-text-light);
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
    z-index: 2;
    transition: color 0.25s ease;
}

.password-toggle:hover {
    color: #ffffff;
}

/* ---- Remember me + forgot ---- */
.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
    font-weight: normal;
}

.remember-me input[type="checkbox"] {
    display: none;
}

.remember-me .checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.remember-me .checkmark i {
    font-size: 10px;
    color: var(--login-brand-dark);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.remember-me input:checked + .checkmark {
    background: var(--login-brand-yellow);
    border-color: var(--login-brand-yellow);
}

.remember-me input:checked + .checkmark i {
    opacity: 1;
}

.remember-me .remember-label {
    color: var(--login-text-light);
    font-size: 13px;
    font-weight: 400;
}

.forgot-link {
    color: var(--login-brand-yellow);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.25s ease;
}

.forgot-link:hover,
.forgot-link:focus {
    color: var(--login-brand-yellow-hover);
    text-decoration: none;
}

/* ---- Submit button ---- */
.btn-login {
    width: 100%;
    height: 50px;
    background: var(--login-brand-yellow);
    border: none;
    border-radius: 12px;
    color: var(--login-brand-dark);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    background: var(--login-brand-yellow-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(244, 202, 6, 0.3);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(244, 202, 6, 0.2);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-login .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(27, 32, 51, 0.3);
    border-top-color: var(--login-brand-dark);
    border-radius: 50%;
    animation: loginSpin 0.6s linear infinite;
    margin: 0 auto;
}

.btn-login.loading .btn-text { display: none; }
.btn-login.loading .spinner { display: block; }

@keyframes loginSpin {
    to { transform: rotate(360deg); }
}

/* ---- Divider ---- */
.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    gap: 12px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.login-divider span {
    color: var(--login-text-light);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ---- Register link ---- */
.login-register-link {
    text-align: center;
}

.login-register-link p {
    color: var(--login-text-light);
    font-size: 13px;
    font-weight: 400;
    margin: 0;
}

.login-register-link a {
    color: var(--login-brand-yellow);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.25s ease;
}

.login-register-link a:hover,
.login-register-link a:focus {
    color: var(--login-brand-yellow-hover);
    text-decoration: none;
}

/* ---- Forgot panel ---- */
.forgot-panel {
    display: none;
}

.forgot-panel.active {
    display: block;
    animation: loginPanelSlideIn 0.35s ease forwards;
}

@keyframes loginPanelSlideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.back-to-login {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--login-text-light);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 20px;
    transition: color 0.25s ease;
    cursor: pointer;
}

.back-to-login:hover,
.back-to-login:focus {
    color: #ffffff;
    text-decoration: none;
}

.forgot-description {
    color: var(--login-text-light);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* ---- Footer ---- */
.login-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.login-footer p {
    color: rgba(255, 255, 255, 0.3);
    font-size: 11px;
    font-weight: 400;
    margin: 0;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .login-card {
        margin: 12px;
        padding: 36px 24px 32px;
        border-radius: 16px;
    }

    .login-card .login-logo img {
        width: 160px;
    }

    .login-welcome h2 {
        font-size: 20px;
    }

    .login-options {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

@media (max-height: 700px) {
    .login-card {
        padding: 32px 32px 28px;
    }

    .login-welcome {
        margin-bottom: 24px;
    }

    .login-card .login-logo {
        margin-bottom: 24px;
    }
}
