/* =========================================================
   AUTH PAGES — Scoped CSS
   Wrapper: .auth-page
   Chỉ tác động lên trang login + register.
   KHÔNG đụng global.
   ========================================================= */

.auth-page {
    position: relative;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
    background:
        radial-gradient(1100px 700px at 0% 0%, rgba(99, 102, 241, 0.10), transparent 60%),
        radial-gradient(900px 700px at 100% 100%, rgba(14, 165, 233, 0.10), transparent 60%),
        linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #0F172A;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.auth-page *,
.auth-page *::before,
.auth-page *::after {
    box-sizing: border-box;
}

/* ===== Shell ===== */
.auth-page .auth-shell {
    width: 100%;
    max-width: 1140px;
    min-height: 600px;
    background: #FFFFFF;
    border-radius: 18px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 32px -8px rgba(15, 23, 42, 0.12),
        0 24px 48px -16px rgba(37, 99, 235, 0.18);
    border: 1px solid #E2E8F0;
}

@media (min-width: 992px) {
    .auth-page .auth-shell {
        grid-template-columns: 48% 52%;
        min-height: 620px;
    }
}

/* ===== Brand Panel (left) ===== */
.auth-page .auth-brand {
    display: none;
    position: relative;
    padding: 48px 44px;
    color: #FFFFFF;
    background:
        radial-gradient(800px 500px at 0% 0%, rgba(255, 255, 255, 0.12), transparent 60%),
        radial-gradient(700px 500px at 100% 100%, rgba(14, 165, 233, 0.55), transparent 60%),
        linear-gradient(135deg, #2563EB 0%, #4F46E5 55%, #6366F1 100%);
    overflow: hidden;
}

@media (min-width: 992px) {
    .auth-page .auth-brand {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
}

.auth-page .auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.10), transparent 35%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08), transparent 35%);
    pointer-events: none;
}

.auth-page .auth-brand-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 28px;
}

.auth-page .auth-brand-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-page .auth-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-page .auth-brand-mark svg {
    width: 22px;
    height: 22px;
    color: #FFFFFF;
}

.auth-page .auth-brand-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #FFFFFF;
}

.auth-page .auth-brand-content {
    position: relative;
    z-index: 1;
    margin-top: 4px;
}

.auth-page .auth-brand-title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 14px;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

@media (min-width: 1200px) {
    .auth-page .auth-brand-title {
        font-size: 34px;
    }
}

.auth-page .auth-brand-subtitle {
    font-size: 15px;
    line-height: 1.65;
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    max-width: 36ch;
}

.auth-page .auth-brand-features {
    position: relative;
    z-index: 1;
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-page .auth-brand-features li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14.5px;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.5;
}

.auth-page .auth-brand-features .check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.20);
    border: 1px solid rgba(255, 255, 255, 0.30);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-page .auth-brand-features .check svg {
    width: 12px;
    height: 12px;
    color: #FFFFFF;
}

.auth-page .auth-brand-cta {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding-top: 24px;
}

.auth-page .auth-brand-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.30);
    border-radius: 999px;
    color: #FFFFFF;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-page .auth-brand-switch:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.45);
    color: #FFFFFF;
    transform: translateY(-1px);
}

.auth-page .auth-brand-switch:active {
    transform: translateY(0);
}

.auth-page .auth-brand-switch .arrow {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===== Mobile brand header (chỉ hiện < 992px) ===== */
.auth-page .auth-mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #2563EB 0%, #4F46E5 100%);
    color: #FFFFFF;
    border-radius: 14px;
    margin-bottom: 18px;
    box-shadow: 0 6px 16px -4px rgba(37, 99, 235, 0.30);
}

@media (min-width: 992px) {
    .auth-page .auth-mobile-brand {
        display: none;
    }
}

.auth-page .auth-mobile-brand .mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-page .auth-mobile-brand .mark svg {
    width: 18px;
    height: 18px;
    color: #FFFFFF;
}

.auth-page .auth-mobile-brand .name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ===== Form Panel (right) ===== */
.auth-page .auth-form-panel {
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
}

@media (min-width: 576px) {
    .auth-page .auth-form-panel {
        padding: 40px 36px;
    }
}

@media (min-width: 992px) {
    .auth-page .auth-form-panel {
        padding: 48px 56px;
        justify-content: center;
    }
}

.auth-page .auth-form-inner {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.auth-page .auth-form-logo {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 28px;
}

.auth-page .auth-form-logo img {
    max-height: 44px;
    max-width: 200px;
    object-fit: contain;
    display: block;
}

.auth-page .auth-form-heading {
    font-size: 26px;
    font-weight: 700;
    color: #0F172A;
    margin: 0 0 8px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

@media (min-width: 992px) {
    .auth-page .auth-form-heading {
        font-size: 30px;
    }
}

.auth-page .auth-form-subheading {
    font-size: 14.5px;
    color: #64748B;
    margin: 0 0 28px;
    line-height: 1.55;
}

/* ===== Form Fields ===== */
.auth-page .auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-page .auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-page .auth-field-label {
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    margin: 0;
}

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

.auth-page .auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #94A3B8;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.auth-page .auth-field input[type="text"],
.auth-page .auth-field input[type="email"],
.auth-page .auth-field input[type="password"] {
    width: 100%;
    height: 50px;
    padding: 0 14px 0 44px;
    font-size: 15px;
    color: #0F172A;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    outline: none;
    transition:
        border-color 180ms ease,
        box-shadow 180ms ease,
        background-color 180ms ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-family: inherit;
}

.auth-page .auth-field input[type="text"]::placeholder,
.auth-page .auth-field input[type="email"]::placeholder,
.auth-page .auth-field input[type="password"]::placeholder {
    color: #94A3B8;
}

.auth-page .auth-field input[type="text"]:hover,
.auth-page .auth-field input[type="email"]:hover,
.auth-page .auth-field input[type="password"]:hover {
    border-color: #CBD5E1;
}

.auth-page .auth-field input[type="text"]:focus,
.auth-page .auth-field input[type="email"]:focus,
.auth-page .auth-field input[type="password"]:focus {
    border-color: #4F46E5;
    background: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

/* Chrome autofill */
.auth-page .auth-field input:-webkit-autofill,
.auth-page .auth-field input:-webkit-autofill:hover,
.auth-page .auth-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #0F172A;
    -webkit-box-shadow: 0 0 0px 1000px #F8FAFC inset;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: #0F172A;
}

.auth-page .auth-field input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #FFFFFF inset, 0 0 0 4px rgba(79, 70, 229, 0.12);
    border-color: #4F46E5;
}

/* Password eye toggle */
.auth-page .auth-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #94A3B8;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease;
    padding: 0;
    z-index: 2;
}

.auth-page .auth-eye:hover {
    color: #4F46E5;
    background: rgba(79, 70, 229, 0.08);
}

.auth-page .auth-eye:focus {
    outline: none;
    color: #4F46E5;
    background: rgba(79, 70, 229, 0.10);
}

.auth-page .auth-eye svg {
    width: 18px;
    height: 18px;
}

.auth-page .auth-field input[type="password"] {
    padding-right: 48px;
}

/* ===== Form Row (remember + forgot) ===== */
.auth-page .auth-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: -2px;
}

.auth-page .auth-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.auth-page .auth-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4F46E5;
    cursor: pointer;
    border-radius: 4px;
    margin: 0;
    flex-shrink: 0;
}

.auth-page .auth-check label {
    cursor: pointer;
    margin: 0;
    line-height: 1;
}

.auth-page .auth-link {
    color: #4F46E5;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color 150ms ease;
}

.auth-page .auth-link:hover {
    color: #4338CA;
    text-decoration: underline;
}

/* ===== Submit Button ===== */
.auth-page .auth-submit {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 12px;
    color: #FFFFFF;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    background: linear-gradient(135deg, #4F46E5 0%, #2563EB 55%, #0EA5E9 100%);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 8px 18px -6px rgba(79, 70, 229, 0.45);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        filter 180ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    font-family: inherit;
}

.auth-page .auth-submit:hover {
    transform: translateY(-1px);
    box-shadow:
        0 2px 4px rgba(15, 23, 42, 0.08),
        0 12px 24px -8px rgba(79, 70, 229, 0.55);
    filter: brightness(1.04);
}

.auth-page .auth-submit:active {
    transform: translateY(0);
    filter: brightness(0.98);
}

.auth-page .auth-submit:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.35);
    outline-offset: 2px;
}

.auth-page .auth-submit:disabled {
    cursor: not-allowed;
    opacity: 0.85;
    transform: none;
}

.auth-page .auth-submit .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

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

/* ===== Bottom link ===== */
.auth-page .auth-bottom {
    margin-top: 18px;
    text-align: center;
    font-size: 14px;
    color: #64748B;
}

.auth-page .auth-bottom a {
    color: #4F46E5;
    font-weight: 600;
    text-decoration: none;
    transition: color 150ms ease;
}

.auth-page .auth-bottom a:hover {
    color: #4338CA;
    text-decoration: underline;
}

/* ===== Error state (giữ chỗ cho $errors - hiện tại error qua Swal, dùng class này nếu cần) ===== */
.auth-page .auth-field.has-error input[type="text"],
.auth-page .auth-field.has-error input[type="email"],
.auth-page .auth-field.has-error input[type="password"] {
    border-color: #F87171;
    background: #FEF2F2;
}

.auth-page .auth-field.has-error .auth-input-icon {
    color: #EF4444;
}

.auth-page .auth-field-error {
    font-size: 12.5px;
    color: #DC2626;
    margin-top: 2px;
    line-height: 1.4;
}

/* ===== Tablet ===== */
@media (max-width: 991.98px) and (min-width: 768px) {
    .auth-page .auth-shell {
        min-height: 0;
    }
    .auth-page .auth-form-panel {
        padding: 40px 40px;
    }
}

/* ===== Small mobile tweaks ===== */
@media (max-width: 575.98px) {
    .auth-page {
        padding: 16px 12px;
    }
    .auth-page .auth-form-panel {
        padding: 28px 20px;
    }
    .auth-page .auth-form-heading {
        font-size: 23px;
    }
    .auth-page .auth-brand-title {
        font-size: 22px;
    }
}

@media (max-width: 360px) {
    .auth-page {
        padding: 12px 8px;
    }
    .auth-page .auth-form-panel {
        padding: 24px 16px;
    }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    .auth-page *,
    .auth-page *::before,
    .auth-page *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
