/* ==========================================================================
   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; }
