﻿/**
 * Brother Hood — shared fluid glass shell (top dash header + bottom dock).
 * Include after page <style>; add class "koyan-app-shell" to <body>.
 * JS: document.body.classList.add('dock-ready') when DOM is ready for dock entrance.
 */
:root {
  --dock-h: 92px;
  --dock-float-gap: 0px;
  --glass-blur: 18px;
  --glass-sat: 1.35;
}

body.koyan-app-shell {
  min-height: 100vh;
  overflow-x: hidden;
  /* Reserve space for the status bar (top) and the system navigation bar
     (bottom) so content is never hidden behind them. The bottom also clears
     the floating dock. */
  padding-top: env(safe-area-inset-top, 0px) !important;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--dock-h, 92px)) !important;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-body, #d8e2ec);
  background-image: var(--bg-image, radial-gradient(1200px 640px at 8% -8%, rgba(34, 197, 94, 0.22), transparent 58%), radial-gradient(880px 520px at 102% 18%, rgba(20, 83, 45, 0.14), transparent 52%), radial-gradient(720px 420px at 48% 108%, rgba(148, 163, 184, 0.18), transparent 48%), linear-gradient(168deg, #e2e8f0 0%, #e0f2fe 38%, #ecfdf5 100%));
  background-attachment: fixed;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
  margin-bottom: 22px;
  min-height: 52px;
  padding: 12px 18px;
  border-radius: 22px;
  background: var(--bg-sidebar, rgba(255, 255, 255, 0.5));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.62));
  box-shadow:
    0 10px 36px rgba(15, 23, 42, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .dash-header {
    background: var(--bg-sidebar, rgba(255, 255, 255, 0.92));
  }
}

.dash-logo {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary, #5b8cff);
  flex-shrink: 0;
  white-space: nowrap;
}

.dash-user-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  background: var(--bg-input, rgba(255, 255, 255, 0.55));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.55));
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  min-width: 0;
  flex-shrink: 1;
  max-width: 100%;
}

.dash-user-pill .mini-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.dash-user-pill .mini-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dash-user-pill span {
  font-weight: 700;
  font-size: 0.95rem;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main, #1e293b);
}

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.noti-btn {
  position: relative;
  font-size: 1.25rem;
  color: var(--text-main, #1e293b);
  cursor: pointer;
  transition: 0.2s;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--bg-input, rgba(248, 250, 252, 0.72));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.55));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  text-decoration: none;
}

.noti-btn:hover {
  color: var(--text-main);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.2);
}

.noti-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 2px solid var(--bg-card);
}

/* Footer dock — Liquid Glass Center */
.dock-nav {
  position: fixed;
  z-index: 950;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 10px));
  transform: translateX(-50%) translateY(100%);
  width: auto;
  max-width: calc(100% - 32px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: 28px;
  background: rgba(12, 20, 36, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  backdrop-filter: blur(28px) saturate(1.8);
  isolation: isolate;
  opacity: 0;
  will-change: transform, opacity;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.55s ease;
}

.dock-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    125deg,
    transparent 30%,
    rgba(255, 255, 255, 0.07) 42%,
    rgba(91, 140, 255, 0.1) 48%,
    rgba(56, 232, 255, 0.08) 54%,
    transparent 66%
  );
  background-size: 250% 100%;
  animation: koyanLiquidSheen 12s ease-in-out infinite;
}

@keyframes koyanLiquidSheen {
  0%,
  100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .dock-nav { background: rgba(12, 20, 36, 0.92); }
}

body.dock-ready .dock-nav {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dock-nav::-webkit-scrollbar { display: none; }

.dock-nav a {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: clamp(40px, 12vw, 64px);
  height: clamp(40px, 12vw, 64px);
  padding: 4px;
  border-radius: 18px;
  text-decoration: none;
  color: rgba(226, 232, 240, 0.65);
  font-size: clamp(0.45rem, 1.8vw, 0.6rem);
  font-weight: 700;
  gap: 2px;
  transition: background 0.22s, color 0.22s, box-shadow 0.22s, transform 0.22s;
}

.dock-nav a i {
  font-size: clamp(0.9rem, 4vw, 1.3rem);
  transition: transform 0.22s;
}

.dock-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
}

.dock-nav a:active i {
  transform: scale(0.88);
}

.dock-nav a.active {
  color: #fff;
  background: linear-gradient(145deg, rgba(91, 140, 255, 0.75), rgba(30, 58, 138, 0.55));
  box-shadow: 0 4px 14px rgba(91, 140, 255, 0.32);
}

.dock-nav a.active i {
  transform: scale(1.1);
}

.dock-nav a.active::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #38e8ff;
  margin-top: 1px;
}

.org-footer {
  margin-top: auto;
  margin-bottom: 8px;
  padding: 22px 20px 26px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  border-radius: 20px;
  background: var(--bg-card, rgba(255, 255, 255, 0.48));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.58));
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  backdrop-filter: blur(14px) saturate(1.25);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .org-footer {
    background: var(--bg-card, rgba(255, 255, 255, 0.94));
  }
}

.org-footer a {
  color: var(--primary, #5b8cff);
  text-decoration: none;
  font-weight: 600;
}

.org-footer a:hover {
  text-decoration: underline;
}

@media screen and (max-width: 991px) {
  .dash-header {
    margin-bottom: 16px;
  }
}

@media screen and (max-width: 640px) {
  .dash-header {
    gap: 10px;
    padding: 10px 14px;
  }
  .dash-logo {
    font-size: 0.92rem;
  }
  .dash-user-pill {
    padding: 6px 9px 6px 6px;
    gap: 8px;
  }
  .dash-user-pill .mini-av {
    width: 34px;
    height: 34px;
    font-size: 0.82rem;
  }
  .dash-user-pill span {
    max-width: 100px;
    font-size: 0.88rem;
  }
  .dash-header-actions {
    gap: 6px;
  }
  .noti-btn {
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
    border-radius: 11px;
  }
}

@media screen and (max-width: 420px) {
  .dash-header {
    gap: 6px;
    padding: 8px 10px;
  }
  .dash-logo {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
  }
  .dash-user-pill {
    padding: 4px 6px 4px 4px;
    gap: 5px;
    max-width: none;
    flex-shrink: 0;
  }
  .dash-user-pill .mini-av {
    width: 28px;
    height: 28px;
    font-size: 0.74rem;
  }
  .dash-user-pill span {
    max-width: 70px;
    font-size: 0.76rem;
  }
  .dash-header-actions {
    gap: 4px;
    flex-shrink: 0;
  }
  .noti-btn {
    width: 30px;
    height: 30px;
    font-size: 0.82rem;
    border-radius: 9px;
  }
}

@media screen and (max-width: 360px) {
  .dash-header {
    justify-content: flex-start;
  }
  .dash-logo {
    font-size: 0.72rem;
  }
  .dash-user-pill {
    margin-left: auto;
    max-width: 70%;
  }
  .dash-user-pill span {
    display: none;
  }
  .dash-header-actions {
    gap: 4px;
  }
  .noti-btn {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dock-nav {
    opacity: 1;
    transform: none;
  }
  body.dock-ready .dock-nav {
    animation: none;
  }
  .dock-nav::before {
    animation: none;
    opacity: 0.55;
  }
}

/* ── Upload Progress Overlay ─────────────── */
#uploadProgressWrap {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;
  display: none; background: rgba(0,0,0,0.55);
}
#uploadProgressWrap.show { display: block; }
#uploadProgressWrap .box {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.12); border-radius: 20px;
  padding: 30px 40px; display: flex; flex-direction: column;
  align-items: center; gap: 12px; backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
}
#uploadProgressWrap .circle-wrap {
  width: 80px; height: 80px; position: relative;
}
#uploadProgressWrap .circle-wrap svg {
  transform: rotate(-90deg); width: 100%; height: 100%;
}
#uploadProgressWrap .circle-wrap .bg {
  fill: none; stroke: rgba(255,255,255,0.15); stroke-width: 5;
}
#uploadProgressWrap .circle-wrap .fg {
  fill: none; stroke: #a78bfa; stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 219.9; stroke-dashoffset: 219.9;
  transition: stroke-dashoffset 0.3s ease;
}
#uploadProgressWrap .circle-wrap .pct {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: #fff;
}
#uploadProgressWrap .label {
  font-size: 0.75rem; color: rgba(255,255,255,0.7); font-weight: 600;
  text-align: center;
}

