/* =====================================================================
   login.css
   Split-screen, modern SaaS login page.
   Design tokens (from project brief):
   Primary #2F80ED | Secondary #56CCF2 | Accent #27AE60
   Background #F8FAFC | Card #FFFFFF
   Text #1F2937 | Secondary Text #6B7280 | Border #EEF2F7
   ===================================================================== */

:root {
    --color-primary: #2F80ED;
    --color-secondary: #56CCF2;
    --color-accent: #27AE60;
    --color-bg: #F8FAFC;
    --color-card: #FFFFFF;
    --color-text: #1F2937;
    --color-text-muted: #6B7280;
    --color-border: #EEF2F7;
    --color-error: #E0554B;

    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-soft: 0 10px 30px rgba(47, 128, 237, 0.10);
    --shadow-card: 0 4px 16px rgba(31, 41, 55, 0.06);

    --font-base: 'Poppins', sans-serif;
}

* { box-sizing: border-box; }

[hidden] {
    display: none !important;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-base);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------
   Page layout: split screen
--------------------------------------------------------------------- */
.auth-page {
    height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    overflow: hidden;
}

/* ---------------------------------------------------------------------
   Left panel — brand / illustration
--------------------------------------------------------------------- */
.auth-brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 48px;
    background: linear-gradient(155deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
}

.auth-brand__overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(255,255,255,0.12) 0, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(255,255,255,0.10) 0, transparent 45%);
    pointer-events: none;
}

.auth-brand__content {
    position: relative;
    z-index: 1;
    max-width: 460px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.brand-logo__icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    background: #fff;

}

.brand-logo__text {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.auth-brand__title {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 10px;
}

.auth-brand__subtitle {
    font-size: 14px;
    font-weight: 300;
    line-height: 1.5;
    color: rgba(255,255,255,0.9);
    margin: 0 0 16px;
}

.auth-illustration {
    margin: 4px 0 16px;
    max-height: 140px;
    overflow: hidden;
}

.auth-illustration svg { width: 100%; height: auto; display: block; }

.auth-brand__points {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-brand__points li {
    position: relative;
    padding-left: 26px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255,255,255,0.95);
}

.auth-brand__points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
}

.auth-brand__points li::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 8px;
    width: 6px;
    height: 3px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}

/* ---------------------------------------------------------------------
   Right panel — login form
--------------------------------------------------------------------- */
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 32px;
    background: var(--color-bg);
    height: 100vh;
    overflow: hidden;
}

.auth-form-wrapper {
    width: 100%;
    max-width: 400px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 44px 40px;
}

.auth-form-header__logo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    display: none; /* shown only on mobile, once the brand panel is hidden */
    margin-bottom: 18px;
    box-shadow: var(--shadow-card);
}

.auth-form-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 6px;
}

.auth-form-header p {
    font-size: 14px;
    font-weight: 300;
    color: var(--color-text-muted);
    margin: 0 0 28px;
}

/* ---- Alerts / flash messages ---- */
.alert {
    font-size: 13px;
    font-weight: 400;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    animation: alertIn 0.25s ease;
}

.alert--error {
    background: #FDEDEC;
    color: #C0392B;
    border: 1px solid #F5C6C2;
}

.alert--success {
    background: #EAFAF1;
    color: #1E8449;
    border: 1px solid #ABEBC6;
}

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

/* ---- Form ---- */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--color-text);
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--color-text-muted);
    display: flex;
}

.input-wrap input {
    width: 100%;
    font-family: var(--font-base);
    font-size: 14px;
    color: var(--color-text);
    padding: 13px 14px 13px 42px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #FCFDFE;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input-wrap input::placeholder { color: #A6ADB8; }

.input-wrap input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.14);
}

.input-wrap input.input-error {
    border-color: var(--color-error);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
}

.toggle-password:hover { color: var(--color-primary); }
.toggle-password:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.field-error {
    display: block;
    min-height: 16px;
    font-size: 12px;
    color: var(--color-error);
    margin-top: 6px;
}

/* ---- Remember me / forgot password row ---- */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text-muted);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }

.checkbox__box {
    width: 17px;
    height: 17px;
    border: 1.5px solid var(--color-border);
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.checkbox input:checked + .checkbox__box {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox input:checked + .checkbox__box::after {
    content: "";
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg) translate(-1px, -1px);
}

.checkbox input:focus-visible + .checkbox__box {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.link-muted {
    font-size: 13px;
    color: var(--color-primary);
    font-weight: 500;
}

/* ---- Submit button ---- */
.btn-primary {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: #fff;
    font-family: var(--font-base);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-soft);
    transition: background 0.18s ease, transform 0.12s ease;
}

.btn-primary:hover { background: #2568c9; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:focus-visible { outline: 2px solid #163e79; outline-offset: 2px; }

.btn-primary:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.auth-footer-note {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-muted);
    margin: 28px 0 0;
}

/* ---- Portal tag on the brand panel ---- */
.portal-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    margin-bottom: 18px;
}

.portal-switch {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 18px 0 0;
}

/* ---- Portal chooser (index.php) ---- */
.portal-select {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    overflow: hidden;
}

.portal-select__logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
}

.portal-select h1 { font-size: 26px; font-weight: 600; margin: 0 0 6px; }
.portal-select p { font-size: 14px; color: var(--color-text-muted); margin: 0 0 36px; }

.portal-select__cards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.portal-card {
    width: 200px;
    padding: 32px 20px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.portal-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
    text-decoration: none;
}

.portal-card__title { font-size: 17px; font-weight: 600; }
.portal-card__desc { font-size: 13px; color: var(--color-text-muted); }

/* ---------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------- */
@media (max-width: 900px) {
    .auth-page { grid-template-columns: 1fr; height: auto; overflow: auto; }
    html, body { overflow: auto; }
    .auth-brand { display: none; } /* hide illustration panel on small screens */
    .auth-form-panel { padding: 24px 16px; height: auto; overflow: visible; }
    .auth-form-wrapper { padding: 36px 26px; box-shadow: none; border: none; }
    .auth-form-header__logo { display: block; }
    .portal-select { height: auto; overflow: visible; }
}

@media (max-width: 380px) {
    .auth-form-wrapper { padding: 28px 18px; }
}