/* styles.css — giao diện mobile SG-only, rút gọn từ bản Windows.
   Giữ tông tối mặc định; hỗ trợ sáng/tối qua body[data-theme]. */
* { box-sizing: border-box; }
:root {
  --primary: #3b82f6; --primary-hover: #2563eb; --cyan: #06b6d4;
  --green: #10b981; --orange: #f59e0b; --red: #ef4444;
  --border: #334155; --border-color: #334155;
}
body[data-theme="dark"] {
  --bg: #0f172a; --bg-card: #1e293b; --bg-input: #0f172a;
  --text-main: #f1f5f9; --text-muted: #94a3b8;
  color-scheme: dark;
}
body[data-theme="light"] {
  --bg: #f1f5f9; --bg-card: #ffffff; --bg-input: #ffffff;
  --text-main: #0f172a; --text-muted: #64748b; --border: #cbd5e1; --border-color: #cbd5e1;
  color-scheme: light;
}
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text-main); min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.hidden { display: none !important; }
h1 { font-size: 20px; margin: 0; }
h4 { color: var(--cyan); margin: 14px 0 6px; }
p { margin: 6px 0; }
button { font-family: inherit; }

/* Màn hình */
.screen { display: none; min-height: 100vh; padding: 24px 16px; }
.screen.active { display: flex; align-items: flex-start; justify-content: center; }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px; margin-top: 8vh; }
.app-title { font-size: 24px; text-align: center; }
.app-subtitle { text-align: center; color: var(--text-muted); font-size: 13px; }
.auth-note { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 14px; }

/* Tabs đăng nhập */
.auth-tabs { position: relative; display: flex; background: var(--bg-input); border-radius: 12px; padding: 6px; margin: 16px 0; }
.auth-tab { flex: 1; text-align: center; padding: 10px; font-weight: 700; font-size: 13px; cursor: pointer; z-index: 1; border-radius: 8px; }
.auth-tab.active { color: #fff; }
.tab-indicator { position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc(50% - 6px); border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); transition: transform .3s; }
.auth-tabs.register-mode .tab-indicator { transform: translateX(100%); }

/* Form */
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.field-group input, .field-group select, .gs-input-group input {
  height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-main); font-size: 15px; outline: none; width: 100%;
}
.field-group input:focus, .field-group select:focus { border-color: var(--primary); }
.error-msg { display: none; color: var(--red); font-size: 13px; margin: 8px 0; }
.error-msg.show { display: block; }

/* Nút */
.btn { border: none; border-radius: 10px; padding: 0 16px; height: 44px; font-size: 14px; font-weight: 700; cursor: pointer; color: #fff; background: #475569; }
.btn:disabled { opacity: .6; }
.btn-primary, .auth-btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); width: 100%; }
.btn-secondary { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); width: 100%; }
.btn-danger { background: var(--red); width: 100%; }
.btn-open { background: #0ea5e9; flex: 1; }
.btn-google { background: #4285f4; width: 100%; }
.btn-save { background: var(--green); width: 100%; margin-top: 8px; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-main); width: 100%; margin-top: 8px; }
.btn-row { display: flex; gap: 8px; margin-top: 8px; }
.btn-row .btn { flex: 1; width: auto; }
.mt-2 { margin-top: 8px; }

/* OTP */
.otp-boxes { display: flex; gap: 8px; justify-content: center; margin: 16px 0; }
.otp-box { width: 48px; height: 56px; text-align: center; font-size: 24px; font-weight: 800; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-main); }
.otp-box.filled { border-color: var(--primary); }
.otp-hint { color: var(--text-muted); font-size: 13px; text-align: center; }

/* Header + tabs chính */
.app-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px; gap: 8px; }
.app-header p { font-size: 11px; color: var(--text-muted); margin: 2px 0 0; }
.header-actions { display: flex; gap: 6px; }
.icon-btn { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; width: 40px; height: 40px; font-size: 17px; cursor: pointer; }
.chip { font-size: 9px; color: #60a5fa; background: rgba(59,130,246,.15); padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.main-tabs { display: flex; gap: 8px; padding: 0 16px 12px; }
.main-tab { flex: 1; text-align: center; padding: 12px 4px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border); font-weight: 700; font-size: 13px; cursor: pointer; }
.main-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: #fff; border-color: transparent; }
.main-tab-content { display: none; padding: 0 16px 24px; flex-direction: column; gap: 12px; }
.main-tab-content.active { display: flex; }
.view-fill { display: none; flex-direction: column; gap: 12px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.card-title { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.callout { background: rgba(59,130,246,.1); border-left: 3px solid var(--primary); padding: 10px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.tabs { display: flex; gap: 6px; margin: 12px 0; }
.tab { flex: 1; text-align: center; padding: 10px 4px; border-radius: 8px; background: var(--bg-input); border: 1px solid var(--border); font-size: 12px; font-weight: 700; cursor: pointer; }
.tab.active { background: var(--primary); color: #fff; border-color: transparent; }
.tab-content { display: none; padding: 8px 0; }
.tab-content.active { display: block; }

/* Upload */
.upload-area { position: relative; border: 2px dashed var(--border); border-radius: 12px; padding: 24px 12px; text-align: center; cursor: pointer; }
.upload-area.has-file { border-color: var(--green); }
.upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-icon { font-size: 28px; display: block; }
.upload-text { font-weight: 700; font-size: 13px; margin-top: 6px; }
.file-name { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.gs-input-group { margin-bottom: 10px; }
.gs-input-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 4px; }
.gs-status { font-size: 13px; margin-top: 10px; min-height: 18px; }

/* Hàng đợi */
.queue-info { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.queue-info-header { font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.queue-list > div { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.item-progress-track { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; display: none; }
.item-progress-fill { height: 100%; width: 0; background: var(--orange); transition: width .3s; }
.item-progress-fill.indeterminate { animation: slide 1.2s infinite linear; }
@keyframes slide { 0% { margin-left: 0; } 100% { margin-left: 50%; } }
.status-box { display: none; padding: 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; margin-top: 8px; }
.status-box.show { display: flex; gap: 8px; }
.status-box.info { background: rgba(59,130,246,.12); }
.status-box.success { background: rgba(16,185,129,.12); }
.status-box.error { background: rgba(239,68,68,.12); }

/* Cài đặt */
.settings-section-title { font-weight: 800; font-size: 13px; margin: 16px 0 8px; color: var(--cyan); }
.settings-intro { font-size: 13px; color: var(--text-muted); }
.gs-hint { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.app-footer { text-align: center; font-size: 11px; color: var(--text-muted); padding: 8px 16px 32px; line-height: 1.5; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100; align-items: flex-start; justify-content: center; padding: 20px 12px; overflow-y: auto; }
.modal-overlay.show { display: flex; }
.modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card); }
.modal-title { font-weight: 800; font-size: 15px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-main); }
.modal-body { padding: 16px; }
#ocrReviewTable { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 12px; }
#ocrReviewTable th, #ocrReviewTable td { padding: 6px 4px; border: 1px solid var(--border); text-align: left; }
#ocrReviewTable input, #ocrReviewTable select { width: 100%; border: none; background: transparent; color: var(--text-main); font-size: 12px; }

/* ---- Bổ sung cho bản WEB ---- */
/* Tab chọn cách đăng nhập (SĐT + OTP / Email) */
.auth-method-tabs { display: flex; gap: 6px; background: var(--bg-input); border-radius: 10px; padding: 5px; margin: 12px 0 4px; }
.auth-method-tab { flex: 1; text-align: center; padding: 9px 4px; font-weight: 700; font-size: 13px; cursor: pointer; border-radius: 8px; color: var(--text-muted); }
.auth-method-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: #fff; }
/* Hàng ghi nhớ / quên mật khẩu (kiểu hệ thống booking) */
.auth-email-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 12px; font-size: 13px; }
.remember-me { display: flex; align-items: center; gap: 6px; color: var(--text-muted); cursor: pointer; }
.remember-me input { accent-color: var(--primary); }
.auth-email-row a { color: var(--primary); text-decoration: none; font-weight: 600; }
/* Banner chế độ xem thử */
.demo-banner { margin: 0 16px 12px; padding: 10px 12px; border-radius: 10px; background: rgba(245,158,11,.15); border: 1px solid var(--orange); font-size: 13px; line-height: 1.5; }
.demo-banner-btn { margin-left: 8px; background: var(--orange); color: #fff; border: none; border-radius: 8px; padding: 4px 10px; font-weight: 700; cursor: pointer; }
/* Thẻ giải thích giới hạn điền của bản web */
.fill-limit-card { border-color: var(--orange); }
.fill-limit-card code { background: var(--bg-input); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
/* Giới hạn chiều rộng trên desktop cho giống app điện thoại */
@media (min-width: 640px) {
  #main-container, .app-header, .main-tabs, .main-tab-content, .app-footer { max-width: 560px; margin-left: auto; margin-right: auto; }
  .demo-banner { max-width: 528px; margin-left: auto; margin-right: auto; }
}
