/* ===== Knowledge Hub – app.css (shell only) ===== */

:root{
  /* JS က header height ကို update လုပ်သုံးတဲ့ var */
  --header-total: 60px;

  /* Light theme */
  --bg: #f0f2f5;
  --surface: rgba(255,255,255,0.92);
  --text: #1f2937;
  --muted: #6b7280;
  --border: rgba(0,0,0,0.08);

  /* Brand gradient */
  --grad-a: #1a2980;
  --grad-b: #26d0ce;

  /* Sidebar */
  --sidebar: rgba(255,255,255,0.92);
  --sidebarText: rgba(17,24,39,0.92);

  /* Accent / active */
  --activeBorder: #f1c40f;

  /* Radius / shadow */
  --r-lg: 18px;
  --r-md: 14px;
  --shadow: 0 18px 40px rgba(0,0,0,0.12);
  --shadow-soft: 0 10px 22px rgba(0,0,0,0.10);
}

body[data-theme="dark"]{
  --bg: #0b1020;
  --surface: rgba(17,26,51,0.92);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --border: rgba(255,255,255,0.10);

  --sidebar: rgba(17,26,51,0.96);
  --sidebarText: rgba(255,255,255,0.86);

  --grad-a: #0f1730;
  --grad-b: #111a33;

  --activeBorder: #6ee7ff;

  --shadow: 0 18px 40px rgba(0,0,0,0.45);
  --shadow-soft: 0 12px 28px rgba(0,0,0,0.35);
}

*{ box-sizing:border-box; }
html, body{ height:100%; }

body{
  margin:0;
  font-family: "Pyidaungsu","Myanmar3", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x:hidden;
}

/* ----- Overlay (mobile menu backdrop) ----- */
.overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 40;
}
.overlay.show{
  opacity: 1;
  pointer-events: auto;
}

/* ----- Header ----- */
.header{
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-total);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  border-bottom: 1px solid rgba(255,255,255,0.16);
  box-shadow: var(--shadow-soft);
}

.header .left{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
  flex:1;
}

.header .actions{flex:0 0 auto}
.menu-icon,.theme-toggle,.close-btn{appearance:none;-webkit-appearance:none}
.logo{flex:1;min-width:0}
.logo-badge{font-size:14px}
.logo h1{max-width:none}

.menu-icon{
  width: 44px;
  height: 44px;
  display:grid;
  place-items:center;
  border-radius: 14px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.96);
  cursor:pointer;
  user-select:none;
  transition: transform .15s ease, background .15s ease;
}
.menu-icon:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.20); }

.logo{
  display:flex;
  align-items:center;
  gap: 10px;
  cursor:pointer;
  user-select:none;
  min-width:0;
}

.logo-badge{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: rgba(255,255,255,0.20);
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.96);
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(0,0,0,0.22);
  flex: 0 0 auto;
}

.logo h1{
  margin:0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .2px;
  color: rgba(255,255,255,0.95);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 60vw;
}

/* right actions */
.actions{
  display:flex;
  align-items:center;
  gap: 10px;
}
.theme-toggle{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.96);
  cursor:pointer;
  user-select:none;
  transition: transform .15s ease, background .15s ease;
}
.theme-toggle:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.20); }

/* ----- Mobile Sidebar ----- */
.mobile-sidebar{
  position: fixed;
  top: 0;
  left: 0;
  height: 100dvh;
  width: min(88vw, 360px);
  background: var(--sidebar);
  color: var(--sidebarText);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform .22s ease;
  z-index: 60;
  display:flex;
  flex-direction:column;
}

.mobile-sidebar.open{
  transform: translateX(0);
}

.sidebar-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-top .title{
  font-weight: 1000;
  letter-spacing: .2px;
  color: var(--text);
}
body[data-theme="dark"] .sidebar-top .title{ color: rgba(255,255,255,0.92); }

.close-btn{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.02);
  cursor:pointer;
  user-select:none;
  transition: transform .15s ease, background .15s ease;
}
body[data-theme="dark"] .close-btn{ background: rgba(255,255,255,0.04); }
.close-btn:hover{ transform: translateY(-1px); }

.menu-list{
  padding: 10px 10px 14px;
  display:flex;
  flex-direction:column;
  gap: 8px;
  overflow:auto;
}

/* Menu item */
.menu-item{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  text-decoration:none;
  color: var(--sidebarText);
  font-weight: 900;
  cursor:pointer;
  user-select:none;
  transition: transform .14s ease, background .14s ease, border-color .14s ease;
}
.menu-item i{
  width: 22px;
  text-align:center;
  opacity: .95;
}

.menu-item:hover{
  transform: translateY(-1px);
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
}
body[data-theme="dark"] .menu-item:hover{
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.10);
}

.menu-item.active{
  border-color: rgba(241,196,15,0.35);
  background: linear-gradient(135deg, rgba(241,196,15,0.14), rgba(37,99,235,0.08));
  box-shadow: 0 10px 22px rgba(0,0,0,0.08);
}
body[data-theme="dark"] .menu-item.active{
  border-color: rgba(110,231,255,0.22);
  background: linear-gradient(135deg, rgba(110,231,255,0.10), rgba(167,139,250,0.08));
}

/* ----- Content Area (iframe host) ----- */
.content-area{
  padding-top: 10px;
  min-height: calc(100dvh - var(--header-total));
}

/* Legacy iframe rules kept for reference */
.tab-frame{
  width: 100%;
  height: calc(100dvh - var(--header-total));
  border: none;
  display: none;
  background: transparent;
}
.tab-frame.active{
  display: block;
}

/* PHP rebuild layout */
.content-area{padding-top:12px;min-height:calc(100dvh - var(--header-total))}
.content-area > div{max-width:1100px;margin:0 auto;padding:10px}
.profile-row{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.profile-img{width:180px;max-width:42vw;aspect-ratio:1/1;object-fit:cover;border-radius:18px;box-shadow:var(--shadow);border:1px solid var(--border)}
.inner{background:var(--surface);border:1px solid var(--border);border-radius:18px;box-shadow:var(--shadow);padding:14px}
.block,.wishes{background:var(--surface);border:1px solid var(--border);border-radius:18px;box-shadow:var(--shadow-soft);padding:14px;margin-top:12px}
.subtitle{color:var(--muted);font-weight:700}
@media (max-width: 768px){
  .header{padding:10px 10px}
  .logo h1{font-size:15px;max-width:42vw}
  .content-area > div{padding:4px}
  .profile-row{align-items:flex-start;gap:14px}
  .profile-img{width:110px;max-width:32vw;border-radius:16px}
  .inner{padding:12px}
  .block,.wishes{padding:12px;margin-top:10px}
}
@media (max-width: 480px){
  .menu-icon,.theme-toggle{width:40px;height:40px}
  .logo-badge{width:40px;height:40px;font-size:13px}
  .logo h1{font-size:13px;max-width:34vw;line-height:1.15}
  .header .left{gap:8px}
  .actions{gap:8px}
  .mobile-sidebar{width:min(86vw,320px)}
  .profile-img{width:92px;max-width:28vw}
  .content-area > div{padding:2px}
  .inner{padding:8px; border-radius:12px}
  .block,.wishes{padding:8px;margin-top:8px; border-radius:12px}
}
/* reduce motion */
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}

/* ---- FIX: match existing JS class names (.active) ---- */
.overlay.active{
  opacity: 1;
  pointer-events: auto;
}

.mobile-sidebar.active{
  transform: translateX(0);
}

/* JS uses .active -> make it work */
.mobile-sidebar.active { transform: translateX(0); }
.overlay.active { opacity: 1; pointer-events: auto; }
.overlay{
  pointer-events: none;
}
.overlay.active{
  pointer-events: auto;
}
