/* =========================================================
   SAFRAOPS - LAYOUT PRINCIPAL
   Sidebar / Topbar / Navegação mobile
   ========================================================= */

:root {
  --sidebar-width: 248px;
  --topbar-height: 64px;
}


/* =========================================================
   APP SHELL
   ========================================================= */

.app-body {
  background: var(--bg);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-main {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.app-sidebar {
  position: sticky;
  top: 0;

  height: 100vh;
  display: flex;
  flex-direction: column;

  background:
    radial-gradient(
      circle at 25% 5%,
      rgba(124, 255, 77, 0.08),
      transparent 24%
    ),
    linear-gradient(
      180deg,
      #020604 0%,
      #06140d 55%,
      #081b11 100%
    );

  border-right: 1px solid rgba(124, 255, 77, 0.09);
  color: #fff;

  overflow-y: auto;
}


/* =========================================================
   MARCA NA SIDEBAR
   ========================================================= */

.sidebar-brand {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 11px;

  padding: 18px 20px;

  color: #fff;

  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand:hover {
  color: #fff;
  text-decoration: none;
}

.sidebar-brand-symbol {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
  border-radius: 13px;
}

.sidebar-brand-symbol img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: cover;
}

.sidebar-brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  color: #fff;
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
}

.sidebar-brand-name span {
  color: var(--brand-lime);
}

.sidebar-brand-tagline {
  margin-top: 5px;

  color: rgba(255, 255, 255, 0.43);

  font-size: 8px;
  font-weight: 500;

  white-space: nowrap;
}


/* =========================================================
   MENU
   ========================================================= */

.sidebar-navigation {
  flex: 1;
  padding: 22px 14px;
}

.sidebar-section {
  margin-bottom: 26px;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section-title {
  display: block;

  margin: 0 10px 8px;

  color: rgba(255, 255, 255, 0.28);

  font-size: 9px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.sidebar-menu {
  display: grid;
  gap: 3px;
}

.sidebar-link {
  position: relative;

  min-height: 43px;
  display: flex;
  align-items: center;

  padding: 9px 12px 9px 15px;

  border-radius: 9px;

  color: rgba(255, 255, 255, 0.67);

  font-size: 13px;
  font-weight: 550;

  transition:
    color 0.16s ease,
    background 0.16s ease;
}

.sidebar-link::before {
  content: "";

  width: 5px;
  height: 5px;

  flex: 0 0 5px;

  margin-right: 11px;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.2);

  transition:
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.045);
  text-decoration: none;
}

.sidebar-link:hover::before {
  background: rgba(124, 255, 77, 0.55);
}

.sidebar-link.active {
  color: var(--brand-lime);
  background: rgba(124, 255, 77, 0.085);
}

.sidebar-link.active::before {
  background: var(--brand-lime);

  box-shadow:
    0 0 0 4px rgba(124, 255, 77, 0.09);
}


/* =========================================================
   USUÁRIO NA SIDEBAR
   ========================================================= */

.sidebar-footer {
  padding: 14px;

  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
  padding: 11px 10px;
}

.sidebar-user-label {
  display: block;

  margin-bottom: 4px;

  color: rgba(255, 255, 255, 0.3);

  font-size: 8px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-user strong {
  display: block;

  overflow: hidden;

  color: #fff;

  font-size: 12px;
  font-weight: 600;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout-form {
  margin: 4px 0 0;
}

.sidebar-logout {
  width: 100%;
  min-height: 39px;

  display: flex;
  align-items: center;

  padding: 8px 10px;

  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;

  background: rgba(255, 255, 255, 0.035);

  color: rgba(255, 255, 255, 0.62);

  font: inherit;
  font-size: 12px;
  font-weight: 550;

  cursor: pointer;

  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.sidebar-logout:hover {
  color: #fff;

  border-color: rgba(124, 255, 77, 0.18);

  background: rgba(124, 255, 77, 0.07);
}


/* =========================================================
   TOPBAR
   ========================================================= */

.app-topbar {
  position: sticky;
  z-index: 30;
  top: 0;

  min-height: var(--topbar-height);

  display: flex;
  align-items: center;

  background: rgba(255, 255, 255, 0.93);

  border-bottom: 1px solid var(--line);

  backdrop-filter: blur(12px);
}

.app-topbar-inner {
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  padding: 0 30px;
}

.topbar-context {
  display: flex;
  flex-direction: column;

  line-height: 1.2;
}

.topbar-eyebrow {
  color: var(--brand-deep);

  font-size: 9px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.topbar-title {
  margin-top: 3px;

  color: var(--brand-dark);

  font-size: 14px;
  font-weight: 650;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;

  color: var(--muted);

  font-size: 11px;
  font-weight: 500;
}

.topbar-status::before {
  content: "";

  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: var(--brand-green);

  box-shadow:
    0 0 0 4px rgba(56, 176, 0, 0.08);
}


/* =========================================================
   CONTEÚDO
   ========================================================= */

.app-content {
  flex: 1;
}

.content-container {
  width: min(1240px, calc(100% - 60px));
  margin: 0 auto;

  padding-top: 31px;
  padding-bottom: 56px;
}


/* =========================================================
   HEADER DO LOGIN
   ========================================================= */

.auth-site-header {
  min-height: 62px;

  display: flex;
  align-items: center;

  color: #fff;

  background:
    linear-gradient(
      110deg,
      #020604 0%,
      #06130d 52%,
      #0b2115 100%
    );

  border-bottom: 1px solid rgba(124, 255, 77, 0.11);
}

.auth-header-inner {
  width: min(950px, calc(100% - 32px));
  margin: auto;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;

  color: #fff;
}

.auth-brand:hover {
  color: #fff;
  text-decoration: none;
}

.auth-brand img {
  width: 42px;
  height: 42px;

  object-fit: cover;

  border-radius: 11px;
}

.auth-brand-copy {
  display: flex;
  flex-direction: column;
}

.auth-brand-name {
  color: #fff;

  font-size: 19px;
  font-weight: 800;

  line-height: 1;

  letter-spacing: -0.045em;
}

.auth-brand-name span {
  color: var(--brand-lime);
}

.auth-brand-tagline {
  margin-top: 4px;

  color: rgba(255, 255, 255, 0.48);

  font-size: 8px;
}

.auth-container {
  padding-top: 26px;
}


/* =========================================================
   MENU MOBILE
   ========================================================= */

.mobile-app-menu {
  display: none;
}

.mobile-menu-summary {
  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  border: 1px solid var(--line);
  border-radius: 9px;

  background: #fff;

  color: var(--brand-dark);

  cursor: pointer;

  list-style: none;
}

.mobile-menu-summary::-webkit-details-marker {
  display: none;
}

.mobile-menu-summary::before {
  content: "☰";

  font-size: 20px;
  line-height: 1;
}

.mobile-app-menu[open] .mobile-menu-summary::before {
  content: "×";
}

.mobile-menu-panel {
  position: fixed;
  z-index: 200;

  top: var(--topbar-height);
  left: 0;
  bottom: 0;

  width: min(300px, 86vw);

  padding: 18px 14px;

  overflow-y: auto;

  background:
    linear-gradient(
      180deg,
      #020604 0%,
      #07190f 100%
    );

  box-shadow:
    18px 0 45px rgba(0, 0, 0, 0.22);
}

.mobile-menu-brand {
  display: flex;
  align-items: center;
  gap: 10px;

  margin-bottom: 23px;
  padding: 4px 8px 17px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.07);

  color: #fff;
}

.mobile-menu-brand img {
  width: 39px;
  height: 39px;

  object-fit: cover;
  border-radius: 10px;
}

.mobile-menu-brand strong {
  font-size: 17px;
}

.mobile-menu-brand strong span {
  color: var(--brand-lime);
}

.mobile-menu-panel .sidebar-section {
  margin-bottom: 20px;
}

.sidebar-primary-action,
.mobile-primary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  background: var(--brand-lime);
  color: var(--brand-dark);
  border-radius: 10px;
  font-weight: 750;
  text-decoration: none;
}

.sidebar-primary-action {
  margin: 0 16px 20px;
}

.sidebar-primary-action:hover,
.sidebar-primary-action.active,
.mobile-primary-action:hover {
  background: #fff;
  color: var(--brand-dark);
  text-decoration: none;
}

.mobile-primary-action {
  margin: 0 0 22px;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .sidebar-brand {
    padding-left: 16px;
    padding-right: 16px;
  }

  .sidebar-brand-tagline {
    display: none;
  }

  .content-container {
    width: min(100% - 40px, 1180px);
  }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    display: none;
  }

  .mobile-app-menu {
    display: block;
  }

  .app-topbar-inner {
    padding: 0 18px;
  }

  .topbar-context {
    margin-right: auto;
  }

  .content-container {
    width: min(100% - 28px, 1180px);

    padding-top: 23px;
    padding-bottom: 42px;
  }
}


/* =========================================================
   CELULAR
   ========================================================= */

@media (max-width: 480px) {
  .app-topbar-inner {
    padding: 0 12px;
  }

  .topbar-eyebrow {
    display: none;
  }

  .topbar-title {
    margin: 0;
  }

  .topbar-status {
    display: none;
  }

  .content-container {
    width: min(100% - 20px, 1180px);
  }

  .auth-header-inner {
    width: min(100% - 22px, 950px);
  }

  .auth-container {
    width: min(100% - 20px, 1180px);
  }
}


/* =========================================================
   APP AUTENTICADO - NAVEGAÇÃO MOBILE
   ========================================================= */

@media (max-width: 820px) {
  .app-body {
    overflow-x: hidden;
  }

  .app-shell,
  .app-main,
  .app-content {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .app-shell {
    display: block;
    grid-template-columns: none;
  }

  .app-sidebar {
    display: none !important;
    width: 0;
  }

  .app-topbar {
    min-height: 60px;
    height: 60px;
  }

  .app-topbar-inner {
    min-width: 0;
    gap: 12px;
    padding: 0 16px;
  }

  .mobile-app-menu {
    position: relative;
    display: block;
    flex: 0 0 42px;
  }

  .mobile-menu-summary {
    position: relative;
    z-index: 230;
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .mobile-app-menu[open]::before {
    content: "";
    position: fixed;
    z-index: 190;
    inset: 0;
    background: rgba(2, 6, 4, 0.58);
    backdrop-filter: blur(2px);
  }

  .mobile-app-menu[open] .mobile-menu-summary {
    position: fixed;
    top: 11px;
    left: min(calc(86vw - 53px), 267px);
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }

  .mobile-app-menu[open] .mobile-menu-summary::before {
    font-size: 24px;
    font-weight: 400;
  }

  .mobile-menu-panel {
    z-index: 200;
    top: 0;
    bottom: 0;
    width: min(320px, 86vw);
    height: 100vh;
    height: 100dvh;
    padding: 14px 14px 20px;
    overscroll-behavior: contain;
  }

  .mobile-menu-brand {
    min-height: 44px;
    margin: 0 48px 18px 0;
    padding: 0 4px 13px;
  }

  .mobile-menu-brand img {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .mobile-primary-action {
    min-height: 44px;
    margin-bottom: 18px;
  }

  .mobile-menu-panel .sidebar-section {
    margin-bottom: 16px;
  }

  .mobile-menu-panel .sidebar-link {
    min-height: 42px;
  }

  .mobile-menu-user {
    margin-top: 18px;
    padding: 14px 10px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }

  .mobile-menu-panel .sidebar-logout-form {
    margin-top: 4px;
  }

  .topbar-context {
    min-width: 0;
    margin-right: auto;
  }

  .topbar-eyebrow {
    display: block;
    color: var(--brand-dark);
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.035em;
    text-transform: none;
  }

  .topbar-title,
  .topbar-status {
    display: none;
  }

  .content-container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 18px 42px;
    overflow-x: hidden;
  }
}


@media (max-width: 480px) {
  .app-topbar-inner {
    padding: 0 14px;
  }

  .content-container {
    padding-right: 16px;
    padding-left: 16px;
  }
}
