/* ==========================================================================
   Yatoon App Shell (v3.5.0)
   Replaces the default WordPress admin chrome with a dedicated left
   navigation rail + top bar on Yatoon plugin screens only, to bring the
   "independent SaaS app" feel to parity with products like LatePoint.
   Scope: only screens with body class .yatoon-app-shell-on
   ========================================================================== */

:root{
  --yapp-sidebar-w: 240px;
  --yapp-topbar-h: 56px;
  --yapp-ink: #111827;
  --yapp-ink-soft: #4b5563;
  --yapp-muted: #8a93a6;
  --yapp-border: #e7e9ee;
  --yapp-surface: #ffffff;
  --yapp-surface-2: #f7f8fa;
  --yapp-active-bg: #111827;
  --yapp-active-text: #ffffff;
  --yapp-accent: #ec4899;
  --yapp-radius: 10px;
  --yapp-shadow: 0 8px 24px rgba(15,23,42,.06);
}

/* Hide native WP admin menu + top toolbar + footer only on Yatoon screens */
body.yatoon-app-shell-on #adminmenumain,
body.yatoon-app-shell-on #adminmenuwrap,
body.yatoon-app-shell-on #adminmenuback,
body.yatoon-app-shell-on #wpadminbar,
body.yatoon-app-shell-on #wpfooter,
body.yatoon-app-shell-on #screen-meta-links,
body.yatoon-app-shell-on #screen-meta,
body.yatoon-app-shell-on .update-nag,
body.yatoon-app-shell-on .notice:not(.yatoon-keep-notice) { display: none !important; }

/* WP core adds this to make room for #wpadminbar - reclaim it since we hide the bar */
/* Loaded only on Yatoon admin screens. html is the ancestor of body, so the
   previous `body ... html` selector could never match. */
html.wp-toolbar { padding-top: 0 !important; }

body.yatoon-app-shell-on #wpcontent{
  margin-left: var(--yapp-sidebar-w) !important;
  padding: 0 !important;
  max-width: none !important;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}
body.yatoon-app-shell-on #wpbody,
body.yatoon-app-shell-on #wpbody-content{
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-left: 0 !important;
  box-sizing: border-box;
}
body.yatoon-app-shell-on #wpbody-content{
  padding-top: var(--yapp-topbar-h) !important;
  background: var(--yapp-surface-2);
  overflow-x: hidden;
}
body.yatoon-app-shell-on #wpbody-content{ padding-bottom: 40px; }
body.yatoon-app-shell-on .wrap{
  margin-top: 16px;
  margin-right: 22px;
  margin-left: 28px !important;
  max-width: calc(100% - 50px);
  min-width: 0;
  box-sizing: border-box;
}
body.yatoon-app-shell-on .sbs-card,
body.yatoon-app-shell-on .yatoon-card{
  max-width: 100%;
  box-sizing: border-box;
}
body.yatoon-app-shell-on .sbs-card > div[style*="grid-template-columns:repeat(3,1fr)"]{
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
}
@media screen and (max-width: 782px){
  body.yatoon-app-shell-on #wpcontent,
  body.yatoon-app-shell-on #wpbody-content{
    margin-left: 0 !important;
    max-width: 100vw;
  }
  body.yatoon-app-shell-on .wrap{ margin-left: 12px !important; margin-right: 12px; max-width: calc(100% - 24px); }
  body.yatoon-app-shell-on .yatoon-app-sidebar{ transform: translateX(-100%); }
  body.yatoon-app-shell-on .yatoon-app-sidebar.is-open{ transform: translateX(0); }
}

/* ---------------- Sidebar ---------------- */
.yatoon-app-sidebar{
  position: fixed;
  top: 0; /* WP admin bar is hidden on Yatoon screens, no offset needed */
  left: 0;
  bottom: 0;
  width: var(--yapp-sidebar-w);
  background: var(--yapp-surface);
  border-right: 1px solid var(--yapp-border);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: transform .2s ease;
}

.yatoon-app-brand{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--yapp-border);
  font-weight: 800;
  font-size: 15px;
  color: var(--yapp-ink);
}
.yatoon-app-brand .dot{
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--yapp-accent); flex-shrink: 0;
}

.yatoon-app-nav{ flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.yatoon-app-nav-group{ margin-top: 14px; }
.yatoon-app-nav-group:first-child{ margin-top: 4px; }
.yatoon-app-nav-label{
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin: 0; border: 0; background: transparent; cursor: pointer;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--yapp-muted);
  padding: 6px 10px 4px;
}
.yatoon-app-nav-label:hover{ color: var(--yapp-ink); }
.yatoon-app-nav-label .dashicons{
  width: 14px; height: 14px; font-size: 14px;
  transition: transform .18s ease;
}
.yatoon-app-nav-group.is-collapsed > a{ display: none; }
.yatoon-app-nav-group.is-collapsed > .yatoon-app-nav-label .dashicons{ transform: rotate(180deg); }
.yatoon-app-nav a{
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--yapp-radius);
  color: var(--yapp-ink-soft); text-decoration: none;
  font-size: 13.5px; font-weight: 600;
  margin-bottom: 2px;
}
.yatoon-app-nav a .dashicons{ font-size: 17px; width: 17px; height: 17px; opacity: .75; }
body.yatoon-app-shell-on .yatoon-app-nav a:not(.is-active):hover,
body.yatoon-app-shell-on .yatoon-app-nav a:not(.is-active):focus-visible{ background: rgba(255,255,255,.10); color: #fff !important; }
body.yatoon-app-shell-on .yatoon-app-nav a.is-active,
body.yatoon-app-shell-on .yatoon-app-nav a.is-active:hover{ color: var(--yapp-active-text) !important; }
.yatoon-app-nav a.is-active .dashicons{ opacity: 1; }
.yatoon-app-nav a.is-locked{ opacity: .55; }
.yatoon-app-nav a .lock-badge{
  margin-left: auto; font-size: 9px; font-weight: 800; letter-spacing: .04em;
  background: #fde68a; color: #92400e; padding: 1px 6px; border-radius: 999px;
}
.yatoon-app-nav-hidden{ display: none; }

.yatoon-app-sidebar-footer{
  padding: 12px 16px; border-top: 1px solid var(--yapp-border);
  font-size: 11.5px; color: var(--yapp-muted);
}

/* ---------------- Topbar ---------------- */
.yatoon-app-topbar{
  position: fixed;
  top: 0; left: var(--yapp-sidebar-w); right: 0;
  height: var(--yapp-topbar-h);
  background: var(--yapp-surface);
  border-bottom: 1px solid var(--yapp-border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  z-index: 9985;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media screen and (max-width: 782px){
  .yatoon-app-topbar{ left: 0; top: 0; }
}

.yatoon-app-menu-toggle{
  display: none;
  border: 1px solid var(--yapp-border); background: var(--yapp-surface);
  border-radius: 8px; width: 32px; height: 32px; align-items: center; justify-content: center;
  cursor: pointer;
}
@media screen and (max-width: 782px){ .yatoon-app-menu-toggle{ display: inline-flex; } }

.yatoon-app-search{
  position: relative; flex: 1; max-width: 360px;
}
.yatoon-app-search input{
  width: 100%; height: 34px; border-radius: 999px;
  border: 1px solid var(--yapp-border); background: var(--yapp-surface-2);
  padding: 0 14px 0 32px; font-size: 13px; box-shadow: none;
}
.yatoon-app-search input:focus{ background: #fff; border-color: var(--yapp-accent); }
.yatoon-app-search > .dashicons{
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--yapp-muted); font-size: 16px; width: 16px; height: 16px;
}
.yatoon-app-search-results{
  position: absolute; top: 40px; left: 0; right: 0;
  background: #fff; border: 1px solid var(--yapp-border); border-radius: var(--yapp-radius);
  box-shadow: var(--yapp-shadow); max-height: 320px; overflow-y: auto;
  display: none; z-index: 9999;
}
.yatoon-app-search-results.is-open{ display: block; }
.yatoon-app-search-results a{
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; font-size: 13px; color: var(--yapp-ink-soft); text-decoration: none;
}
.yatoon-app-search-results a:hover{ background: var(--yapp-surface-2); }
.yatoon-app-search-empty{ padding: 14px 12px; font-size: 12.5px; color: var(--yapp-muted); }

.yatoon-app-topbar-spacer{ flex: 1; }

.yatoon-app-quick-create{
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--yapp-ink); color: #fff !important; text-decoration: none;
  border-radius: 999px; padding: 0 16px; height: 34px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.yatoon-app-quick-create:hover{ background: #000; color: #fff; }
.yatoon-app-quick-create .dashicons{ font-size: 16px; width: 16px; height: 16px; }

.yatoon-app-topbar-icon{
  width: 34px; height: 34px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--yapp-ink-soft); text-decoration: none; position: relative;
  border: 1px solid transparent;
}
.yatoon-app-topbar-icon:hover{ background: var(--yapp-surface-2); color: var(--yapp-ink); }
.yatoon-app-topbar-icon .dashicons{ font-size: 18px; width: 18px; height: 18px; }

/* 4.3.1 final QA: use wide admin screens without letting panels sprawl. */
@media screen and (min-width: 1440px){
  body.yatoon-app-shell-on .wrap{
    width: min(calc(100vw - var(--yapp-sidebar-w) - 56px), 1520px);
    max-width: none;
    margin-right: auto;
  }

  body.yatoon-app-shell-on #yatoon-dashboard-wrap,
  body.yatoon-app-shell-on .yatoon-setup-wizard-page,
  body.yatoon-app-shell-on .sbs-admin-container{
    max-width: 1520px;
  }

  body.yatoon-app-shell-on .sbs-card,
  body.yatoon-app-shell-on .yatoon-card,
  body.yatoon-app-shell-on .yatoon-settings-card,
  body.yatoon-app-shell-on .yatoon-settings-panel{
    max-width: 100%;
  }
}
@media screen and (max-width: 782px){
  body.yatoon-app-shell-on #wpcontent,
  body.yatoon-app-shell-on #wpbody-content{
    margin-left: 0 !important;
    max-width: 100vw;
  }
  body.yatoon-app-shell-on .wrap{ margin-left: 12px !important; margin-right: 12px; max-width: calc(100% - 24px); }
  body.yatoon-app-shell-on .yatoon-app-sidebar{ transform: translateX(-100%); }
  body.yatoon-app-shell-on .yatoon-app-sidebar.is-open{ transform: translateX(0); }
}

/* ---------------- Sidebar ---------------- */
.yatoon-app-sidebar{
  position: fixed;
  top: 0; /* WP admin bar is hidden on Yatoon screens, no offset needed */
  left: 0;
  bottom: 0;
  width: var(--yapp-sidebar-w);
  background: var(--yapp-surface);
  border-right: 1px solid var(--yapp-border);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: transform .2s ease;
}

.yatoon-app-brand{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--yapp-border);
  font-weight: 800;
  font-size: 15px;
  color: var(--yapp-ink);
}
.yatoon-app-brand .dot{
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--yapp-accent); flex-shrink: 0;
}

.yatoon-app-nav{ flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.yatoon-app-nav-group{ margin-top: 14px; }
.yatoon-app-nav-group:first-child{ margin-top: 4px; }
.yatoon-app-nav-label{
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin: 0; border: 0; background: transparent; cursor: pointer;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--yapp-muted);
  padding: 6px 10px 4px;
}
.yatoon-app-nav-label:hover{ color: var(--yapp-ink); }
.yatoon-app-nav-label .dashicons{
  width: 14px; height: 14px; font-size: 14px;
  transition: transform .18s ease;
}
.yatoon-app-nav-group.is-collapsed > a{ display: none; }
.yatoon-app-nav-group.is-collapsed > .yatoon-app-nav-label .dashicons{ transform: rotate(180deg); }
.yatoon-app-nav a{
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--yapp-radius);
  color: var(--yapp-ink-soft); text-decoration: none;
  font-size: 13.5px; font-weight: 600;
  margin-bottom: 2px;
}
.yatoon-app-nav a .dashicons{ font-size: 17px; width: 17px; height: 17px; opacity: .75; }
body.yatoon-app-shell-on .yatoon-app-nav a:not(.is-active):hover,
body.yatoon-app-shell-on .yatoon-app-nav a:not(.is-active):focus-visible{ background: rgba(255,255,255,.10); color: #fff !important; }
body.yatoon-app-shell-on .yatoon-app-nav a.is-active,
body.yatoon-app-shell-on .yatoon-app-nav a.is-active:hover{ color: var(--yapp-active-text) !important; }
.yatoon-app-nav a.is-active .dashicons{ opacity: 1; }
.yatoon-app-nav a.is-locked{ opacity: .55; }
.yatoon-app-nav a .lock-badge{
  margin-left: auto; font-size: 9px; font-weight: 800; letter-spacing: .04em;
  background: #fde68a; color: #92400e; padding: 1px 6px; border-radius: 999px;
}
.yatoon-app-nav-hidden{ display: none; }

.yatoon-app-sidebar-footer{
  padding: 12px 16px; border-top: 1px solid var(--yapp-border);
  font-size: 11.5px; color: var(--yapp-muted);
}

/* ---------------- Topbar ---------------- */
.yatoon-app-topbar{
  position: fixed;
  top: 0; left: var(--yapp-sidebar-w); right: 0;
  height: var(--yapp-topbar-h);
  background: var(--yapp-surface);
  border-bottom: 1px solid var(--yapp-border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  z-index: 9985;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media screen and (max-width: 782px){
  .yatoon-app-topbar{ left: 0; top: 0; }
}

.yatoon-app-menu-toggle{
  display: none;
  border: 1px solid var(--yapp-border); background: var(--yapp-surface);
  border-radius: 8px; width: 32px; height: 32px; align-items: center; justify-content: center;
  cursor: pointer;
}
@media screen and (max-width: 782px){ .yatoon-app-menu-toggle{ display: inline-flex; } }

.yatoon-app-search{
  position: relative; flex: 1; max-width: 360px;
}
.yatoon-app-search input{
  width: 100%; height: 34px; border-radius: 999px;
  border: 1px solid var(--yapp-border); background: var(--yapp-surface-2);
  padding: 0 14px 0 32px; font-size: 13px; box-shadow: none;
}
.yatoon-app-search input:focus{ background: #fff; border-color: var(--yapp-accent); }
.yatoon-app-search > .dashicons{
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--yapp-muted); font-size: 16px; width: 16px; height: 16px;
}
.yatoon-app-search-results{
  position: absolute; top: 40px; left: 0; right: 0;
  background: #fff; border: 1px solid var(--yapp-border); border-radius: var(--yapp-radius);
  box-shadow: var(--yapp-shadow); max-height: 320px; overflow-y: auto;
  display: none; z-index: 9999;
}
.yatoon-app-search-results.is-open{ display: block; }
.yatoon-app-search-results a{
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; font-size: 13px; color: var(--yapp-ink-soft); text-decoration: none;
}
.yatoon-app-search-results a:hover{ background: var(--yapp-surface-2); }
.yatoon-app-search-results a .dashicons{
  position: static; flex: 0 0 16px; transform: none;
  color: var(--yapp-muted); font-size: 16px; width: 16px; height: 16px;
}
.yatoon-app-search-empty{ padding: 14px 12px; font-size: 12.5px; color: var(--yapp-muted); }

.yatoon-app-topbar-spacer{ flex: 1; }

.yatoon-app-quick-create{
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--yapp-ink); color: #fff !important; text-decoration: none;
  border-radius: 999px; padding: 0 16px; height: 34px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
}

/* 4.3.1 shell refinement: quieter chrome, stronger active state, better scanning. */
body.yatoon-app-shell-on {
  --yapp-sidebar-w: 252px;
  --yapp-border: #e5e9f0;
  --yapp-surface: #ffffff;
  --yapp-surface-2: #f6f7f9;
  --yapp-ink: #111827;
  --yapp-ink-soft: #475569;
  --yapp-muted: #8b95a7;
  --yapp-active-bg: #111827;
  --yapp-active-text: #ffffff;
  --yapp-radius: 12px;
  --yapp-shadow: 0 16px 44px rgba(15, 23, 42, .08);
}

body.yatoon-app-shell-on .yatoon-app-sidebar {
  background: linear-gradient(180deg, #fff 0, #fbfcfe 100%);
  box-shadow: 10px 0 28px rgba(15, 23, 42, .035);
}

body.yatoon-app-shell-on .yatoon-app-brand {
  min-height: 62px;
  padding: 18px 20px;
  font-size: 16px;
}

body.yatoon-app-shell-on .yatoon-app-brand .dot {
  width: 10px;
  height: 10px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--yapp-accent) 14%, transparent);
}

body.yatoon-app-shell-on .yatoon-app-nav {
  padding: 12px 12px 22px;
}

/* Keep section headings subordinate to menu items, but readable on the
   white navigation rail. #64748b meets AA contrast on white at this size. */
body.yatoon-app-shell-on .yatoon-app-nav-label {
  color: #64748b;
  font-weight: 750;
}

body.yatoon-app-shell-on .yatoon-app-nav-label:hover,
body.yatoon-app-shell-on .yatoon-app-nav-label:focus-visible {
  color: #334155;
}

body.yatoon-app-shell-on .yatoon-app-nav-label {
  padding: 9px 11px 5px;
  color: #475569;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .09em;
}

body.yatoon-app-shell-on .yatoon-app-nav-group.has-active > .yatoon-app-nav-label {
  color: #334155;
}

body.yatoon-app-shell-on .yatoon-app-nav a {
  min-height: 38px;
  margin-bottom: 3px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #475569;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}

body.yatoon-app-shell-on .yatoon-app-nav a:not(.is-active):hover,
body.yatoon-app-shell-on .yatoon-app-nav a:not(.is-active):focus-visible {
  background: #f4f6f9 !important;
  border-color: #e8edf4;
  color: #111827 !important;
  transform: translateX(1px);
}

body.yatoon-app-shell-on .yatoon-app-nav a.is-active {
  background: #111827 !important;
  border-color: #111827 !important;
  box-shadow: 0 10px 22px rgba(17, 24, 39, .16);
}

body.yatoon-app-shell-on .yatoon-app-nav a .dashicons {
  opacity: .82;
}

body.yatoon-app-shell-on .yatoon-app-topbar {
  height: 60px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .035);
}

body.yatoon-app-shell-on #wpbody-content {
  padding-top: 60px !important;
}

body.yatoon-app-shell-on .yatoon-app-search input {
  height: 38px;
  border-radius: 999px;
  background: #f6f7f9;
}

body.yatoon-app-shell-on .yatoon-app-topbar-icon,
body.yatoon-app-shell-on .yatoon-app-quick-create,
body.yatoon-app-shell-on .yatoon-app-menu-toggle {
  border-radius: 10px;
}

@media screen and (max-width: 782px) {
  body.yatoon-app-shell-on .yatoon-app-sidebar {
    box-shadow: 18px 0 45px rgba(15, 23, 42, .16);
  }
}
.yatoon-app-quick-create:hover{ background: #000; color: #fff; }
.yatoon-app-quick-create .dashicons{ font-size: 16px; width: 16px; height: 16px; }

.yatoon-app-topbar-icon{
  width: 34px; height: 34px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--yapp-ink-soft); text-decoration: none; position: relative;
  border: 1px solid transparent;
}
.yatoon-app-topbar-icon:hover{ background: var(--yapp-surface-2); color: var(--yapp-ink); }
.yatoon-app-topbar-icon .dashicons{ font-size: 18px; width: 18px; height: 18px; }
