:root {
  --bg-dark: #0b0f19;
  --bg-card: #151c2c;
  --bg-card-hover: #1e293b;
  --primary: #ee4d2d; /* Shopee Orange */
  --primary-hover: #ff5722;
  --primary-glow: rgba(238, 77, 45, 0.35);
  --secondary: #3b82f6;
  --accent: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #26334d;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* MOBILE HEADER BAR (Hidden on Desktop) */
.mobile-header-bar {
  display: none;
  height: 60px;
  background: #0f1626;
  border-bottom: 1px solid var(--border-color);
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
}

.brand-icon-sm {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #f97316);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
}

.btn-mobile-toggle {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
}

.mobile-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 998;
  transition: opacity 0.3s ease;
}

.mobile-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

/* LOGIN LOCK SCREEN OVERLAY - CENTERED PREMIUM MODAL */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: all 0.4s ease;
}

.login-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.login-card {
  background: linear-gradient(145deg, #161e31, #0f1626);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 2.75rem 2.25rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px var(--primary-glow);
  text-align: center;
  animation: modalScale 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes modalScale {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.login-brand-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), #f97316);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: #fff;
  margin: 0 auto 1.25rem;
  box-shadow: 0 8px 25px var(--primary-glow);
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  margin-bottom: 6px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.login-card form {
  width: 100%;
}

.login-card label {
  text-align: left;
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.password-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-group i.input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.password-input-group input {
  width: 100%;
  padding: 14px 48px 14px 46px;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1.1rem;
  letter-spacing: 3px;
  text-align: center;
  transition: all 0.25s ease;
}

.password-input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  outline: none;
}

.toggle-pwd-btn {
  position: absolute;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  font-size: 1.2rem;
  transition: color 0.2s ease;
}

.toggle-pwd-btn:hover {
  color: #fff;
}

.login-error-msg {
  color: #ef4444;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 10px;
  display: block;
}

.login-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.blur-content {
  filter: blur(12px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.4s ease;
}

.blur-content.unlocked {
  filter: none;
  pointer-events: auto;
  user-select: auto;
}

.btn-lock-system {
  width: 100%;
  margin-top: 12px;
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-lock-system:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

/* APP CONTAINER */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* SIDEBAR DESKTOP */
.sidebar {
  width: 280px;
  background: #0f1626;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.25rem;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 999;
  transition: transform 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.brand-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--primary), #f97316);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: 0 0 18px var(--primary-glow);
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.brand-text .badge {
  font-size: 0.65rem;
  background: rgba(238, 77, 45, 0.18);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 800;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  min-height: 44px;
}

.nav-item i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), #f97316);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.settings-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1rem;
  border: 1px solid var(--border-color);
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.settings-card label {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.settings-card input {
  width: 100%;
  padding: 10px 14px;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--primary);
  font-weight: 800;
  font-size: 0.95rem;
}

/* MAIN CONTENT DESKTOP */
.main-content {
  margin-left: 280px;
  flex: 1;
  padding: 2.25rem 3rem;
  max-width: 1350px;
  width: calc(100% - 280px);
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.25rem;
}

.header-title h1 {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* TAB PANES */
.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* CARDS */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  overflow: hidden;
}

.card-header {
  padding: 1.35rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.card-header i {
  font-size: 1.25rem;
  color: var(--primary);
}

.card-body {
  padding: 1.75rem;
}

/* FORM ELEMENTS & SELECT */
.form-group {
  margin-bottom: 1.35rem;
}

.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.required {
  color: var(--primary);
}

.form-select {
  width: 100%;
  padding: 13px 18px;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 16px;
  transition: all 0.2s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.input-with-icon {
  position: relative;
}

.input-with-icon i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.input-with-icon input {
  padding-left: 46px;
}

input[type="text"],
input[type="url"],
input[type="password"],
textarea {
  width: 100%;
  padding: 14px 18px;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 16px; /* 16px prevents iOS auto-zoom */
  transition: all 0.2s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* SUB ID GRID */
.subid-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1.75rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-color);
}

.subid-grid-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}

.tooltip-info {
  font-size: 0.82rem;
  color: var(--secondary);
  cursor: pointer;
}

.subid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 1.75rem;
}

.subid-item label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.subid-item input {
  padding: 11px 14px;
  font-size: 16px;
}

/* BUTTONS TOUCH TARGETS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  min-height: 48px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #f97316);
  color: #fff;
}

.btn-primary:hover, .btn-primary:active {
  background: linear-gradient(135deg, #ff5722, #ea580c);
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
}

.text-danger { color: #ef4444 !important; }

.btn-success {
  background: var(--accent);
  color: #fff;
}

.btn-success:hover {
  background: #059669;
}

.btn-lg {
  padding: 16px 30px;
  font-size: 1.1rem;
  width: 100%;
  margin-top: 1rem;
  min-height: 54px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  min-height: 38px;
}

.btn-copy {
  background: var(--bg-card-hover);
  color: #fff;
  border: 1px solid var(--border-color);
  padding: 12px 20px;
}

.btn-copy:hover, .btn-copy:active {
  background: var(--primary);
  border-color: var(--primary);
}

/* RESULT CARD */
.result-card.hidden {
  display: none;
}

.border-success {
  border-bottom-color: var(--accent);
}

.text-success { color: var(--accent); }
.text-warning { color: #f59e0b; }
.text-primary { color: var(--primary); }

.result-layout {
  display: grid;
  grid-template-columns: 1fr 230px;
  gap: 2rem;
}

.result-group {
  margin-bottom: 1.35rem;
}

.result-group label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.copy-box {
  display: flex;
  gap: 10px;
}

.copy-box input {
  flex: 1;
}

.highlight-box {
  background: rgba(238, 77, 45, 0.09);
  padding: 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(238, 77, 45, 0.35);
}

.code-preview {
  display: block;
  background: #090d16;
  padding: 12px 14px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #a7f3d0;
  word-break: break-all;
}

.qr-preview-box {
  text-align: center;
  background: #090d16;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-preview-box h4 {
  font-size: 0.88rem;
  margin-bottom: 12px;
  color: var(--text-muted);
}

#qr-code-img-container {
  width: 160px;
  height: 160px;
  background: #fff;
  padding: 8px;
  border-radius: 10px;
  margin-bottom: 14px;
}

#qr-code-img {
  width: 100%;
  height: 100%;
}

/* BULK & HISTORY TABLES */
.hidden { display: none !important; }

.form-row {
  display: flex;
  gap: 1rem;
}
.col-6 { flex: 1; }

.bulk-results-section {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-color);
}

.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th, .table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.table th {
  background: #090d16;
  color: var(--text-muted);
  font-weight: 700;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* MATRIX GRID */
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.matrix-card {
  background: #090d16;
  padding: 1.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  position: relative;
}

.tag-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 10px;
}

.matrix-card h4 {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.matrix-card ul {
  list-style: none;
}

.matrix-card li {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.matrix-card code {
  color: var(--primary);
  background: rgba(238, 77, 45, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
}

/* CHROME EXT & CODE BOXES */
.ext-download-box {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: #090d16;
  padding: 1.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.ext-icon {
  font-size: 3.2rem;
  color: var(--secondary);
}

.steps-list {
  padding-left: 1.5rem;
  margin-top: 1rem;
}

.steps-list li {
  margin-bottom: 12px;
  color: var(--text-muted);
}

.code-box-wrapper {
  position: relative;
  margin-top: 1rem;
}

.btn-copy-code {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg-card);
  color: #fff;
  border: 1px solid var(--border-color);
}

pre {
  background: #060a12;
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.9rem;
  color: #38bdf8;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--accent);
  color: #fff;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 100000;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.hidden {
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
}

/* =========================================================
   PERFECT MOBILE RESPONSIVE FIX (< 992px & < 768px)
   ========================================================= */
@media (max-width: 992px) {
  .mobile-header-bar {
    display: flex !important;
  }

  .app-container {
    display: block !important;
    width: 100% !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    transform: translateX(-100%) !important;
    z-index: 9999 !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 75px 1rem 2rem 1rem !important;
  }

  .top-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .header-title h1 {
    font-size: 1.4rem;
  }

  .header-title p {
    font-size: 0.88rem;
  }

  .card-body {
    padding: 1.25rem;
  }

  .subid-grid {
    grid-template-columns: 1fr;
  }

  .result-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .copy-box {
    flex-direction: column;
    gap: 8px;
  }

  .copy-box button {
    width: 100%;
    min-height: 48px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .table-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .table-actions .btn-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .table-actions .btn-group button {
    width: 100%;
  }

  .login-card {
    padding: 2rem 1.5rem;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 20px;
    text-align: center;
    justify-content: center;
  }
}
