*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --ink: #0E1B33;
    --ink-soft: #5C6B8A;
    --ink-faint: #93A2C2;
    --primary: #2451C4;
    --primary-dark: #15306B;
    --primary-soft: #EAF0FC;
    --surface: #F8FAFC;
    --card: rgba(255, 255, 255, 0.75);
    --border: rgba(255, 255, 255, 0.6);
    --success: #10B981;
    --success-soft: #D1FAE5;
    --danger: #EF4444;
    --danger-soft: #FEE2E2;
    --accent: #F59E0B;
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: var(--font-body);
    background: var(--surface);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    color: var(--ink);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    padding: calc(env(safe-area-inset-top, 0px) + 20px) 12px calc(env(safe-area-inset-bottom, 0px) + 24px);
    box-sizing: border-box;
}

.bg-blob-1 {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: #C4D2F2;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.8;
    pointer-events: none;
}

.bg-blob-2 {
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 250px;
    height: 250px;
    background: #FDE68A;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.6;
    pointer-events: none;
}

#login-wrapper {
    width: 100% !important;
    max-width: 420px !important;
    padding: 0;
    margin: 8px auto 0 !important;
    z-index: 10;
    position: relative;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.login-ads-wrapper {
    width: 100% !important;
    max-width: 420px !important;
    margin: 18px auto 24px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
    clear: both !important;
    position: relative;
    z-index: 10;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.dynamic-ad-footer {
    width: 100% !important;
    max-width: 300px !important;
    min-height: 250px;
    margin: 0 auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center;
    clear: both !important;
    position: relative;
    z-index: 10;
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

.dynamic-ad-login-native {
    width: 100% !important;
    max-width: 320px !important;
    margin: 0 auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center;
    clear: both !important;
    position: relative;
    z-index: 10;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.card {
    background: var(--card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px 32px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(14, 27, 51, 0.08);
    border: 1.5px solid var(--border);
    position: relative;
    overflow: hidden;
}

.route-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    margin-bottom: 28px;
    padding: 0 10px;
}

.route-stop {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    z-index: 2;
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.route-stop.dest {
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-soft);
}

.route-line {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 5px;
    height: 2px;
    background: dashed 2px #CBD5E1;
    z-index: 1;
}

.route-road {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: -2px;
    height: 2px;
    border-bottom: 2px dashed #CBD5E1;
    z-index: 1;
    opacity: 0.6;
}

.bus-icon {
    position: absolute;
    top: -14px;
    left: 0;
    display: inline-block;
    z-index: 3;
    animation: driveBusPos 6s infinite ease-in-out;
}

.login-bus-svg {
    animation: driveBusGlowUU 6s infinite ease-in-out;
    transition: filter 0.3s ease;
}

.login-bus-svg .bus-body {
    transition: opacity 0.3s ease;
}

.login-bus-svg .bus-to-right { animation: opacityToGreen 6s infinite ease-in-out; }
.login-bus-svg .bus-to-left { animation: opacityToBlue 6s infinite ease-in-out; }
.login-bus-svg .wheel { animation: driveBusWheelUU 6s infinite ease-in-out; transition: fill 0.3s ease; }

@keyframes driveBusPos {
    0% {
        left: 0;
        transform: scaleX(-1);
    }

    49.9% {
        transform: scaleX(-1);
    }

    50% {
        left: calc(100% - 44px);
        transform: scaleX(1);
    }

    99.9% {
        transform: scaleX(1);
    }

    100% {
        left: 0;
        transform: scaleX(-1);
    }
}

@keyframes opacityToBlue {
    0%,
    49.9% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

@keyframes opacityToGreen {
    0%,
    49.9% {
        opacity: 0;
    }

    50%,
    100% {
        opacity: 1;
    }
}

@keyframes driveBusGlowUU {

    0%,
    49.9% {
        filter: drop-shadow(0 2px 6px rgba(36, 81, 196, 0.6));
    }

    50%,
    100% {
        filter: drop-shadow(0 2px 6px rgba(22, 163, 74, 0.6));
    }
}

@keyframes driveBusWheelUU {

    0%,
    49.9% {
        fill: #1D4ED8;
    }

    50%,
    100% {
        fill: #0F6B3C;
    }
}

.logo-wrap {
    text-align: center;
    margin-bottom: 32px;
}

.logo-badge {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #FFF;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 20px rgba(36, 81, 196, 0.25);
}

.portal-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.5px;
}

.portal-sub {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    margin-top: 6px;
}

.alert {
    background: var(--danger-soft);
    border: 1px solid #FCA5A5;
    color: var(--danger);
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    display: none;
}

.field {
    margin-bottom: 20px;
}

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 8px;
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    outline: none;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.input-wrap input:focus {
    border-color: var(--primary);
    background: #FFF;
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--ink-faint);
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.toggle-pw {
    cursor: pointer;
    transition: color 0.2s;
}

.toggle-pw:hover {
    color: var(--primary);
}

.btn-submit {
    width: 100%;
    padding: 16px;
    margin-top: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #FFF;
    border: none;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(36, 81, 196, 0.25);
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(36, 81, 196, 0.35);
}

.btn-submit:active {
    transform: scale(0.98);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 18px 0 12px;
    text-align: center;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #E5E7EB;
}

.dark-theme .auth-divider::before,
.dark-theme .auth-divider::after {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.auth-divider span {
    padding: 0 10px;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.8px;
    color: #9CA3AF;
    text-transform: uppercase;
}

.google-btn-wrapper {
    display: none;
    width: 100%;
    justify-content: center;
    margin-bottom: 4px;
}

.google-btn-wrapper iframe {
    margin: 0 auto !important;
}

.btn-google-auth {
    width: 100%;
    min-height: 42px;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #F9FAFB;
    color: #6B7280;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: none;
    transition: all 0.2s ease;
}

.dark-theme .btn-google-auth {
    background: rgba(255, 255, 255, 0.03);
    color: #94A3B8;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.btn-google-auth:hover {
    background: #F3F4F6;
    border-color: #D1D5DB;
    color: #4B5563;
    transform: none;
    box-shadow: none;
}

.dark-theme .btn-google-auth:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    color: #E2E8F0;
    transform: none;
    box-shadow: none;
}

.btn-google-auth:active {
    transform: scale(0.99);
}

.btn-google-auth svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    filter: grayscale(1);
    opacity: 0.72;
    transition: opacity 0.2s, filter 0.2s;
}

.btn-google-auth:hover svg {
    opacity: 0.88;
}

.google-auth-hint {
    text-align: center;
    margin-top: 7px;
    font-size: 10.5px;
    color: #9CA3AF;
    line-height: 1.35;
}

.dark-theme .google-auth-hint {
    color: #64748B;
}

.google-auth-hint strong {
    color: #6B7280;
    font-weight: 500;
}

.dark-theme .google-auth-hint strong {
    color: #94A3B8;
}

.card-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-soft);
    line-height: 1.5;
}

.badge-route {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success-soft);
    color: var(--success);
    padding: 5px 12px;
    border-radius: 100px;
    font-weight: 700;
    border: 1px solid #A7F3D0;
    font-size: 11px;
}

.dot-live {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

/* Custom Remember Me Checkbox */
.remember-wrap {
    display: inline-flex;
    align-items: center;
    margin-bottom: 20px;
    cursor: pointer;
    user-select: none;
    align-self: flex-start;
}

.remember-wrap input[type="checkbox"] {
    display: none;
}

.remember-wrap .custom-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #CBD5E1;
    border-radius: 5px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
    position: relative;
    flex-shrink: 0;
}

.remember-wrap input[type="checkbox"]:checked+.custom-checkbox {
    border-color: var(--primary);
    background: var(--primary);
}

.remember-wrap .custom-checkbox::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.15s ease;
    margin-bottom: 2px;
}

.remember-wrap input[type="checkbox"]:checked+.custom-checkbox::after {
    opacity: 1;
}

.remember-wrap .label-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    transition: color 0.2s;
}

.remember-wrap:hover .label-text {
    color: var(--primary);
}

.remember-wrap:hover .custom-checkbox {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Prevent transitions on page load */
.preload * {
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -ms-transition: none !important;
    -o-transition: none !important;
    transition: none !important;
}

/* Dark Theme Variables */
:root.dark-theme {
    --ink: #FFFFFF;
    --ink-soft: #A1A1AA;
    --ink-faint: #71717A;
    --surface: #000000;
    --card: rgba(14, 14, 18, 0.85);
    --border: rgba(255, 255, 255, 0.14);
    --primary-soft: rgba(36, 81, 196, 0.2);
    --danger-soft: rgba(224, 72, 59, 0.15);
    --success-soft: rgba(16, 185, 129, 0.15);
}

/* Dark Theme Overrides */
.dark-theme .bg-blob-1 {
    background: rgba(36, 81, 196, 0.15);
}

.dark-theme .bg-blob-2 {
    background: rgba(245, 158, 11, 0.10);
}

.dark-theme .input-wrap input {
    background: #121216;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
}

.dark-theme .input-wrap input:focus {
    background: #181820;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.dark-theme .remember-wrap .custom-checkbox {
    border-color: rgba(255, 255, 255, 0.15);
    background: #121216;
}

.dark-theme .badge-route {
    border-color: rgba(16, 185, 129, 0.25);
}

.dark-theme .route-line {
    border-bottom: 2px dashed rgba(255, 255, 255, 0.05);
}

.dark-theme .route-road {
    border-bottom: 2px dashed rgba(255, 255, 255, 0.05);
}

/* 1. All Standard Mobile Devices (iPhone, Samsung, Pixel, Xiaomi: 361px - 480px) */
@media (max-width: 480px) {
    body {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        padding: calc(env(safe-area-inset-top, 0px) + 16px) 12px calc(env(safe-area-inset-bottom, 0px) + 24px) !important;
        box-sizing: border-box !important;
    }

    #login-wrapper {
        width: 100% !important;
        max-width: 420px !important;
        padding: 0 !important;
        margin: 4px auto 0 !important;
        box-sizing: border-box !important;
    }

    .login-ads-wrapper {
        width: 100% !important;
        max-width: 320px !important;
        margin: 16px auto 20px !important;
        gap: 14px !important;
    }

    .card {
        padding: 28px 18px !important;
        border-radius: 20px !important;
    }

    .route-bar {
        margin-bottom: 22px;
    }

    .logo-wrap {
        margin-bottom: 24px;
    }

    .portal-title {
        font-size: 21px;
    }

    .portal-sub,
    .card-footer {
        font-size: 12px;
    }

    .field {
        margin-bottom: 16px;
    }

    .input-wrap input {
        padding-top: 13px;
        padding-bottom: 13px;
        font-size: 13.5px;
    }

    .btn-submit {
        padding: 14px;
        font-size: 14px;
    }
}

/* 2. Ultra-Compact Mobile Devices (<= 360px) */
@media (max-width: 360px) {
    body {
        padding: calc(env(safe-area-inset-top, 0px) + 12px) 8px calc(env(safe-area-inset-bottom, 0px) + 20px) !important;
    }

    #login-wrapper {
        padding: 0 !important;
        margin: 2px auto 0 !important;
    }

    .card {
        padding: 22px 14px !important;
        border-radius: 16px !important;
    }

    .login-ads-wrapper {
        max-width: 100% !important;
        margin: 14px auto 16px !important;
    }

    .dynamic-ad-footer iframe {
        max-width: 100% !important;
    }
}

@media (max-height: 600px) {
    body {
        overflow-y: auto !important;
        min-height: 100dvh;
        height: auto;
        padding: 14px 10px;
    }

    #login-wrapper {
        width: 100% !important;
        max-width: 420px !important;
        padding: 0 !important;
        margin: 0 auto !important;
    }
}

/* Public Directory Links & Portal Footer (For Google Bot Crawling & Public Discovery) */
.portal-public-footer {
    width: 100% !important;
    max-width: 420px !important;
    margin: 12px auto 20px !important;
    padding: 14px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    text-align: center !important;
    z-index: 10 !important;
    position: relative !important;
    box-sizing: border-box !important;
}

.portal-public-footer .footer-links {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 8px 10px !important;
}

.portal-public-footer .footer-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    color: var(--primary) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    padding: 6px 12px !important;
    background: rgba(255, 255, 255, 0.72) !important;
    border: 1px solid rgba(36, 81, 196, 0.2) !important;
    border-radius: 20px !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    white-space: nowrap !important;
}

.portal-public-footer .footer-link:hover {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(36, 81, 196, 0.2) !important;
}

.portal-public-footer .footer-link svg {
    flex-shrink: 0 !important;
}

.portal-public-footer .footer-desc {
    font-size: 11.5px !important;
    color: var(--ink-soft) !important;
    line-height: 1.5 !important;
    margin: 4px 0 0 !important;
    max-width: 380px !important;
}

.portal-public-footer .footer-copy {
    font-size: 10.5px !important;
    color: var(--ink-faint) !important;
    letter-spacing: 0.2px !important;
}

:root.dark-theme .portal-public-footer .footer-link {
    background: rgba(30, 41, 59, 0.75) !important;
    color: #93C5FD !important;
    border-color: rgba(147, 197, 253, 0.25) !important;
}

:root.dark-theme .portal-public-footer .footer-link:hover {
    background: #3B82F6 !important;
    color: #ffffff !important;
    border-color: #3B82F6 !important;
}

:root.dark-theme .portal-public-footer .footer-desc {
    color: #94A3B8 !important;
}

:root.dark-theme .portal-public-footer .footer-copy {
    color: #64748B !important;
}

@media (max-width: 360px) {
    .portal-public-footer {
        padding: 10px 6px !important;
        gap: 8px !important;
    }
    .portal-public-footer .footer-link {
        font-size: 11px !important;
        padding: 5px 9px !important;
    }
    .portal-public-footer .footer-desc {
        font-size: 10.5px !important;
    }
}

