/* =====================================================================
   HENRYLE – AI Personal Dashboard (giao dien mobile)
   - Toan trang BI KHOA truot ngang + doc; chi .screen cuon doc ben trong
   - Anh trong /public deu la PNG placeholder, chi can thay file
   - Header: ANH PNG header + overlay NUT
   - Hieu ung vien neon CHAY + CHOP (tone VANG GOLD)
   ===================================================================== */

:root {
  --maxw: 440px;
  --bg: #060a18;
  --gold: #f5c451;
  --gold2: #d4a438;
  --gold-rgb: 245, 196, 81;
  --cyan: #4dd8e0;
  --blue: #3b82f6;
  --purple: #a855f7;
  --red: #e31e24;
  --green: #34d399;
  --line: rgba(245, 196, 81, .28);
  --glow: rgba(245, 196, 81, .16);
  --neon: #f5c451;
  --card: rgba(10, 14, 36, .72);
  --card2: rgba(18, 22, 48, .85);
  --txt: #eaf0f6;
  --muted: #b0a58a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  position: fixed; inset: 0;
  color: var(--txt);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  touch-action: none;
  background: var(--bg) url("public/bg-app.png") center top / cover no-repeat;
}
a { text-decoration: none; color: inherit; }
button { border: 0; font: inherit; color: inherit; cursor: pointer; background: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }

.app { position: relative; width: min(100vw, var(--maxw)); height: 100%; margin: 0 auto; }
.screen {
  height: 100%;
  padding: 0 11px calc(70px + env(safe-area-inset-bottom));
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.screen::-webkit-scrollbar { width: 0; height: 0; }

/* ===== Khung the chung ===== */
.card, .card-banner {
  position: relative;
  border: 1.3px solid var(--line);
  background-color: var(--card);
  box-shadow: 0 0 10px var(--glow), inset 0 0 14px rgba(var(--gold-rgb),.04);
  backdrop-filter: blur(3px);
  border-radius: 14px;
}

/* ===== Nut chung ===== */
.btn-cyan {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #111; font-weight: 800; border-radius: 8px;
  padding: 6px 14px; font-size: 8px;
  box-shadow: 0 0 10px rgba(var(--gold-rgb),.35);
}
.btn-gold {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #111; font-weight: 800; border-radius: 8px;
  padding: 6px 14px; font-size: 8px;
  box-shadow: 0 0 10px rgba(var(--gold-rgb),.35);
}
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 12px; font-size: 7.5px; font-weight: 700;
  color: var(--gold); background: transparent;
}

/* ======================= HEADER ======================= */
.hero-head {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 0 0 18px 18px;
}
.hero-head-img {
  width: 100%; height: auto; display: block;
}

/* overlay buttons */
.header-bar {
  position: absolute; top: 10px; left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: flex-end;
  z-index: 5;
}
.header-logo-row {
  display: flex; align-items: center; gap: 6px;
}
.header-logo-icon {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--gold);
  object-fit: cover;
  box-shadow: 0 0 8px rgba(var(--gold-rgb),.4);
}
.header-brand {
  display: flex; flex-direction: column;
}
.header-brand-name {
  font-size: 11px; font-weight: 900; color: var(--gold);
  letter-spacing: 1.5px; text-transform: uppercase;
}
.header-brand-sub {
  font-size: 5.5px; color: var(--muted); letter-spacing: .8px;
  text-transform: uppercase; font-weight: 600;
}
.header-actions {
  display: flex; gap: 10px; align-items: center;
}
.icon-btn {
  position: relative;
  width: 22px; height: 22px;
  color: var(--gold);
  filter: drop-shadow(0 0 4px rgba(var(--gold-rgb),.5));
}
.icon-btn svg { width: 100%; height: 100%; }
.bell-badge {
  position: absolute; top: -3px; right: -4px;
  background: var(--red); color: #fff;
  font-size: 6px; font-weight: 900;
  width: 12px; height: 12px; border-radius: 50%;
  display: grid; place-items: center;
}

/* ======================= PROFILE GREETING ======================= */
.profile-section {
  position: absolute; bottom: 12px; left: 14px; right: 14px;
  z-index: 4;
  display: flex; align-items: flex-end; gap: 12px;
}
.profile-avatar-wrap {
  flex: 0 0 auto;
  position: relative;
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
  box-shadow: 0 0 16px rgba(var(--gold-rgb),.35);
}
.profile-badge {
  position: absolute; bottom: 2px; right: -2px;
  width: 20px; height: 20px; border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--bg);
}
.profile-info {
  flex: 1; min-width: 0;
}
.profile-greet {
  font-size: 7.5px; color: var(--gold2); font-weight: 500;
}
.profile-name {
  font-size: 14px; font-weight: 900; color: var(--gold);
  display: flex; align-items: center; gap: 4px;
}
.profile-name .verified {
  color: var(--gold); font-size: 12px;
}
.profile-desc {
  font-size: 6.5px; color: var(--muted); line-height: 1.4;
  margin-top: 2px;
}
.profile-sig {
  height: 16px; margin-top: 3px; opacity: .7;
}

/* ======================= HCOIN BALANCE ======================= */
.hcoin-section {
  border-color: rgba(var(--gold-rgb), 0.3) !important;
  box-shadow: 0 0 10px rgba(var(--gold-rgb), 0.15), inset 0 0 14px rgba(var(--gold-rgb), 0.04) !important;
  animation: neon-blink-gold 2.8s ease-in-out infinite !important;
}
.hcoin-section::after {
  background: conic-gradient(from var(--neon-a),
    transparent 0deg 55deg,
    rgba(var(--gold-rgb),.30) 80deg,
    var(--gold) 104deg,
    #ffffff 118deg,
    var(--gold) 132deg,
    rgba(212,164,56,.45) 156deg,
    transparent 185deg 360deg) !important;
  filter: drop-shadow(0 0 4px var(--gold)) !important;
}
@keyframes neon-blink-gold {
  0%, 100% { box-shadow: 0 0 10px rgba(var(--gold-rgb), 0.15), inset 0 0 16px rgba(var(--gold-rgb), 0.03); }
  50%      { box-shadow: 0 0 18px rgba(var(--gold-rgb), 0.35), inset 0 0 20px rgba(var(--gold-rgb), 0.06); }
}

.hcoin-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  margin-top: 8px;
}
.hcoin-icon {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; flex: 0 0 28px;
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 8px rgba(var(--gold-rgb),.3);
}
.hcoin-info { flex: 0 0 auto; min-width: 0; }
.hcoin-label {
  display: flex; align-items: center; gap: 4px;
}
.hcoin-label span {
  font-size: 8px; font-weight: 900; color: var(--gold); letter-spacing: .5px;
}
.hcoin-balance {
  font-size: 14px; font-weight: 900; color: var(--gold);
  display: flex; align-items: baseline; gap: 3px;
}
.hcoin-balance small {
  font-size: 8px; color: var(--gold2); font-weight: 700;
}
.hcoin-usd {
  font-size: 7px; color: var(--gold2); opacity: 0.8; margin-top: 1px;
}
.hcoin-chart {
  flex: 1;
  height: 36px;
  margin-left: 6px;
}
#hcoin-sparkline {
  width: 100%;
  height: 100%;
  overflow: visible;
}
#sparkline-path {
  filter: drop-shadow(0 0 3px rgba(var(--gold-rgb), 0.5));
}
/* Pulsing dot at last data point */
.spark-dot-pulse {
  filter: drop-shadow(0 0 4px var(--gold));
  animation: spark-pulse 1.5s ease-in-out infinite;
}
@keyframes spark-pulse {
  0%, 100% { opacity: 1; r: 2; }
  50%      { opacity: .5; r: 3; }
}

.hcoin-actions {
  display: flex; gap: 5px; margin-top: 6px;
  padding: 0 12px 8px;
}
.hcoin-actions .btn-outline {
  flex: 1;
  font-size: 7.5px;
  padding: 5px 0;
  border-color: rgba(var(--gold-rgb), 0.4);
  color: var(--gold);
  text-shadow: 0 0 4px rgba(var(--gold-rgb), 0.2);
  transition: all 0.2s ease;
}
.hcoin-actions .btn-outline:hover {
  background: rgba(var(--gold-rgb), 0.1);
  border-color: var(--gold);
}

/* ======================= SERVICE GRID (2x4) ======================= */
.svc-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; padding: 10px;
  margin-top: 8px;
}
.svc-item {
  display: flex; justify-content: center; align-items: center;
  text-decoration: none;
}
.svc-item img {
  width: 100%;
  max-width: 82px;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

/* ======================= SECTION HEADER ======================= */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.sec-title {
  font-size: 9px; font-weight: 900; color: var(--gold); letter-spacing: .5px;
  text-transform: uppercase;
}
.cyan-dot::before {
  content: ""; display: inline-block; width: 4px; height: 13px;
  background: var(--gold); border-radius: 2px; margin-right: 5px;
  vertical-align: middle;
}
.see-all { font-size: 7.5px; color: var(--gold); font-weight: 700; }

/* ======================= DU AN TRONG TAM ======================= */
.projects-section { margin-top: 10px; padding: 10px; }
.project-cards {
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.project-cards::-webkit-scrollbar { display: none; }
.project-card {
  flex: 0 0 95px;
  height: 138px;
  border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  background: var(--card2);
}
.project-card img {
  width: 100%; height: 100%; object-fit: cover;
}
.project-card-info {
  padding: 5px 6px;
}
.project-card-info .pc-name {
  font-size: 7.5px; font-weight: 900; color: var(--gold); text-transform: uppercase;
}
.project-card-info .pc-desc {
  font-size: 6px; color: var(--muted); line-height: 1.3; margin-top: 2px;
}

/* ======================= LICH TRINH + THONG KE (2 cot) ======================= */
.schedule-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 10px;
}

/* Lich trinh */
.schedule-card { padding: 8px; }
.schedule-card .sec-title { font-size: 8px; margin-bottom: 4px; }
.schedule-list {
  display: flex; flex-direction: column; gap: 3px;
}
.sch-item {
  display: flex; align-items: flex-start; gap: 5px;
  font-size: 6.5px; color: var(--txt);
  padding: 2px 0;
  border-left: 2px solid var(--gold);
  padding-left: 6px;
}
.sch-time {
  font-weight: 800; color: var(--gold); flex: 0 0 28px;
  font-size: 6.5px;
}
.sch-desc {
  font-weight: 500; color: #ccc; font-size: 6.5px;
  line-height: 1.3;
}

/* Thong ke */
.stats-card { padding: 8px; }
.stats-card .sec-title { font-size: 8px; margin-bottom: 6px; }
.stats-chart-wrap {
  display: flex; align-items: center; gap: 8px;
}
.stats-donut {
  position: relative;
  width: 60px; height: 60px; flex: 0 0 60px;
}
.stats-donut svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.stats-donut-circle-bg {
  fill: none; stroke: rgba(255,255,255,.08); stroke-width: 5;
}
.stats-donut-circle {
  fill: none; stroke: var(--gold); stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 157;
  stroke-dashoffset: 28;
  transition: stroke-dashoffset .6s ease;
}
.stats-donut-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.stats-donut-label .donut-val {
  font-size: 14px; font-weight: 900; color: var(--gold);
}
.stats-donut-label .donut-sub {
  font-size: 5.5px; color: var(--muted);
}
.stats-legend {
  display: flex; flex-direction: column; gap: 3px;
}
.stats-legend-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 6.5px; color: #ccc;
}
.stats-legend-dot {
  width: 5px; height: 5px; border-radius: 50%; flex: 0 0 5px;
}
.stats-legend-val {
  margin-left: auto; font-weight: 800; color: var(--gold);
  font-size: 6.5px;
}

/* ======================= CONG DONG ======================= */
.community-section {
  margin-top: 10px; padding: 10px;
}
.community-row {
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.community-row::-webkit-scrollbar { display: none; }
.community-item {
  flex: 0 0 68px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-decoration: none;
}
.community-item img {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover;
  border: 1.3px solid var(--line);
  box-shadow: 0 0 6px var(--glow);
}
.community-item .cm-name {
  font-size: 6.5px; font-weight: 700; color: var(--gold); text-align: center;
}
.community-item .cm-count {
  font-size: 5.5px; color: var(--muted);
}

/* ======================= BOTTOM NAV ======================= */
.bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around; align-items: flex-end;
  background: linear-gradient(180deg, rgba(6,10,24,.84), rgba(6,10,24,.98));
  border-top: 1px solid rgba(var(--gold-rgb),.20);
  padding: 7px 4px calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
}
.nav-item {
  position: relative; flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px; color: #555; font-size: 7.5px;
  font-weight: 700; letter-spacing: .2px;
}
.nav-item svg { width: 18px; height: 18px; color: currentColor; }
.nav-item.active { color: var(--gold); }
.nav-item.active svg { filter: drop-shadow(0 0 6px rgba(var(--gold-rgb),.5)); }
.nav-center {
  position: relative; flex: 0 0 auto;
}
.nav-center-btn {
  width: 46px; height: 46px; margin-top: -20px;
  display: block; padding: 0;
  background: none; border: none;
  box-shadow: none;
}
.nav-center-btn img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* =====================================================================
   HIEU UNG VIEN NEON CHAY + CHOP (tone VANG GOLD)
   ===================================================================== */
@property --neon-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.card::after, .card-banner::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.4px;
  background: conic-gradient(from var(--neon-a),
    transparent 0deg 55deg,
    rgba(var(--gold-rgb),.30) 80deg,
    var(--neon) 104deg,
    #ffffff 118deg,
    var(--neon) 132deg,
    rgba(212,164,56,.45) 156deg,
    transparent 185deg 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  animation: neon-run 2.8s linear infinite;
  pointer-events: none; z-index: 5;
  filter: drop-shadow(0 0 4px var(--neon));
}

.card, .card-banner { animation: neon-blink 2.8s ease-in-out infinite; }

@keyframes neon-run { to { --neon-a: 360deg; } }
@keyframes neon-blink {
  0%, 100% { box-shadow: 0 0 10px var(--glow), inset 0 0 16px rgba(var(--gold-rgb),.03); }
  50%      { box-shadow: 0 0 18px rgba(var(--gold-rgb),.35), inset 0 0 20px rgba(var(--gold-rgb),.06); }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card-banner { animation: none; }
  .card::after, .card-banner::after { animation: none; }
}
