/* ================================================
   NATIVE APP FEEL — VinAPIay
   ================================================ */

/* Disable pull-to-refresh & bounce */
html, body {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: auto;
  touch-action: manipulation;
}

body {
  position: relative;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Allow text select di input & textarea & pre */
input, textarea, pre, code, .result-text, .chat-bubble.ai {
  -webkit-user-select: text;
  user-select: text;
}

/* Disable image drag */
img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

img.clickable {
  pointer-events: auto;
}

/* Smooth scroll internal */
* {
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar (tapi tetap scrollable) */
::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}
* {
  scrollbar-width: none;
}

/* Prevent zoom on double-tap */
button, a, .fx-card, .fx-icon-btn, .btn-action {
  touch-action: manipulation;
}

/* Prevent layout shift dari address bar hide */
body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* Safe area untuk notch HP */
.wrap, /* Prevent long press popup */
a, button, img {
  -webkit-touch-callout: none;
}

/* ==== Fix scroll & native feel ==== */
html, body {
  overscroll-behavior: none !important;
  overscroll-behavior-y: none !important;
  overflow-x: hidden;
}
body {
  touch-action: pan-y !important;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
}

/* ==== Header layout baru ==== */
/* Profile card */
.fx-profile-meta .u-limit {
  color: #0EA5E9;
  font-weight: 800;
}

/* Dark mode */
body.theme-dark body.theme-dark /* ==== Fix search bar full width ==== */
/* ==== Profile card clickable ==== */
/* ==== Layout header rapi ==== */
/* ==== Search bar spacing ==== */
/* ==== Edit Name Modal ==== */
.enm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: enmFade .25s ease;
}
@keyframes enmFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.enm-modal {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 22px;
  padding: 26px 22px 20px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(15,23,42,0.35);
  animation: enmSlide .3s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes enmSlide {
  from { opacity: 0; transform: translateY(24px) scale(.95); }
  to { opacity: 1; transform: none; }
}
.enm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(14,165,233,.15), rgba(99,102,241,.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.enm-title {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.enm-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 18px;
  line-height: 1.4;
}
.enm-input {
  width: 100%;
  padding: 14px 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  color: #0f172a;
  text-align: center;
  outline: none;
  transition: all .2s;
  font-weight: 600;
}
.enm-input:focus {
  border-color: #0EA5E9;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(14,165,233,0.1);
}
.enm-counter {
  font-size: 10px;
  color: #94a3b8;
  text-align: right;
  margin-top: 6px;
  margin-bottom: 18px;
  font-family: 'SF Mono', monospace;
  font-weight: 600;
}
.enm-counter.warn { color: #dc2626; }
.enm-buttons {
  display: flex;
  gap: 8px;
}
.enm-btn {
  flex: 1;
  padding: 13px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  border: 0;
}
.enm-btn.ghost {
  background: #f1f5f9;
  color: #64748b;
}
.enm-btn.ghost:hover { background: #e2e8f0; }
.enm-btn.primary {
  background: linear-gradient(135deg, #0EA5E9, #6366F1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14,165,233,0.3);
}
.enm-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(14,165,233,0.45);
}

/* Dark mode */
body.theme-dark .enm-modal { background: #1e293b; }
body.theme-dark .enm-title { color: #f1f5f9; }
body.theme-dark .enm-sub { color: #94a3b8; }
body.theme-dark .enm-input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}
body.theme-dark .enm-input:focus {
  border-color: #0EA5E9;
  background: #0a0f1a;
}
body.theme-dark .enm-btn.ghost {
  background: #334155;
  color: #cbd5e1;
}

/* ==== Fix search bar full width ==== */


/* ================================================
   FIX SEARCH BAR — FULL WIDTH
   ================================================ */
headerbody.theme-dark 

/* ================================================
   HEADER FINAL — CLEAN
   ================================================ */

header.fx-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  width: 100%;
}

.fx-prof {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(30,64,175,0.05);
}

.fx-prof:active { transform: scale(0.98); }

.fx-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0EA5E9, #6366F1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

.fx-pinfo {
  min-width: 0;
  flex: 1;
}

.fx-pname {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fx-pmeta {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'SF Mono', monospace;
}

.fx-pmeta .u-limit { color: #0EA5E9; font-weight: 800; }

.fx-ibtn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  text-decoration: none;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(30,64,175,0.05);
}

.fx-search-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 14px;
  font-size: 14px;
  font-family: inherit;
  color: #0f172a;
  outline: none;
  box-sizing: border-box;
  transition: all .2s;
}

.fx-search-input::placeholder { color: #94a3b8; }

.fx-search-input:focus {
  border-color: #0EA5E9;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(14,165,233,0.1);
}

body.theme-dark .fx-prof,
body.theme-dark .fx-ibtn,
body.theme-dark .fx-search-input {
  background: rgba(30,41,59,0.9);
  border-color: rgba(255,255,255,0.1);
  color: #f1f5f9;
}
body.theme-dark .fx-pname { color: #f1f5f9; }
body.theme-dark .fx-pmeta { color: #94a3b8; }


/* ================================================
   HEADER v4 — FINAL (bersih)
   ================================================ */

header.fx-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 10px 14px 12px !important;
  margin: 0 !important;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(148,163,184,0.15);
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

.fx-hdr {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-bottom: 10px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.fx-prof {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 6px 14px 6px 6px !important;
  background: rgba(255,255,255,0.9) !important;
  border: 1px solid rgba(255,255,255,0.9) !important;
  border-radius: 999px !important;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(30,64,175,0.05);
}

.fx-prof:active { transform: scale(0.98); }

.fx-av {
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #0EA5E9, #6366F1) !important;
  color: #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  flex-shrink: 0 !important;
}

.fx-pinfo {
  min-width: 0 !important;
  flex: 1 !important;
}

.fx-pname {
  font-size: 13px !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  line-height: 1.2 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fx-pmeta {
  font-size: 10px !important;
  color: #64748b !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'SF Mono', monospace;
}

.fx-pmeta .u-limit { color: #0EA5E9 !important; font-weight: 800 !important; }

.fx-ibtn {
  width: 44px !important;
  height: 44px !important;
  flex-shrink: 0 !important;
  border-radius: 14px !important;
  background: rgba(255,255,255,0.9) !important;
  border: 1px solid rgba(255,255,255,0.9) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  text-decoration: none;
  color: #0f172a !important;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(30,64,175,0.05);
}

.fx-search-input {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  padding: 12px 16px !important;
  background: rgba(255,255,255,0.9) !important;
  border: 1px solid rgba(148,163,184,0.2) !important;
  border-radius: 14px !important;
  font-size: 14px !important;
  font-family: inherit !important;
  color: #0f172a !important;
  outline: none !important;
}

.fx-search-input::placeholder { color: #94a3b8 !important; }

.fx-search-input:focus {
  border-color: #0EA5E9 !important;
  background: #fff !important;
  box-shadow: 0 0 0 4px rgba(14,165,233,0.1) !important;
}

body.theme-dark header.fx-header {
  background: rgba(15,23,42,0.85) !important;
}

body.theme-dark .fx-prof,
body.theme-dark .fx-ibtn,
body.theme-dark .fx-search-input {
  background: rgba(30,41,59,0.9) !important;
  border-color: rgba(255,255,255,0.1) !important;
  color: #f1f5f9 !important;
}
body.theme-dark .fx-pname { color: #f1f5f9 !important; }
body.theme-dark .fx-pmeta { color: #94a3b8 !important; }
