/* App shell layout — reliable CSS (not dependent on Tailwind responsive translate) */

.app-body {
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(46, 184, 160, 0.1), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(230, 162, 60, 0.07), transparent 50%),
    #0b1014;
  color: #e7eef3;
}

.app-shell {
  display: grid;
  grid-template-columns: 16.5rem 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 4.75rem 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0.9rem 0.75rem;
  background: linear-gradient(180deg, #141b22 0%, #0e1419 100%);
  border-right: 1px solid #2f3b46;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  padding: 0 0.25rem;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
  color: #e7eef3;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border-radius: 0.75rem;
  background: linear-gradient(145deg, #57d4bf, #1f9a84);
  color: #041510;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-text {
  display: grid;
  min-width: 0;
  gap: 0.1rem;
}

.brand-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text small {
  color: #8fa3b3;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-nav {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 0.25rem;
  overflow: auto;
}

.nav-section {
  margin: 0.9rem 0.5rem 0.3rem;
  color: #8fa3b3;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 0.75rem;
  color: #e7eef3;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: rgba(46, 184, 160, 0.1);
  color: #e7eef3;
}

.nav-link.active,
.nav-link.nav-link-active {
  background: rgba(46, 184, 160, 0.16);
  color: #b8f3e7;
}

.nav-ico {
  width: 1.25rem;
  flex: 0 0 auto;
  text-align: center;
  opacity: 0.9;
}

.sidebar-foot {
  display: grid;
  gap: 0.65rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #2f3b46;
}

.user-chip {
  display: grid;
  gap: 0.15rem;
  padding: 0 0.25rem;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.user-role {
  color: #e6a23c;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-col {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid rgba(47, 59, 70, 0.85);
  background: rgba(11, 16, 20, 0.82);
  backdrop-filter: blur(10px);
}

.topbar-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid #2f3b46;
  border-radius: 0.6rem;
  background: #1a232c;
  color: #e7eef3;
  cursor: pointer;
  font: inherit;
}

.mobile-menu {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.wrap {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1.35rem 1.15rem 2.5rem;
}

/* collapsed desktop sidebar */
.app-shell.sidebar-collapsed .sidebar {
  width: auto;
}

.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-section,
.app-shell.sidebar-collapsed .user-chip,
.app-shell.sidebar-collapsed .sidebar-foot .btn-ghost {
  display: none;
}

.app-shell.sidebar-collapsed .nav-link {
  justify-content: center;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

.app-shell.sidebar-collapsed .collapse-chevron {
  display: inline-block;
  transform: rotate(180deg);
}

/* mobile drawer */
@media (max-width: 1023px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    display: block;
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.55);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .sidebar-collapse {
    display: none;
  }

  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .nav-section,
  .app-shell.sidebar-collapsed .user-chip,
  .app-shell.sidebar-collapsed .sidebar-foot .btn-ghost {
    display: initial;
  }

  .app-shell.sidebar-collapsed .user-chip {
    display: grid;
  }

  .app-shell.sidebar-collapsed .sidebar-foot .btn-ghost {
    display: inline-flex;
    width: 100%;
  }

  .app-shell.sidebar-collapsed .nav-link {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .animate-ken,
  .animate-fadeUp,
  .animate-fadeUpDelay,
  .animate-pulseSoft,
  .sidebar {
    animation: none !important;
    transition: none !important;
  }
}

.clip {
  max-width: 26rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-shot {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border: 1px solid #2f3b46;
  border-radius: 12px;
  cursor: crosshair;
  background: #000;
}

/* VMOS / ArmCloud live view — keep stream filling the phone frame */
.live-phone-wrap {
  width: min(100%, 420px);
  margin-inline: auto;
}

.phone-box {
  position: relative;
  width: 100%;
  /* Tall modern phones (~20:9); updated at runtime from stream size */
  aspect-ratio: 9 / 20;
  height: auto;
  max-height: min(72vh, 820px);
  overflow: hidden;
  background: #000;
  border-radius: 12px 12px 0 0;
  text-align: center;
}

.phone-box > *,
.phone-box video,
.phone-box canvas,
.phone-box iframe {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  box-sizing: border-box;
}

.phone-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  gap: 0.25rem;
  min-height: 52px;
  padding: 0.35rem 0.75rem 0.55rem;
  background: #eceff1;
  border-radius: 0 0 12px 12px;
  border: 1px solid #2f3b46;
  border-top: 0;
}

.phone-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #263238;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.phone-nav-btn:hover:not(:disabled) {
  background: rgba(38, 50, 56, 0.08);
}

.phone-nav-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.phone-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.phone-nav-ico {
  display: block;
  font-size: 1.05rem;
  line-height: 1;
  color: #37474f;
}

.phone-nav-ico-home {
  width: 16px;
  height: 16px;
  border: 2px solid #37474f;
  border-radius: 50%;
  box-sizing: border-box;
}

.phone-nav-ico-recent {
  width: 14px;
  height: 14px;
  border: 2px solid #37474f;
  border-radius: 2px;
  box-sizing: border-box;
}
