/* ==========================================================================
   DESKTOP LOGIN STYLES (Zalo Web Style - Desktop Only)
   Strictly isolated: Desktop view only applies on min-width: 992px.
   Mobile view (< 992px) remains 100% untouched.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. MOBILE ISOLATION (< 992px)
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .desktop-login {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
   2. DESKTOP VIEW (>= 992px)
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {

    /* Hide the mobile auth wrapper on desktop */
    .auth-wrapper {
        display: none !important;
    }

    body.page-auth-login {
        background: linear-gradient(180deg, #edf5fd 0%, #e5f0fc 100%) !important;
        min-height: 100vh;
        overflow-x: hidden;
    }

    body.page-auth-login main#main {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }

    .desktop-login {
        min-height: 100vh;
        width: 100%;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 40px 20px 32px;
        box-sizing: border-box;
        background: linear-gradient(180deg, #edf5fd 0%, #e5f0fc 100%);
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        color: #1e293b;
    }

    /* Brand Header */
    .desktop-login__brand {
        text-align: center;
        margin-bottom: 24px;
        user-select: none;
    }

    .desktop-login__logo {
        font-size: 52px;
        font-weight: 800;
        color: #1e4a30;
        margin: 0 0 10px 0;
        line-height: 1;
        letter-spacing: -0.5px;
    }

    .desktop-login__subtitle {
        margin: 0;
        font-size: 17px;
        line-height: 1.45;
        color: #1e293b;
        font-weight: 400;
    }

    .desktop-login__subtitle span {
        display: block;
    }

    /* White Card */
    .desktop-login__card {
        width: 100%;
        max-width: 486px;
        background-color: #ffffff;
        border-radius: 20px;
        box-shadow: 0 12px 40px rgba(0, 104, 255, 0.08), 0 2px 10px rgba(0, 0, 0, 0.04);
        overflow: hidden;
        position: relative;
    }

    /* Card Header */
    .desktop-login__header {
        position: relative;
        padding: 18px 24px;
        border-bottom: 1px solid #f1f5f9;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .desktop-login__title {
        font-size: 16px;
        font-weight: 700;
        color: #1e293b;
        margin: 0;
        text-align: center;
    }

    .desktop-login__menu-container {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }

    .desktop-login__menu-btn {
        width: 34px;
        height: 34px;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        background-color: #ffffff;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0;
        transition: background-color 0.15s, border-color 0.15s;
        color: #374151;
    }

    .desktop-login__menu-btn:hover {
        background-color: #f8fafc;
        border-color: #cbd5e1;
    }

    .desktop-login__menu-icon {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
    }

    .desktop-login__menu-icon span {
        display: block;
        width: 14px;
        height: 2px;
        background-color: #374151;
        border-radius: 1px;
    }

    /* Dropdown menu */
    .desktop-login__dropdown {
        position: absolute;
        right: 0;
        top: calc(100% + 8px);
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        padding: 6px 0;
        min-width: 220px;
        z-index: 50;
    }

    .desktop-login__dropdown-item {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 16px;
        background: none;
        border: none;
        color: #1e293b;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        text-align: left;
        transition: background-color 0.15s;
    }

    .desktop-login__dropdown-item:hover {
        background-color: #f1f5f9;
        color: #1e4a30;
    }

    .desktop-login__dropdown-item .material-icons-outlined {
        font-size: 20px;
        color: #64748b;
    }

    .desktop-login__dropdown-item:hover .material-icons-outlined {
        color: #1e4a30;
    }

    /* Card Body */
    .desktop-login__body {
        padding: 34px 28px 24px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* QR Code Box */
    .desktop-login__qr-box {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 22px 20px 16px;
        display: flex;
        flex-direction: column;
        align-items: center;
        background: #ffffff;
        width: 254px;
        box-sizing: border-box;
    }

    .desktop-login__qr-code {
        width: 212px;
        height: 212px;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        overflow: hidden;
        border-radius: 8px;
        background: #f8fafc;
    }

    .desktop-login__qr-target {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .desktop-login__qr-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    /* QR State Overlays */
    .desktop-login__qr-overlay {
        position: absolute;
        inset: 0;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(2px);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 16px;
        box-sizing: border-box;
        text-align: center;
        z-index: 10;
        animation: fadeIn 0.2s ease;
    }

    /* Loading State */
    .desktop-login__qr-spinner {
        width: 32px;
        height: 32px;
        border: 3px solid #e2e8f0;
        border-top-color: #1e4a30;
        border-radius: 50%;
        animation: desktopQrSpin 0.8s linear infinite;
        margin-bottom: 12px;
    }

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

    .desktop-login__qr-loading-text {
        font-size: 13px;
        color: #64748b;
        font-weight: 500;
    }

    /* Scanned State */
    .desktop-login__scanned-avatar {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #1e4a30;
        box-shadow: 0 4px 12px rgba(0, 104, 255, 0.2);
        margin-bottom: 10px;
    }

    .desktop-login__scanned-name {
        font-size: 14px;
        font-weight: 700;
        color: #0f172a;
        margin-bottom: 6px;
        max-width: 180px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .desktop-login__scanned-desc {
        font-size: 12px;
        color: #475569;
        line-height: 1.4;
    }

    .desktop-login__scanned-pulse {
        width: 8px;
        height: 8px;
        background: #1e4a30;
        border-radius: 50%;
        margin-top: 10px;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
        animation: desktopPulseGreen 1.5s infinite;
    }

    @keyframes desktopPulseGreen {
        0% {
            box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
        }

        70% {
            box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
        }

        100% {
            box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
        }
    }

    /* Expired State */
    .desktop-login__expired-icon {
        font-size: 34px !important;
        color: #f97316;
        margin-bottom: 8px;
    }

    .desktop-login__expired-title {
        font-size: 13.5px;
        font-weight: 600;
        color: #1e293b;
        margin-bottom: 12px;
    }

    .desktop-login__refresh-btn {
        background: #1e4a30;
        color: #ffffff;
        font-size: 13px;
        font-weight: 600;
        padding: 8px 18px;
        border-radius: 20px;
        border: none;
        cursor: pointer;
        transition: background 0.15s ease;
        box-shadow: 0 2px 8px rgba(0, 104, 255, 0.25);
    }

    .desktop-login__refresh-btn:hover {
        background: #0056d6;
    }

    /* Success State */
    .desktop-login__success-icon {
        font-size: 42px !important;
        color: #1e4a30;
        margin-bottom: 8px;
    }

    .desktop-login__success-title {
        font-size: 15px;
        font-weight: 700;
        color: #0f172a;
        margin-bottom: 4px;
    }

    .desktop-login__success-desc {
        font-size: 12.5px;
        color: #64748b;
    }

    .desktop-login__qr-svg {
        width: 100%;
        height: 100%;
        display: block;
    }

    .desktop-login__qr-info {
        margin-top: 14px;
        text-align: center;
    }

    .desktop-login__qr-desc-highlight {
        color: #1e4a30;
        font-size: 15px;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 3px;
    }

    .desktop-login__qr-desc-sub {
        color: #1e293b;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.3;
    }

    /* Promo Banner (Zalo PC) */
    .desktop-login__promo {
        margin-top: 28px;
        width: 100%;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        padding: 14px 18px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        background-color: #ffffff;
        box-sizing: border-box;
    }

    .desktop-login__promo-graphic {
        flex-shrink: 0;
        width: 64px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .desktop-login__laptop-svg {
        width: 64px;
        height: 44px;
        display: block;
    }

    .desktop-login__promo-content {
        flex: 1;
        min-width: 0;
    }

    .desktop-login__promo-title {
        font-size: 13.5px;
        font-weight: 700;
        color: #111827;
        margin: 0 0 4px 0;
        line-height: 1.3;
    }

    .desktop-login__promo-desc {
        font-size: 12px;
        color: #64748b;
        line-height: 1.35;
        margin: 0;
    }

    .desktop-login__promo-btn {
        flex-shrink: 0;
        background-color: #1e4a30;
        color: #ffffff !important;
        font-size: 13.5px;
        font-weight: 600;
        padding: 9px 18px;
        border-radius: 6px;
        text-decoration: none;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.15s;
    }

    .desktop-login__promo-btn:hover {
        background-color: #0056d6;
    }

    /* Switchable Password Login View */
    .desktop-login__view {
        width: 100%;
    }

    .desktop-login__form {
        width: 100%;
    }

    .desktop-login__field {
        margin-bottom: 16px;
        width: 100%;
    }

    .desktop-login__input-wrap {
        position: relative;
        display: flex;
        align-items: center;
        width: 100%;
    }

    .desktop-login__field-icon {
        position: absolute;
        left: 14px;
        color: #94a3b8;
        font-size: 20px;
        pointer-events: none;
    }

    .desktop-login__input {
        width: 100%;
        height: 46px;
        padding: 10px 42px 10px 44px;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        font-size: 14.5px;
        color: #1e293b;
        background-color: #ffffff;
        outline: none;
        transition: border-color 0.15s, box-shadow 0.15s;
        box-sizing: border-box;
    }

    .desktop-login__input:focus {
        border-color: #1e4a30;
        box-shadow: 0 0 0 3px rgba(0, 104, 255, 0.12);
    }

    .desktop-login__input.is-invalid {
        border-color: #ef4444;
    }

    .desktop-login__eye-btn {
        position: absolute;
        right: 12px;
        background: none;
        border: none;
        color: #94a3b8;
        cursor: pointer;
        padding: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .desktop-login__eye-btn:hover {
        color: #475569;
    }

    .desktop-login__eye-btn .material-icons-outlined {
        font-size: 20px;
    }

    .desktop-login__error {
        display: block;
        color: #ef4444;
        font-size: 12px;
        margin-top: 5px;
    }

    .desktop-login__actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
        font-size: 13.5px;
    }

    .desktop-login__checkbox {
        display: flex;
        align-items: center;
        gap: 8px;
        color: #475569;
        cursor: pointer;
        user-select: none;
    }

    .desktop-login__checkbox input {
        cursor: pointer;
        accent-color: #1e4a30;
        width: 16px;
        height: 16px;
    }

    .desktop-login__link {
        color: #1e4a30;
        text-decoration: none;
        font-size: 13.5px;
        transition: color 0.15s;
    }

    .desktop-login__link:hover {
        text-decoration: underline;
        color: #0056d6;
    }

    .desktop-login__link--bold {
        font-weight: 600;
    }

    .desktop-login__submit-btn {
        width: 100%;
        height: 46px;
        background-color: #1e4a30;
        color: #ffffff;
        border: none;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.15s, transform 0.05s;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .desktop-login__submit-btn:hover {
        background-color: #0056d6;
    }

    .desktop-login__submit-btn:active {
        transform: scale(0.99);
    }

    .desktop-login__register-prompt {
        text-align: center;
        margin-top: 16px;
        font-size: 13.5px;
        color: #64748b;
    }

    /* Footer Languages */
    .desktop-login__footer {
        margin-top: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 16px;
    }

    .desktop-login__lang-link {
        color: #1e4a30;
        font-size: 13.5px;
        text-decoration: none;
        font-weight: 400;
        transition: opacity 0.15s;
    }

    .desktop-login__lang-link:hover {
        text-decoration: underline;
    }

    .desktop-login__lang-link--active {
        font-weight: 600;
    }
}