/* ============================================
   KASIR ES TEH — LOGIN v1.1 (Mobile Modern / Gojek-like)
   Tema: Cokelat Hangat (Coffee & Caramel)
   Optimized: Font weight dikurangi, lebih ringan, clean UI
   ============================================ */

:root {
    /* Warna Utama — Cokelat Kopi Tua */
    --primary: #92400E;
    --primary-hover: #78350F;
    --primary-deep: #451A03;
    --primary-light: #FFFBEB;
    --primary-soft: #FDE68A;
    
    /* Warna Aksen — Karamel/Amber */
    --accent: #D97706;
    --accent-hover: #B45309;
    --accent-light: #FEF3C7;
    
    /* Warna Latar & Permukaan (Netral hangat — Stone) */
    --bg-body: #FAFAF9;
    --bg-shell-top: #FFFFFF;
    --bg-shell-bottom: #FFFBEB;
    --surface: #FFFFFF;
    --bg-input: #FAFAF9;

    /* Warna Teks (Stone neutral) */
    --ink: #0C0A09;
    --text-strong: #1C1917;
    --text-body: #57534E;
    --text-muted: #A8A29E;

    /* Border Modern & Halus */
    --border-soft: #E7E5E4;
    --border-input: #D6D3D1;
    --border-focus: #92400E;

    /* Bayangan Lebih Halus & Premium */
    --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 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Font */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Animasi */
    --ease-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset Global */
* {
    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; /* Base font proporsional untuk mobile */
    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
   ============================================ */
.app-shell {
    position: relative;
    width: 100%;
    max-width: 420px; /* Standar lebar mobile modern */
    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);
    }
}

/* ============================================
   HEADER & BRAND
   ============================================ */
.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; /* Diubah dari 800 agar tidak terlalu bold */
    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; /* Diubah dari 700 */
    flex-shrink: 0;
}

/* ============================================
   HEADLINE
   ============================================ */
.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; /* Diubah dari 800 */
    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 (Dioptimalkan untuk Performa)
   ============================================ */
.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 (Modern & Clean)
   ============================================ */
.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; /* Wajib 16px agar iOS tidak auto-zoom */
    font-weight: 400; /* DIUBAH: Dari 600 ke 400 agar TIDAK BOLD */
    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); }

/* Opsi Formulir */
.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; /* Diubah dari 500 */
}

.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; /* Diubah dari 700 */
    transition: color var(--ease-fast);
}

.forgot-link:active { color: var(--primary-hover); }

/* Tombol Login */
.btn-login {
    position: relative;
    width: 100%;
    padding: 14px 22px;
    margin-top: 4px;
    background: var(--primary); /* Solid & modern seperti Gojek */
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600; /* Diubah dari 800 */
    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); }

/* ============================================
   FOOTER, TOAST & MODAL (Dioptimalkan)
   ============================================ */
.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 */
.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 */
.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;
}

/* Responsive adjustments */
@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; } /* Hemat ruang di layar pendek */
}