/* ==========================================================================
   ERPGo — Modern Auth (login / register / forgot / reset)
   Scoped redesign. Loaded LAST so it overrides the legacy auth styles.
   Only touches the auth shell + form controls inside `.auth-modern`.
   Nothing here affects the dashboard/app.
   ========================================================================== */

.auth-modern {
    /* accent = RCK Computers orange */
    --auth-accent: #f36523;
    --auth-accent-2: #d94f14;
    --auth-ink: #0f172a;
    --auth-muted: #64748b;
    --auth-bg: #f7f4f2;
    --auth-card: #ffffff;
    --auth-border: #ece4df;
    --auth-field: #f7f2ee;
    --auth-field-focus: #ffffff;
    --auth-radius: 18px;
    --auth-shadow: 0 24px 60px -28px rgba(15, 23, 42, 0.28);

    margin: 0;
    background: var(--auth-bg);
    color: var(--auth-ink);
    font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}

/* respect a custom brand color when the tenant set one */
.auth-modern.custom-color {
    --auth-accent: var(--color-customColor, #f36523);
    --auth-accent-2: var(--color-customColor, #d94f14);
}

/* ---- kill the legacy background artwork ---------------------------------- */
.auth-modern .login-bg-img,
.auth-modern .bg-login {
    display: none !important;
}

/* ---- split shell -------------------------------------------------------- */
html, body.auth-modern { height: auto; }

.auth-modern .custom-login {
    display: grid !important;
    grid-template-columns: 1.05fr 1fr;
    align-items: stretch !important;
    justify-items: stretch;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent;
    overflow: hidden;
}

.auth-modern .custom-login-inner {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    min-height: 100vh !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--auth-bg);
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   LEFT — brand panel
   ========================================================================== */
.auth-brand {
    grid-column: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    min-height: 100vh;
    color: #fff;
    background:
        radial-gradient(120% 120% at 10% 0%, color-mix(in srgb, var(--auth-accent) 92%, #fff) 0%, transparent 55%),
        linear-gradient(155deg, var(--auth-accent) 0%, var(--auth-accent-2) 68%, color-mix(in srgb, var(--auth-accent-2) 80%, #000) 100%);
}

/* soft light orbs */
.auth-brand__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(18px);
    opacity: 0.5;
    pointer-events: none;
}
.auth-brand__glow--1 {
    width: 460px; height: 460px;
    top: -160px; inset-inline-end: -120px;
    background: radial-gradient(circle, rgba(255,255,255,0.55), transparent 62%);
}
.auth-brand__glow--2 {
    width: 380px; height: 380px;
    bottom: -140px; inset-inline-start: -90px;
    background: radial-gradient(circle, rgba(255,255,255,0.32), transparent 60%);
    opacity: 0.4;
}
/* subtle grid texture */
.auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(120% 90% at 50% 30%, #000 40%, transparent 78%);
    pointer-events: none;
}

.auth-brand__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 56px clamp(48px, 5vw, 84px);
    width: 100%;
    justify-content: space-between;
}

.auth-brand__logo {
    display: inline-flex;
    text-decoration: none;
}
.auth-brand__logo img {
    height: 40px;
    width: auto;
    filter: brightness(0) invert(1);
}
.auth-brand__wordmark {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1;
}

.auth-brand__copy h1 {
    font-size: clamp(30px, 3vw, 46px);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
    max-width: 15ch;
}
.auth-brand__copy p {
    font-size: 17px;
    line-height: 1.6;
    margin: 0 0 30px;
    max-width: 42ch;
    color: rgba(255,255,255,0.86);
}

.auth-brand__features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 14px;
}
.auth-brand__features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255,255,255,0.94);
}
.auth-brand__features li::before {
    content: "";
    flex: 0 0 auto;
    width: 26px; height: 26px;
    border-radius: 8px;
    background: rgba(255,255,255,0.18);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    backdrop-filter: blur(4px);
}

.auth-brand__card {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.20);
    border-radius: 16px;
    padding: 22px 24px;
    backdrop-filter: blur(10px);
    max-width: 420px;
}
.auth-brand__card p {
    margin: 0 0 14px;
    font-size: 15px;
    line-height: 1.55;
    color: #fff;
}
.auth-brand__card .who {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: rgba(255,255,255,0.82);
}
.auth-brand__card .who .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.28);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
}

/* ==========================================================================
   RIGHT — form panel
   ========================================================================== */
.auth-modern .dash-header,
.auth-modern header.dash-header {
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 22px clamp(24px, 4vw, 56px) 0;
}
.auth-modern .dash-header .navbar,
.auth-modern .dash-header .container {
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
/* hide the duplicated in-form logo area of the topbar (brand logo is on the left panel) */
.auth-modern .dash-header .navbar-brand {
    display: none;
}
.auth-modern .dash-header .navbar-nav {
    gap: 6px;
    align-items: center;
}
.auth-modern .dash-header .nav-link {
    color: var(--auth-muted) !important;
    font-weight: 500;
    font-size: 14px;
    padding: 6px 12px !important;
    border-radius: 8px;
    transition: color .18s ease, background .18s ease;
}
.auth-modern .dash-header .nav-link:hover {
    color: var(--auth-ink) !important;
    background: rgba(15,23,42,0.04);
}
.auth-modern .dash-head-link,
.auth-modern .drp-language .drp-text {
    color: var(--auth-muted) !important;
    font-weight: 600;
    font-size: 14px;
}

.auth-modern .custom-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px clamp(24px, 4vw, 56px);
}
.auth-modern .custom-row {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

/* ---- the card ----------------------------------------------------------- */
.auth-modern .custom-row .card {
    background: var(--auth-card);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    overflow: visible;
    animation: authRise .5s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes authRise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.auth-modern .card-body {
    padding: clamp(28px, 3vw, 44px);
}

.auth-modern .card-body > div:first-child h2 {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--auth-ink);
    margin: 0 0 6px;
}
/* helper subtitle injected via ::after on the heading wrapper */
.auth-modern .card-body > div:first-child::after {
    content: attr(data-sub);
    display: block;
    color: var(--auth-muted);
    font-size: 15px;
    margin: 0 0 22px;
}

/* ---- fields ------------------------------------------------------------- */
.auth-modern .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-ink);
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}
.auth-modern .form-control {
    height: 50px;
    border-radius: 12px;
    border: 1.5px solid var(--auth-border);
    background: var(--auth-field);
    color: var(--auth-ink);
    font-size: 15px;
    padding: 0 16px;
    box-shadow: none;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.auth-modern textarea.form-control { height: auto; padding: 12px 16px; }
.auth-modern .form-control::placeholder { color: #9aa6b2; }
.auth-modern .form-control:focus {
    border-color: var(--auth-accent);
    background: var(--auth-field-focus);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--auth-accent) 18%, transparent);
    outline: none;
}
.auth-modern .form-group { margin-bottom: 18px !important; }

/* password show/hide toggle injected by JS */
.auth-modern .auth-field { position: relative; }
.auth-modern .auth-pw-toggle {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    padding: 4px;
    cursor: pointer;
    color: var(--auth-muted);
    display: inline-flex;
    line-height: 0;
}
.auth-modern .auth-pw-toggle:hover { color: var(--auth-ink); }
.auth-modern .auth-field .form-control { padding-inline-end: 44px; }

/* forgot link */
.auth-modern .custom-login-form a,
.auth-modern .card-body a.text-primary,
.auth-modern .card-body a {
    color: var(--auth-accent-2);
    font-weight: 600;
    text-decoration: none;
    transition: color .15s ease;
}
.auth-modern .card-body a:hover { color: var(--auth-accent); text-decoration: underline; }

/* ---- primary button ----------------------------------------------------- */
.auth-modern .btn-primary,
.auth-modern .d-grid .btn {
    height: 52px;
    border: 0;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15.5px;
    letter-spacing: 0.01em;
    color: #fff;
    background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-2) 100%);
    box-shadow: 0 12px 24px -10px color-mix(in srgb, var(--auth-accent-2) 70%, transparent);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.auth-modern .btn-primary:hover,
.auth-modern .d-grid .btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 18px 30px -12px color-mix(in srgb, var(--auth-accent-2) 78%, transparent);
}
.auth-modern .btn-primary:active { transform: translateY(0); }

/* checkbox (register terms) */
.auth-modern .form-check-input:checked {
    background-color: var(--auth-accent);
    border-color: var(--auth-accent);
}
.auth-modern .form-check-input:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-accent) 20%, transparent);
}

/* footer */
.auth-modern footer .auth-footer {
    padding: 20px clamp(24px, 4vw, 56px) 26px;
    text-align: center;
    color: var(--auth-muted);
    font-size: 13px;
}
.auth-modern footer .auth-footer .row,
.auth-modern footer .auth-footer .col-12 { text-align: center; }

/* password strength indicator (register) */
.auth-modern .pwindicator .bar { border-radius: 3px; }

/* ==========================================================================
   DARK
   ========================================================================== */
.auth-modern.auth-dark {
    --auth-ink: #e8edf2;
    --auth-muted: #94a3b8;
    --auth-bg: #0d1117;
    --auth-card: #161b22;
    --auth-border: #232b36;
    --auth-field: #1b222c;
    --auth-field-focus: #1e2732;
    --auth-shadow: 0 24px 60px -28px rgba(0,0,0,0.6);
}
.auth-modern.auth-dark .dash-header .nav-link:hover { background: rgba(255,255,255,0.05); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 991px) {
    /* effondre totalement la grille (plus fiable que grid-template 1fr) */
    .auth-modern .custom-login {
        display: block !important;
        min-height: 100vh;
        overflow-x: hidden;
    }
    .auth-modern .auth-brand { display: none !important; }
    .auth-modern .custom-login-inner {
        display: flex !important;
        flex-direction: column;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100vh;
    }
    /* montre le logo dans la barre du haut (le panneau marque est masqué) */
    .auth-modern .dash-header .navbar-brand { display: block; }
    .auth-modern .dash-header .navbar-brand .logo,
    .auth-modern .dash-header .navbar-brand .logo-lg {
        height: 34px !important;
        width: auto !important;
        max-width: 170px;
        object-fit: contain;
    }
    .auth-modern .dash-header .navbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
    }
}
@media (max-width: 575px) {
    .auth-modern .custom-wrapper { padding: 20px 16px; }
    .auth-modern .card-body { padding: 24px 20px; }
    .auth-modern .dash-header { padding: 16px 16px 0; }
    .auth-modern .card-body > div:first-child h2 { font-size: 24px; }
}

/* ---- anti-débordement + neutralise la règle legacy .card-body (max-width/margin) ---- */
.auth-modern,
.auth-modern .custom-login { overflow-x: hidden; max-width: 100vw; }
.auth-modern .custom-login .custom-wrapper .card .card-body,
.auth-modern .custom-row .card > .card-body {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
}
.auth-modern .custom-row { min-width: 0; }
.auth-modern .form-control { max-width: 100%; }

/* ==========================================================================
   RTL
   ========================================================================== */
[dir="rtl"] .auth-modern .custom-login { direction: rtl; }
