/**
 * KalOps.ai — Auth Pages CSS
 * Styles for login, forgot password, reset password, and 2FA pages.
 * v11.0 Design System — uses --kal-* tokens throughout.
 *
 * These styles are injected via the auth head view (authentication/includes/head.php)
 * and layered on top of the existing admin-auth compiled bundle.
 */

/* ─────────────────────────────────────────────
   Page wrapper — full-screen dark gradient
   ───────────────────────────────────────────── */
.kal-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1117 0%, #1a1a2e 50%, #16213e 100%);
    position: relative;
    overflow: hidden;
    padding: 24px 16px;
}

/* Decorative gold radial glow — top right */
.kal-auth::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(200, 167, 90, 0.08) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    pointer-events: none;
}

/* Decorative blue radial glow — bottom left */
.kal-auth::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(78, 115, 223, 0.06) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    pointer-events: none;
}

/* ─────────────────────────────────────────────
   Card
   ───────────────────────────────────────────── */
.kal-auth__card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

/* ─────────────────────────────────────────────
   Logo / branding block
   ───────────────────────────────────────────── */
.kal-auth__logo {
    text-align: center;
    margin-bottom: 28px;
}

.kal-auth__logo img {
    height: 48px;
    width: auto;
    display: block;
    margin: 0 auto 12px;
}

.kal-auth__logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #C8A75A, #E2C97E);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: 4px;
    display: block;
}

.kal-auth__tagline {
    font-size: 0.8125rem;
    color: #858796;
    display: block;
}

/* ─────────────────────────────────────────────
   Heading
   ───────────────────────────────────────────── */
.kal-auth__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #2d3748;
    text-align: center;
    margin: 0 0 24px;
}

.kal-auth__subtitle {
    font-size: 0.875rem;
    color: #858796;
    text-align: center;
    margin: -16px 0 24px;
}

/* ─────────────────────────────────────────────
   Form inputs — override Bootstrap defaults
   ───────────────────────────────────────────── */
.kal-auth__form .form-group {
    margin-bottom: 20px;
}

.kal-auth__form .form-control,
.kal-auth__input {
    padding: 13px 16px;
    font-size: 0.9375rem;
    border-radius: 10px;
    border: 1.5px solid #e3e6f0;
    background: #f8f9fc;
    color: #2d3748;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    height: auto;
    width: 100%;
    box-sizing: border-box;
}

.kal-auth__form .form-control:focus,
.kal-auth__input:focus {
    border-color: #4e73df;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.12);
    outline: none;
}

.kal-auth__form .control-label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: #4a5568;
    margin-bottom: 8px;
    display: block;
}

/* ─────────────────────────────────────────────
   Forgot password inline link
   ───────────────────────────────────────────── */
.kal-auth__fp-link {
    font-size: 0.8125rem;
    color: #4e73df;
    font-weight: 600;
    text-decoration: none;
}
.kal-auth__fp-link:hover {
    color: #3b5bdb;
    text-decoration: underline;
}

/* ─────────────────────────────────────────────
   Submit button — full-width gradient
   ───────────────────────────────────────────── */
.kal-auth__submit,
.kal-auth__form .btn-primary.btn-block {
    width: 100%;
    padding: 13px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    background: linear-gradient(135deg, #4e73df, #3b5bdb);
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    letter-spacing: 0.01em;
    display: block;
    text-align: center;
    line-height: 1.5;
    box-sizing: border-box;
    margin-top: 8px;
}

.kal-auth__submit:hover,
.kal-auth__form .btn-primary.btn-block:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(78, 115, 223, 0.4);
    background: linear-gradient(135deg, #3b5bdb, #2d49c7);
    color: #ffffff;
}

.kal-auth__submit:active,
.kal-auth__form .btn-primary.btn-block:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ─────────────────────────────────────────────
   Footer link row
   ───────────────────────────────────────────── */
.kal-auth__footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.875rem;
    color: #858796;
}

.kal-auth__footer a {
    color: #4e73df;
    font-weight: 600;
    text-decoration: none;
}

.kal-auth__footer a:hover {
    text-decoration: underline;
    color: #3b5bdb;
}

/* ─────────────────────────────────────────────
   2FA — digit code input row
   ───────────────────────────────────────────── */
.kal-auth__2fa-code {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 20px 0 28px;
}

.kal-auth__2fa-code input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid #e3e6f0;
    border-radius: 10px;
    background: #f8f9fc;
    color: #2d3748;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kal-auth__2fa-code input:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.12);
    outline: none;
}

/* ─────────────────────────────────────────────
   Alert overrides inside auth card
   ───────────────────────────────────────────── */
.kal-auth__card .alert {
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.875rem;
}

/* ─────────────────────────────────────────────
   Checkbox / remember-me row
   ───────────────────────────────────────────── */
.kal-auth__form .checkbox label {
    font-size: 0.875rem;
    color: #4a5568;
}

/* ─────────────────────────────────────────────
   Divider
   ───────────────────────────────────────────── */
.kal-auth__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: #b0b7c3;
    font-size: 0.8125rem;
}

.kal-auth__divider::before,
.kal-auth__divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid #e3e6f0;
}

/* ─────────────────────────────────────────────
   Mobile responsiveness
   ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .kal-auth__card {
        padding: 32px 24px;
        border-radius: 16px;
    }

    .kal-auth__2fa-code input {
        width: 40px;
        height: 48px;
        font-size: 1.25rem;
    }
}

/* ─────────────────────────────────────────────
   Apply .kal-auth layout to existing body class
   Works with the existing CI auth body structure
   ───────────────────────────────────────────── */
body.login_admin,
body.authentication {
    min-height: 100vh;
    background: linear-gradient(135deg, #0d1117 0%, #1a1a2e 50%, #16213e 100%) !important;
    position: relative;
    overflow-x: hidden;
}

body.login_admin::before,
body.authentication::before {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(200, 167, 90, 0.08) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

body.login_admin::after,
body.authentication::after {
    content: '';
    position: fixed;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(78, 115, 223, 0.06) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* Card wrapper — the existing .authentication-form-wrapper */
.authentication-form-wrapper {
    position: relative;
    z-index: 1;
    padding-bottom: 40px;
}

/* Card itself — tw-bg-white + tw-rounded-lg */
.authentication-form-wrapper > div[class*="tw-bg-white"] {
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    border: none !important;
    padding: 36px 40px !important;
}

/* Company logo area */
.authentication-form-wrapper .company-logo img {
    filter: brightness(0) invert(1);
    opacity: 0.92;
}

/* Headings on dark background */
body.login_admin h1,
body.authentication h1,
body.login_admin .tw-text-neutral-800,
body.authentication .tw-text-neutral-800 {
    color: #f1f5f9 !important;
}

body.login_admin .tw-text-neutral-600,
body.authentication .tw-text-neutral-600 {
    color: #94a3b8 !important;
}

/* Form inputs styled */
.authentication-form-wrapper .form-control {
    padding: 12px 16px;
    border-radius: 10px;
    border: 1.5px solid #e3e6f0;
    background: #f8f9fc;
    font-size: 0.9375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    height: auto;
}

.authentication-form-wrapper .form-control:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.12);
}

/* Submit button */
.authentication-form-wrapper .btn-primary.btn-block {
    padding: 13px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    background: linear-gradient(135deg, #4e73df, #3b5bdb);
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: auto;
    line-height: 1.5;
}

.authentication-form-wrapper .btn-primary.btn-block:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(78, 115, 223, 0.4);
    background: linear-gradient(135deg, #3b5bdb, #2d49c7);
}

/* Forgot password link color fix (on dark card white bg) */
.authentication-form-wrapper a.text-muted {
    color: #4e73df !important;
    font-weight: 600;
    font-size: 0.8125rem;
}

/* Bottom back-to-login link */
.authentication-form-wrapper .form-group a {
    color: #4e73df;
    font-size: 0.875rem;
}

/* reCAPTCHA vertical rhythm */
.authentication-form-wrapper .g-recaptcha {
    margin-bottom: 16px;
}

/* ─────────────────────────────────────────────
   Mobile adjustments for existing wrapper
   ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .authentication-form-wrapper > div[class*="tw-bg-white"] {
        padding: 28px 20px !important;
        border-radius: 14px !important;
    }
}
