/* -------------------------------------------------------------
   COMPACT MOBILE-FIRST STYLESHEET - OPTIMIZED FOR IPHONE 6S / 7
   Ensures all 4 information boxes fit on screen without scrolling
-------------------------------------------------------------- */

:root {
  --bg-primary: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #17223b;
  --bg-input: #1e293b;
  --border-color: #334155;
  --border-highlight: #3b82f6;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.3);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-full: 9999px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.35;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
  padding: 6px 8px 30px;
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* -------------------------------------------------------------
   1. COMPACT TOP BAR: KHO ACC + NÚT LẤY ACC TRÊN 1 HÀNG
-------------------------------------------------------------- */
.compact-top-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-label {
  color: var(--text-muted);
  font-weight: 500;
}

.status-badge strong {
  font-size: 16px;
  font-weight: 800;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.status-unit {
  font-size: 12px;
  color: var(--text-dim);
}

.btn-refresh {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}

.btn-refresh:active {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Nút Lấy Acc dưới cùng dưới Thông tin 2 */
.bottom-action-section {
  display: flex;
  margin-top: 4px;
}

.btn-get-acc-bottom {
  width: 100%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 11px 18px;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s ease;
}

.btn-get-acc-bottom:active {
  transform: scale(0.97);
  background: #1d4ed8;
}

/* -------------------------------------------------------------
   2. MINI STATUS NOTIFY BAR (SIÊU MỎNG)
-------------------------------------------------------------- */
.mini-notify-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.12);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #6ee7b7;
}

.mini-notify-bar.error {
  background: rgba(239, 68, 68, 0.12);
  border-left-color: var(--danger);
  color: #fca5a5;
}

/* -------------------------------------------------------------
   3. CARD SECTION: TÀI KHOẢN VỪA LẤY (HIỂN THỊ TRỌN 4 Ô)
-------------------------------------------------------------- */
.card-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.3px;
}

.btn-copy-raw {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.btn-copy-raw:active {
  color: #fff;
  border-color: var(--primary);
}

/* Danh sách 4 ô thông tin xếp dọc siêu gọn */
.fields-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s ease, border-color 0.1s ease;
}

.field-box:active {
  background: var(--bg-card-hover);
}

.field-box.copied {
  border-color: var(--success) !important;
  background: var(--success-bg) !important;
}

.field-box-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}

.copy-badge {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.field-box.copied .copy-badge {
  color: var(--success);
  background: rgba(16, 185, 129, 0.2);
}

.field-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
  line-height: 1.25;
}

/* -------------------------------------------------------------
   4. OTP WIDGET (1 HÀNG GỌN GÀNG)
-------------------------------------------------------------- */
.otp-widget {
  margin-top: 6px;
  background: linear-gradient(145deg, #131d33, #0d1527);
  border: 1px solid #2563eb;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.otp-box-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.otp-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.otp-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #60a5fa;
}

.otp-tag-title {
  font-size: 11px;
  font-weight: 700;
  color: #60a5fa;
}

.otp-digits {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #38bdf8;
}

.otp-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.otp-timer-pill {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.25);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.copy-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.otp-box-row.copied .copy-tag {
  color: var(--success);
  background: rgba(16, 185, 129, 0.25);
}

.otp-progress-bar {
  height: 2px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.otp-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 1s linear;
}

/* -------------------------------------------------------------
   5. QUICK REPORT SECTION (2 Ô NHỎ)
-------------------------------------------------------------- */
.quick-report-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--bg-card);
  padding: 6px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.report-box {
  display: flex;
  flex-direction: column;
}

.report-input-row {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px 5px;
}

.input-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

.error-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.info-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.report-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 16px; /* Ngăn iOS Safari tự zoom */
  font-family: var(--font-sans);
  padding: 4px 2px;
  min-width: 0;
}

.report-input-row input::placeholder {
  color: var(--text-dim);
  font-size: 12px;
}

.btn-fill-current {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #f59e0b;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-fill-current:active {
  background: rgba(245, 158, 11, 0.2);
}

.btn-paste {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 7px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, background 0.1s ease;
}

.btn-paste:active {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.2);
}

.btn-send {
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  color: #ffffff;
  white-space: nowrap;
}

.btn-send:active {
  transform: scale(0.92);
}

.error-send {
  background: #ef4444;
}

.info-send {
  background: #3b82f6;
}

/* -------------------------------------------------------------
   6. ACCORDIONS (GẬP LẠI GỌN GÀNG DƯỚI CÙNG)
-------------------------------------------------------------- */
.accordions-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.count-pill {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.accordion-arrow {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.accordion-item.active .accordion-arrow {
  transform: rotate(180deg);
  color: #38bdf8;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.accordion-item.active .accordion-content {
  max-height: 500px;
}

.accordion-body {
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

textarea#txtAccountsInput {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 8px;
  outline: none;
  resize: vertical;
}

.actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-act {
  flex: 1 1 calc(50% - 3px);
  min-height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
}

.btn-primary { background: #2563eb; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }
.btn-danger {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  flex-basis: 100%;
}

.list-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.btn-mini {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-clear { color: #f87171; }

.report-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.report-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
}

.report-item-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-main);
  word-break: break-all;
}

.btn-del-item {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  padding: 2px 4px;
  cursor: pointer;
}

.empty-state {
  text-align: center;
  padding: 10px;
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

/* -------------------------------------------------------------
   7. FLOATING TOAST
-------------------------------------------------------------- */
.floating-toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 999999;
  white-space: nowrap;
}

.floating-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.floating-toast.success { border-color: var(--success); color: #6ee7b7; }
.floating-toast.error { border-color: var(--danger); color: #fca5a5; }
