/**
 * POS terminal login — touch-first, native-app feel.
 * Fixed viewport, no page scroll, large touch targets.
 */
.pospro-kitchen-login-banner {
    max-width: 420px;
    margin: 12px auto 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.45);
    color: #fecaca;
    font-size: 14px;
    text-align: center;
}

html.pospro-login-html {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    height: 100%;
    height: 100dvh;
    -webkit-text-size-adjust: 100%;
}

body.pospro-login-page.pospro-admin-theme-dark,
body.pospro-login-page.pospro-admin-theme-grey {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    background: var(--pos-bg-page, #0b1220) !important;
    background-image: var(--pos-page-grad) !important;
    color: var(--pos-text, #e2e8f0);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

body.pospro-login-page #wpadminbar,
body.pospro-login-page .site-header,
body.pospro-login-page .site-footer,
body.pospro-login-page footer,
body.pospro-login-page .entry-header,
body.pospro-login-page .page-title,
body.pospro-login-page .wp-block-template-part {
    display: none !important;
}

body.pospro-login-page #page,
body.pospro-login-page .site,
body.pospro-login-page main,
body.pospro-login-page .entry-content,
body.pospro-login-page .wp-site-blocks,
body.pospro-login-page .wp-block-post-content {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
}

.pospro-login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: safe center;
    justify-content: center;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
        max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: transparent;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

/* PIN mode: keypad dock (left / bottom on touch kiosks) + compact identity card */
.pospro-login-stage {
    width: 100%;
    max-width: min(420px, 100%);
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    min-height: 0;
}

.pospro-login-stage.is-pin-mode {
    max-width: min(960px, 100%);
}

.pospro-login-stage.is-pin-mode .pospro-login-card {
    order: 1;
}

.pospro-login-stage.is-pin-mode .pospro-pin-keypad {
    order: 2;
}

@media (min-width: 640px) and (min-height: 480px) {
    .pospro-login-stage.is-pin-mode {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: clamp(12px, 3vw, 28px);
    }
    .pospro-login-stage.is-pin-mode .pospro-login-card {
        order: 1;
        flex: 0 1 min(380px, 42vw);
        max-width: 380px;
    }
    .pospro-login-stage.is-pin-mode .pospro-pin-keypad {
        order: 2;
        flex: 1 1 52%;
        max-width: 480px;
        margin: 0;
    }
}

.pospro-login-card {
    width: 100%;
    max-width: min(430px, 100%);
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    padding: 20px 20px 16px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: #e2e8f0;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pospro-login-card.pospro-shake {
    animation: pospro-shake 0.4s ease;
}

@keyframes pospro-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.pospro-login-brand {
    text-align: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.pospro-login-avatar {
    width: 52px;
    height: 52px;
    margin: 0 auto 8px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
    overflow: hidden;
}

.pospro-login-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pospro-login-brand h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #f8fafc;
}

.pospro-login-business-type {
    margin: 2px 0 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
}

.pospro-login-tagline {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.35;
    color: #94a3b8;
}

/* Segmented native-style tabs */
.pospro-login-tabs {
    display: flex;
    gap: 0;
    padding: 4px;
    margin-bottom: 14px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.pospro-login-tab {
    flex: 1;
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #94a3b8;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease;
}

.pospro-login-tab:active { transform: scale(0.97); }

.pospro-login-tab-ico {
    font-size: 14px;
    opacity: 0.85;
}

.pospro-login-tab.is-active {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

.pospro-login-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pospro-login-panel { display: none; flex-direction: column; min-height: 0; flex: 1; }
.pospro-login-panel.is-active { display: flex; }

.pospro-password-login-form,
.pospro-pin-login-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.pospro-pin-hint {
    margin: 0 0 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #cbd5e1;
}

.pospro-login-field { margin-bottom: 12px; flex-shrink: 0; }

.pospro-login-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #7d8aa0;
}

.pospro-login-field input[type="text"],
.pospro-login-field input[type="password"] {
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    background: #0f172a;
    color: #fff;
    font-size: 17px;
    box-sizing: border-box;
    touch-action: manipulation;
}

.pospro-login-field input::placeholder { color: #475569; }

.pospro-login-field input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.28);
    background: #0c1526;
}

.pospro-password-wrap { position: relative; }
.pospro-password-wrap input { padding-right: 52px !important; }
.pospro-password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.pospro-password-toggle:active { background: rgba(255,255,255,0.08); }
.pospro-password-toggle.is-on { color: #3b82f6; }

.pospro-pin-value {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.pospro-pin-dots {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 6px 0 14px;
    flex-shrink: 0;
    min-height: 22px;
}

.pospro-pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.pospro-pin-dot.is-filled {
    background: #38bdf8;
    border-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
}

.pospro-pin-dot.is-pop { animation: pospro-pop 0.22s ease; }
@keyframes pospro-pop {
    0% { transform: scale(0.6); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.pospro-pin-dot-extra {
    display: none;
}

/* Big touch keypad — native app feel (docked beside card in PIN mode) */
.pospro-pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    width: 100%;
    box-sizing: border-box;
}

.pospro-login-stage:not(.is-pin-mode) .pospro-pin-keypad {
    display: none !important;
}

.pospro-pin-key {
    min-height: 62px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.95);
    color: #f1f5f9;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.08s ease, background 0.12s ease;
    box-shadow: 0 2px 0 rgba(0,0,0,0.35);
}

.pospro-pin-key.is-pressed,
.pospro-pin-key:active {
    background: #2563eb;
    border-color: #2563eb;
    transform: scale(0.94);
    box-shadow: none;
}

.pospro-pin-key.is-disabled { opacity: 0.55; pointer-events: none; }

.pospro-pin-key-muted {
    font-size: 15px;
    font-weight: 700;
    color: #94a3b8;
    background: rgba(30, 41, 59, 0.9);
}

.pospro-pin-key-back svg { pointer-events: none; }

.pospro-login-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 8px;
    flex-shrink: 0;
}

/* Native switch for Remember */
.pospro-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    min-height: 48px;
}
.pospro-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.pospro-switch-track {
    width: 46px;
    height: 28px;
    border-radius: 999px;
    background: #334155;
    display: inline-flex;
    align-items: center;
    padding: 3px;
    box-sizing: border-box;
    transition: background 0.18s ease;
    flex-shrink: 0;
}
.pospro-switch-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.18s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.pospro-switch input:checked + .pospro-switch-track { background: #2563eb; }
.pospro-switch input:checked + .pospro-switch-track .pospro-switch-thumb { transform: translateX(18px); }
.pospro-switch input:focus-visible + .pospro-switch-track { outline: 2px solid #3b82f6; outline-offset: 2px; }

.pospro-pin-error,
.pospro-password-error {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fecaca;
    font-size: 13px;
    line-height: 1.4;
    flex-shrink: 0;
}

.pospro-pin-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.pospro-pin-footer .pospro-switch {
    flex: 0 1 auto;
    min-width: 0;
}

.pospro-pin-submit.pospro-pin-submit-ghost {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 48px;
    padding: 0 16px;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    border: none;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
}

.pospro-pin-submit,
.pospro-password-submit {
    flex: 1;
    min-height: 56px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
    transition: transform 0.08s ease, filter 0.15s ease;
    position: relative;
}

.pospro-pin-submit:active,
.pospro-password-submit:active { transform: scale(0.98); filter: brightness(1.08); }

.pospro-btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    animation: pospro-spin 0.7s linear infinite;
}
@keyframes pospro-spin { to { transform: rotate(360deg); } }

.pospro-pin-submit.is-loading .pospro-btn-spinner,
.pospro-password-submit.is-loading .pospro-btn-spinner { display: inline-block; }
.pospro-pin-submit.is-loading,
.pospro-password-submit.is-loading { opacity: 0.85; pointer-events: none; }

.pospro-password-login-form .pospro-login-footer { margin-top: 6px; }

/* Small-height landscape / kiosk tweaks — keep keypad usable, card scrolls */
@media (max-height: 720px) {
    .pospro-login-card { padding: 14px 16px 12px; border-radius: 20px; }
    .pospro-login-avatar { width: 44px; height: 44px; margin-bottom: 6px; }
    .pospro-login-brand h1 { font-size: 17px; }
    .pospro-pin-key { min-height: 54px; font-size: 22px; border-radius: 15px; }
    .pospro-pin-submit, .pospro-password-submit { min-height: 52px; }
}

@media (max-height: 600px) {
    .pospro-login-tagline { display: none; }
    .pospro-login-avatar { display: none; }
    .pospro-pin-key { min-height: 46px; }
    .pospro-pin-dots { margin: 4px 0 8px; }
}

/* Larger touch tablets — roomier native feel */
@media (min-width: 480px) and (pointer: coarse) {
    .pospro-login-stage:not(.is-pin-mode) .pospro-login-card {
        max-width: min(460px, 100%);
        padding: 24px 24px 18px;
    }
    .pospro-pin-key { min-height: 68px; }
}

@media (max-width: 639px) {
    .pospro-login-stage,
    .pospro-login-card {
        max-height: none;
    }
    .pospro-login-stage.is-pin-mode .pospro-pin-keypad {
        order: 2;
        margin-top: 4px;
    }
    .pospro-login-stage.is-pin-mode .pospro-login-card {
        order: 1;
    }
}

#pospro-desktop-login-gate .pospro-desktop-setup-link {
    margin: 14px auto 0;
    max-width: min(460px, 100%);
    text-align: center;
}
#pospro-desktop-login-gate .pospro-desktop-setup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--pospro-login-accent, #3b82f6) 55%, transparent);
    background: transparent;
    color: var(--pospro-login-accent, #3b82f6);
    font-weight: 600;
    cursor: pointer;
}
#pospro-desktop-login-gate .pospro-desktop-setup-btn:hover {
    background: color-mix(in srgb, var(--pospro-login-accent, #3b82f6) 12%, transparent);
}
#pospro-desktop-login-gate .pospro-desktop-setup-hint {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.4;
    color: color-mix(in srgb, var(--pospro-login-text, #e2e8f0) 70%, transparent);
}
