/* ============================================
   KASIR ES TEH — LOGIN v3.0 (Mobile Modern / Gojek-like)
   Tema: Cokelat Hangat (Coffee & Caramel)
   Optimized: Font weight dikurangi, lebih ringan, clean UI
   ============================================ */

:root {
    --primary: #92400E;
    --primary-hover: #78350F;
    --primary-deep: #451A03;
    --primary-light: #FFFBEB;
    --primary-soft: #FDE68A;
    --accent: #D97706;
    --accent-hover: #B45309;
    --accent-light: #FEF3C7;
    --bg-body: #FAFAF9;
    --bg-shell-top: #FFFFFF;
    --bg-shell-bottom: #FFFBEB;
    --surface: #FFFFFF;
    --bg-input: #FAFAF9;
    --ink: #0C0A09;
    --text-strong: #1C1917;
    --text-body: #57534E;
    --text-muted: #A8A29E;
    --border-soft: #E7E5E4;
    --border-input: #D6D3D1;
    --border-focus: #92400E;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-btn: 0 4px 14px rgba(146, 64, 14, 0.25);
    --shadow-focus: 0 0 0 3px rgba(146, 64, 14, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ease-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow-x: hidden; }

body.login-page {
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-body);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
}

.app-shell {
    position: relative;
    width: 100%;
    max-width: 420px;
    min-height: 100dvh;
    background: linear-gradient(180deg, var(--bg-shell-top) 0%, var(--bg-shell-bottom) 100%);
    display: flex;
    flex-direction: column;
    padding: calc(16px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overflow-x: hidden;
}

@media (min-width: 480px) {
    .app-shell {
        min-height: auto;
        height: min(850px, 92vh);
        border-radius: 32px;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
        border: 1px solid var(--border-soft);
    }
}

.brand-row { display: flex; align-items: center; gap: 12px; flex-shrink: 0; animation: fadeDown 0.4s ease both; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.brand-logo {
    width: 42px; height: 42px; border-radius: 12px; background: var(--accent-light);
    color: var(--primary-deep); display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0; overflow: hidden; border: 1px solid var(--accent);
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.brand-id-name { font-size: 15px; font-weight: 600; color: var(--text-strong); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-id-tag { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.brand-pill {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
    background: var(--primary-light); border: 1px solid var(--primary-soft);
    color: var(--primary); border-radius: var(--radius-full); font-size: 11px; font-weight: 500; flex-shrink: 0;
}

.headline { margin-top: 20px; flex-shrink: 0; animation: fadeUp 0.5s ease 0.1s both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.headline-title { font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--text-strong); }
.hl-accent { color: var(--primary); }
.headline-sub { margin-top: 6px; font-size: 14px; color: var(--text-body); line-height: 1.5; font-weight: 400; }

.hero-scene {
    position: relative; flex: 1 1 auto; min-height: 120px; max-height: 200px;
    margin-top: 8px; display: flex; align-items: center; justify-content: center;
}
.hero-blob {
    position: absolute; width: 180px; height: 180px;
    background: radial-gradient(circle, var(--primary-soft) 0%, rgba(253, 230, 138, 0) 70%);
    border-radius: 50%; animation: blobPulse 5s ease-in-out infinite;
}
@keyframes blobPulse { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.1); opacity: 1; } }
.tea-hero { position: relative; width: 100px; height: 120px; z-index: 2; animation: floatGlass 4s ease-in-out infinite; }
@keyframes floatGlass { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.tea-hero svg { width: 100%; height: 100%; overflow: visible; }

.form-card {
    background: var(--surface); border-radius: var(--radius-xl); padding: 20px;
    box-shadow: var(--shadow-card); border: 1px solid var(--border-soft);
    flex-shrink: 0; animation: fadeUp 0.5s ease 0.2s both;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.input-field {
    position: relative; display: flex; align-items: center; background: var(--bg-input);
    border: 1px solid var(--border-input); border-radius: var(--radius-md); transition: all var(--ease-fast);
}
.input-field:focus-within { border-color: var(--border-focus); background: #FFFFFF; box-shadow: var(--shadow-focus); }
.input-field.error { border-color: #EF4444; background: #FEF2F2; animation: shake 0.3s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.input-icon { display: flex; align-items: center; justify-content: center; width: 44px; color: var(--text-muted); font-size: 15px; flex-shrink: 0; }
.input-field:focus-within .input-icon { color: var(--primary); }
.form-input {
    flex: 1; padding: 14px 12px 14px 0; background: transparent; border: none; outline: none;
    color: var(--text-strong); font-size: 16px; font-weight: 400; font-family: inherit;
    min-width: 0; -webkit-appearance: none;
}
.form-input::placeholder { color: var(--text-muted); font-weight: 400; }
.toggle-password {
    background: transparent; border: none; color: var(--text-muted); padding: 8px 12px;
    cursor: pointer; font-size: 15px; transition: color var(--ease-fast); flex-shrink: 0;
}
.toggle-password:active { color: var(--primary); }

.form-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; color: var(--text-body); font-weight: 400; }
.checkbox-wrap input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark {
    width: 18px; height: 18px; border: 1.5px solid var(--border-input); border-radius: 5px;
    background: #FFFFFF; display: flex; align-items: center; justify-content: center; transition: all var(--ease-fast); flex-shrink: 0;
}
.checkbox-wrap input:checked + .checkmark { background: var(--primary); border-color: var(--primary); }
.checkbox-wrap input:checked + .checkmark::after {
    content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: #FFFFFF; font-size: 10px;
}
.forgot-link { font-size: 13px; color: var(--primary); text-decoration: none; font-weight: 500; transition: color var(--ease-fast); }
.forgot-link:active { color: var(--primary-hover); }

.btn-login {
    position: relative; width: 100%; padding: 14px 22px; margin-top: 4px; background: var(--primary);
    color: #FFFFFF; border: none; border-radius: var(--radius-md); font-size: 15px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; overflow: hidden;
    font-family: inherit; box-shadow: var(--shadow-btn); transition: all var(--ease-fast); min-height: 48px; touch-action: manipulation;
}
.btn-login:active:not(:disabled) { transform: scale(0.98); background: var(--primary-hover); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-text, .btn-arrow { position: relative; z-index: 1; }
.btn-loader { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 6px; z-index: 2; }
.btn-login.loading .btn-text, .btn-login.loading .btn-arrow { opacity: 0; }
.btn-login.loading .btn-loader { display: flex; }
.loader-dot { width: 6px; height: 6px; background: #FFFFFF; border-radius: 50%; animation: loaderBounce 1.4s ease-in-out infinite both; }
.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes loaderBounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.security-info { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--text-muted); font-weight: 400; }
.security-info i { font-size: 12px; color: var(--primary); }

.app-footer { margin-top: auto; padding-top: 16px; text-align: center; flex-shrink: 0; animation: fadeUp 0.5s ease 0.3s both; }
.app-footer p { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.version-tag { font-size: 11px; color: var(--text-muted); opacity: 0.7; }

.toast-container {
    position: fixed; top: calc(16px + env(safe-area-inset-top)); left: 16px; right: 16px;
    z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
    max-width: 420px; margin: 0 auto;
}
.toast {
    background: #FFFFFF; padding: 12px 14px; border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 500; border-left: 3px solid var(--primary);
    animation: toastIn 0.25s ease; pointer-events: auto; color: var(--text-strong);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.toast-success { border-left-color: #10B981; }
.toast-warning { border-left-color: #F59E0B; }
.toast-error { border-left-color: #EF4444; }
.toast-info { border-left-color: #3B82F6; }
.toast-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.toast-success .toast-icon { color: #10B981; }
.toast-warning .toast-icon { color: #F59E0B; }
.toast-error .toast-icon { color: #EF4444; }
.toast-info .toast-icon { color: #3B82F6; }
.toast-content { flex: 1; line-height: 1.4; }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; font-size: 14px; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px);
    z-index: 10000; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: #FFFFFF; border-radius: var(--radius-xl); max-width: 340px; width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15); animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text-strong); display: flex; align-items: center; gap: 8px; }
.modal-close {
    width: 32px; height: 32px; background: var(--bg-input); border: none; color: var(--text-muted);
    cursor: pointer; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.modal-body { padding: 24px 20px; text-align: center; }
.modal-icon {
    width: 56px; height: 56px; margin: 0 auto 16px; background: var(--primary-light); color: var(--primary);
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.modal-text { font-size: 14px; color: var(--text-body); line-height: 1.5; font-weight: 400; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border-soft); }
.btn-modal-close {
    width: 100%; padding: 12px; background: var(--primary); color: #FFFFFF; border: none;
    border-radius: var(--radius-md); font-size: 14px; font-weight: 600; cursor: pointer;
    font-family: inherit; transition: all var(--ease-fast);
}
.btn-modal-close:active { transform: scale(0.98); background: var(--primary-hover); }

.install-prompt {
    position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); left: 16px; right: 16px;
    max-width: 420px; margin: 0 auto; z-index: 9998; animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.install-card {
    display: flex; align-items: center; gap: 12px; padding: 14px; background: #FFFFFF;
    border-radius: var(--radius-lg); box-shadow: 0 8px 24px rgba(0,0,0,0.12); border: 1px solid var(--border-soft);
}
.install-icon {
    width: 36px; height: 36px; background: var(--primary-light); border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--primary); flex-shrink: 0;
}
.install-content h3 { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.install-content p { font-size: 12px; color: var(--text-body); font-weight: 400; }
.install-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-install { padding: 8px 14px; font-size: 13px; font-weight: 600; color: #FFFFFF; background: var(--primary); border: none; border-radius: 8px; cursor: pointer; }
.btn-dismiss {
    width: 32px; height: 32px; background: var(--bg-input); border: 1px solid var(--border-soft);
    border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text-muted); cursor: pointer;
}

@media (max-width: 360px) {
    .app-shell { padding-left: 16px; padding-right: 16px; }
    .headline-title { font-size: 24px; }
    .form-card { padding: 16px; }
}
@media (max-height: 700px) {
    .hero-scene { min-height: 100px; max-height: 160px; }
    .headline { margin-top: 12px; }
    .headline-sub { display: none; }
}

/* ============================================
   FACE LOGIN MODAL & BUTTON (BARU)
   ============================================ */
.divider-text {
    display: flex; align-items: center; text-align: center; color: var(--text-muted);
    font-size: 13px; font-weight: 500; margin: 8px 0 16px;
}
.divider-text::before, .divider-text::after {
    content: ''; flex: 1; border-bottom: 1px dashed var(--border-soft);
}
.divider-text span { padding: 0 12px; }

.btn-face-login {
    width: 100%; padding: 14px 22px; background: var(--surface); color: var(--primary);
    border: 2px solid var(--primary); border-radius: var(--radius-md); font-size: 15px;
    font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center;
    gap: 8px; font-family: inherit; transition: all var(--ease-fast); min-height: 48px; touch-action: manipulation;
}
.btn-face-login:active:not(:disabled) { transform: scale(0.98); background: var(--primary-light); }
.btn-face-login i { font-size: 18px; }

.modal-face { max-width: 380px; }
.face-modal-content { text-align: center; padding: 20px; }
.face-video-wrap {
    position: relative; width: 100%; max-width: 280px; margin: 0 auto 16px;
    border-radius: var(--radius-lg); overflow: hidden; background: #000;
    aspect-ratio: 3/4; box-shadow: 0 8px 20px rgba(0,0,0,0.15); border: 2px solid var(--border-soft);
}
#faceVideo {
    width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); /* Mirror effect */
}
.face-status { font-size: 14px; font-weight: 600; color: var(--text-strong); margin-bottom: 4px; }
.gps-status { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 4px; }
/* ============================================
   LOGIN v3.2 — FACE LOGIN PRIMARY + MANUAL HIDDEN
   ✨ IMPROVED: Icon animasi, visual hierarchy lebih kuat
   ============================================ */

.face-login-primary {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 8px 0 0;
}

.face-login-primary.hidden {
    display: none !important;
}

/* ✨ ICON UTAMA - Premium dengan Pulse Ring */
.face-primary-icon {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: linear-gradient(135deg, #FFFBEB 0%, #FDE68A 50%, #FCD34D 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(146, 64, 14, 0.15);
    box-shadow:
        0 8px 20px rgba(146, 64, 14, 0.18),
        inset 0 1px 2px rgba(255, 255, 255, 0.6);
    overflow: visible;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.face-primary-icon:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 28px rgba(146, 64, 14, 0.25),
        inset 0 1px 2px rgba(255, 255, 255, 0.6);
}

/* Pulse rings yang keluar dari icon */
.face-primary-icon::before,
.face-primary-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 24px;
    border: 2px solid var(--primary);
    opacity: 0;
    pointer-events: none;
    animation: pulseRing 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.face-primary-icon::after {
    animation-delay: 1.5s;
}

@keyframes pulseRing {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    70%, 100% {
        transform: scale(1.25);
        opacity: 0;
    }
}

.face-primary-icon svg {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.face-primary-text {
    max-width: 320px;
}

.face-primary-text h2 {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 6px;
    letter-spacing: -0.015em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Badge "Cepat" kecil di samping judul */
.face-primary-text h2::after {
    content: '⚡';
    font-size: 16px;
}

.face-primary-text p {
    font-size: 13px;
    color: var(--text-body);
    line-height: 1.6;
    font-weight: 400;
    margin: 0 auto;
}

/* ✨ BUTTON UTAMA - Lebih standout dengan gradient kuat */
.btn-face-login.large {
    width: 100%;
    min-height: 56px;
    padding: 16px 22px;
    background: linear-gradient(135deg, #92400E 0%, #B45309 50%, #D97706 100%);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 6px 20px rgba(146, 64, 14, 0.35),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.btn-face-login.large::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-face-login.large:hover::before {
    opacity: 1;
}

.btn-face-login.large:active:not(:disabled) {
    transform: translateY(1px) scale(0.98);
    box-shadow:
        0 3px 10px rgba(146, 64, 14, 0.3),
        inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-face-login.large i {
    font-size: 20px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* Toggle ke manual login */
.btn-manual-toggle {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    color: var(--text-body);
    border: 1px dashed var(--border-input);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-manual-toggle:hover {
    background: var(--primary-light);
    border-color: var(--primary-soft);
    color: var(--primary);
    border-style: solid;
}

.btn-manual-toggle:active {
    transform: scale(0.98);
}

.btn-manual-toggle i {
    color: var(--primary);
    font-size: 14px;
}

.manual-login {
    display: none;
}

.manual-login.show {
    display: flex !important;
}

.btn-back-face {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 4px;
    background: var(--bg-input);
    color: var(--text-body);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-family: inherit;
    transition: all var(--ease-fast);
}

.btn-back-face:hover {
    background: var(--primary-light);
    border-color: var(--primary-soft);
    color: var(--primary);
}

.btn-back-face:active {
    transform: scale(0.98);
}

.btn-back-face i {
    color: var(--primary);
}

/* Responsive */
@media (max-width: 360px) {
    .face-primary-icon {
        width: 72px;
        height: 72px;
        border-radius: 20px;
    }

    .face-primary-icon svg {
        width: 42px;
        height: 42px;
    }

    .face-primary-text h2 {
        font-size: 17px;
    }

    .face-primary-text p {
        font-size: 12.5px;
    }

    .btn-face-login.large {
        min-height: 52px;
        font-size: 14.5px;
    }
}

/* Reduce motion untuk aksesibilitas */
@media (prefers-reduced-motion: reduce) {
    .face-primary-icon::before,
    .face-primary-icon::after {
        animation: none;
    }
}