/* =============================================================================
 * auth.css — shared styles for the trade2sync legacy auth screens.
 *
 * Used by:
 *   /app/login.php        (customer legacy login)
 *   /app/admin/index.php  (admin / support login + OTP)
 *
 * Components that are the same on both screens share one class name here
 * (page, shell, brand panel, form panel, card, inputs, buttons, alerts).
 * ---------------------------------------------------------------------------*/

/* -----------------------------------------------------------------------------
 * Design tokens
 * ---------------------------------------------------------------------------*/
:root {
    --t2s-primary: #3664F7;
    --t2s-primary-dark: #1745d9;
    --t2s-primary-soft: rgba(54, 100, 247, 0.14);
    --t2s-white: #ffffff;
    --t2s-dark: #101426;
    --t2s-muted: #687086;
    --t2s-border: rgba(54, 100, 247, 0.16);
    --t2s-shadow: 0 28px 90px rgba(16, 20, 38, 0.22);
    --danger-bg: rgba(255, 77, 77, 0.08);
    --danger-border: rgba(255, 77, 77, 0.18);
    --danger-text: #d92f2f;
    --info-bg: rgba(54, 100, 247, 0.08);
    --info-border: rgba(54, 100, 247, 0.16);
    --info-text: #1745d9;
    --t2s-danger: #d92f2f;
    --t2s-warning: #b3721a;
    --t2s-info: #1745d9;
    --t2s-success: #1f9d68;
}

/* -----------------------------------------------------------------------------
 * Base / reset
 * ---------------------------------------------------------------------------*/
* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
}

body {
    font-family: "Google Sans Flex", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    color: var(--t2s-dark);
    background:
        radial-gradient(circle at 14% 12%, rgba(54, 100, 247, 0.28), transparent 30%),
        radial-gradient(circle at 88% 18%, rgba(90, 123, 255, 0.22), transparent 28%),
        radial-gradient(circle at 50% 92%, rgba(54, 100, 247, 0.14), transparent 38%),
        linear-gradient(135deg, #f7f9ff 0%, #eef3ff 44%, #ffffff 100%);
    overflow-x: hidden;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

/* -----------------------------------------------------------------------------
 * Layout: page > shell > (brand panel | form panel > card)
 * ---------------------------------------------------------------------------*/
.auth-page {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 16px;
    isolation: isolate;
}

.auth-page::before,
.auth-page::after {
    content: "";
    position: fixed;
    z-index: -1;
    width: 360px;
    height: 360px;
    border-radius: 999px;
    filter: blur(6px);
    opacity: 0.9;
    pointer-events: none;
}

.auth-page::before {
    top: -120px;
    left: -120px;
    background: rgba(54, 100, 247, 0.14);
}

.auth-page::after {
    right: -140px;
    bottom: -140px;
    background: rgba(54, 100, 247, 0.18);
}

.auth-shell {
    width: 100%;
    max-width: 860px;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 34px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--t2s-shadow);
    backdrop-filter: blur(22px);
    overflow: hidden;
}

/* -----------------------------------------------------------------------------
 * Brand panel (left)
 * ---------------------------------------------------------------------------*/
.auth-brand {
    position: relative;
    min-height: 560px;
    padding: 42px;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(54, 100, 247, 0.96), rgba(23, 69, 217, 0.98)),
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.28), transparent 34%);
    overflow: hidden;
}

.auth-brand::before,
.auth-brand::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

.auth-brand::before {
    width: 300px;
    height: 300px;
    right: -100px;
    top: -90px;
}

.auth-brand::after {
    width: 390px;
    height: 390px;
    left: -150px;
    bottom: -170px;
}

.auth-brand-inner {
    position: relative;
    z-index: 2;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
}

.rebrand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    padding: 9px 13px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

.mobile-branding .rebrand-badge {
    border-color: var(--t2s-border);
    background: var(--t2s-primary-soft);
    color: var(--t2s-primary);
}

.badge-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #5DFFB2;
    box-shadow: 0 0 0 5px rgba(93, 255, 178, 0.18);
}

.brand-copy h1 {
    margin: 26px 0 0;
    font-size: clamp(34px, 5vw, 52px);
    line-height: 1.04;
    font-weight: 800;
    letter-spacing: -0.055em;
}

.brand-transition-card {
    margin-top: 30px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.14);
}

.brand-transition-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.old-brand,
.new-brand {
    min-width: 0;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 16px;
    background: #fff;
}

.old-brand img,
.new-brand img {
    display: block;
    width: auto;
    height: auto;
    max-height: 42px;
    max-width: 100%;
}

.old-brand img {
    max-width: 74px;
}

.new-brand img {
    max-width: 122px;
}

.transition-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
}

.brand-points {
    display: grid;
    gap: 12px;
    margin-top: 26px;
}

.brand-point {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}

.brand-point::before {
    content: "";
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12);
}

.brand-point a {
    color: #fff;
    font-weight: 800;
}

.brand-footer-note {
    max-width: 420px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    line-height: 1.7;
}

/* -----------------------------------------------------------------------------
 * Form panel (right) + card
 * ---------------------------------------------------------------------------*/
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 38px;
    background: rgba(255, 255, 255, 0.94);
}

.auth-card {
    width: 100%;
    max-width: 390px;
}

.auth-card h1,
.auth-card h2 {
    color: var(--t2s-dark);
    font-size: 32px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.045em;
}

.auth-card h1 {
    margin: 18px 0 8px;
}

.auth-card h2 {
    margin: 18px 0 22px;
}

.auth-subtitle {
    margin: 0 0 26px;
    color: var(--t2s-muted);
    font-size: 14px;
    line-height: 1.7;
    font-weight: 500;
}

/* Mobile-only branding shown when the brand panel is hidden */
.mobile-branding {
    display: none;
    margin-bottom: 20px;
    text-align: center;
}

.mobile-branding .mobile-brand-logo {
    display: block;
    width: 150px;
    max-width: 60%;
    height: auto;
    margin: 14px auto 0;
}

.mobile-transition {
    display: none;
    margin: 16px 0 22px;
    padding: 12px;
    border: 1px solid var(--t2s-border);
    border-radius: 20px;
    background: rgba(54, 100, 247, 0.06);
}

/* -----------------------------------------------------------------------------
 * Alerts
 * ---------------------------------------------------------------------------*/
.auth-alert {
    width: 100%;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.auth-alert-error {
    border: 1px solid var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.auth-alert-info {
    border: 1px solid var(--info-border);
    background: var(--info-bg);
    color: var(--info-text);
}

/* Small inline validation message under a field (hidden until shown by JS) */
.inline-error {
    display: none;
    margin: -2px 0 14px;
    color: var(--t2s-danger);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

/* -----------------------------------------------------------------------------
 * Toast notices (fixed top-center flash message stack)
 * ---------------------------------------------------------------------------*/
.alert-stack {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 50%;
    z-index: 50;
    width: min(92vw, 520px);
    transform: translateX(-50%);
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.notice {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 45px rgba(16, 20, 38, 0.16);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    pointer-events: auto;
    transition: 0.22s ease;
}

.notice.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
}

.notice-warning {
    border: 1px solid rgba(255, 177, 66, 0.32);
    color: var(--t2s-warning);
}

.notice-info {
    border: 1px solid rgba(54, 100, 247, 0.22);
    color: var(--t2s-info);
}

.notice-success {
    border: 1px solid rgba(36, 176, 117, 0.26);
    color: var(--t2s-success);
}

.notice-close {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: rgba(16, 20, 38, 0.07);
    color: currentColor;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

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

/* Two side-by-side fields (e.g. new password + repeat password) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.auth-card label {
    display: block;
    margin-bottom: 8px;
    color: #2b3145;
    font-size: 13px;
    font-weight: 700;
}

.auth-input {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid #dfe5f4;
    border-radius: 16px;
    background: #f8faff;
    color: var(--t2s-dark);
    font-size: 16px;
    font-weight: 500;
    outline: 0;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.auth-input:focus {
    border-color: rgba(54, 100, 247, 0.56);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(54, 100, 247, 0.12);
}

.auth-input:disabled {
    cursor: not-allowed;
    color: #6b7280;
    background: #eef2ff;
    -webkit-text-fill-color: #6b7280;
}

/* -----------------------------------------------------------------------------
 * Buttons
 * ---------------------------------------------------------------------------*/
.auth-btn {
    width: 100%;
    min-height: 54px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--t2s-primary), var(--t2s-primary-dark));
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 16px 35px rgba(54, 100, 247, 0.32);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.2s ease;
    cursor: pointer;
}

.auth-btn:hover,
.auth-btn:focus {
    background: linear-gradient(135deg, #4974ff, var(--t2s-primary));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 20px 42px rgba(54, 100, 247, 0.4);
}

.auth-btn:active {
    transform: translateY(1px);
    box-shadow: 0 10px 24px rgba(54, 100, 247, 0.26);
}

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

.auth-btn-secondary {
    margin-top: 10px;
    background: #eef2ff;
    color: var(--t2s-primary);
    box-shadow: none;
    border: 1px solid var(--t2s-border);
}

.auth-btn-secondary:hover,
.auth-btn-secondary:focus {
    background: #e4eaff;
    color: var(--t2s-primary-dark);
    transform: none;
    box-shadow: none;
}

/* -----------------------------------------------------------------------------
 * Divider, links and footer
 * ---------------------------------------------------------------------------*/
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 16px;
    color: #a0a8bc;
    font-size: 12px;
    font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e8edf8;
}

.auth-link {
    color: var(--t2s-primary);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.auth-link:hover,
.auth-link:focus {
    color: var(--t2s-primary-dark);
    text-decoration: underline;
}

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
    color: var(--t2s-muted);
    font-size: 13px;
    font-weight: 600;
}

.auth-footer a {
    color: var(--t2s-primary);
    font-weight: 700;
    text-decoration: none;
    transition: 0.18s ease;
}

.auth-footer a:hover {
    color: var(--t2s-primary-dark);
    text-decoration: underline;
}

/* Footer variant: links stacked vertically instead of in one row */
.auth-footer-stack {
    flex-direction: column;
    gap: 8px;
}

/* -----------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------------*/
@media (max-width: 900px) {
    .auth-page {
        align-items: center;
        justify-content: center;
        padding: 16px;
    }

    .auth-shell {
        max-width: 480px;
        margin: auto;
        grid-template-columns: 1fr;
        border-radius: 28px;
    }

    .auth-brand {
        display: none;
    }

    .auth-panel {
        padding: 30px 22px;
    }

    .mobile-branding {
        display: block;
    }

    .auth-card {
        max-width: none;
    }

    .auth-card h1 {
        font-size: 28px;
    }

    .auth-card h2 {
        margin-bottom: 20px;
        font-size: 28px;
        text-align: center;
    }
}

@media (max-width: 520px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .auth-page {
        padding: 14px;
    }

    .auth-panel {
        padding: 26px 18px;
    }

    .auth-shell {
        border-radius: 24px;
    }

    .auth-card h1,
    .auth-card h2 {
        font-size: 26px;
    }

    .auth-input,
    .auth-btn {
        min-height: 50px;
        border-radius: 14px;
    }
}

@media (max-width: 380px) {
    .auth-page {
        padding-left: 10px;
        padding-right: 10px;
    }

    .auth-panel {
        padding: 22px 14px 20px;
    }

    .auth-shell {
        border-radius: 22px;
    }

    .mobile-transition .brand-transition-row {
        grid-template-columns: 1fr;
    }

    .mobile-transition .transition-arrow {
        margin: -3px auto;
        transform: rotate(90deg);
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
