/* Shared dark app shell: sidebar + main content, used by pages that keep
   base.html's default nav (Home, Task Monitor, Price Scheduler, account
   pages). Campaigns/Products intentionally opt out via their own
   {% block body %} override and are untouched by this file. */

.app-shell {
  display: flex;
  min-height: 100vh;
  font-family: 'DM Sans', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  position: relative;
}

.app-shell::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 20% 50%, rgba(22, 199, 154, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(245, 166, 35, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.app-brand {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-text);
  text-decoration: none;
  padding: 20px 20px 16px;
}

.app-sidebar {
  position: relative;
  z-index: 2;
  width: 240px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid rgba(var(--overlay-rgb), 0.06);
  display: flex;
  flex-direction: column;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  flex: 1;
}

.app-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-top: 1px solid rgba(var(--overlay-rgb), 0.06);
}

.app-nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.app-nav-link:hover {
  color: var(--color-text);
  background: rgba(var(--overlay-rgb), 0.04);
}

.app-nav-link.active {
  color: #16c79a;
  background: rgba(22, 199, 154, 0.1);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
  color: var(--color-text);
  background: rgba(var(--overlay-rgb), 0.04);
}

.theme-toggle-icon {
  flex-shrink: 0;
}

.theme-toggle-icon-sun {
  display: none;
}

:root[data-theme='light'] .theme-toggle-icon-sun {
  display: block;
}

:root[data-theme='light'] .theme-toggle-icon-moon {
  display: none;
}

.app-topbar {
  display: none;
}

.app-sidebar-backdrop {
  display: none;
}

.app-main {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  padding: 48px 24px;
}

@media (max-width: 768px) {
  .app-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--color-surface);
    border-bottom: 1px solid rgba(var(--overlay-rgb), 0.06);
    padding: 12px 16px;
  }

  .app-brand-mobile {
    padding: 0;
  }

  .app-sidebar-toggle {
    appearance: none;
    background: transparent;
    border: 1px solid rgba(var(--overlay-rgb), 0.1);
    border-radius: 8px;
    padding: 8px;
    line-height: 0;
    cursor: pointer;
  }

  .app-sidebar-toggle-icon,
  .app-sidebar-toggle-icon::before,
  .app-sidebar-toggle-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
  }

  .app-sidebar-toggle-icon::before {
    content: '';
    margin-bottom: 4px;
  }

  .app-sidebar-toggle-icon::after {
    content: '';
    margin-top: 4px;
  }

  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 4;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }

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

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

  .app-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 3;
    background: rgba(0, 0, 0, 0.5);
  }

  .app-main {
    padding: 24px 16px;
  }
}

.store-selector {
  position: relative;
  margin: 8px 12px;
}

.store-selector-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(var(--overlay-rgb), 0.04);
  border: 1px solid rgba(var(--overlay-rgb), 0.08);
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background-color 0.15s, border-color 0.15s;
}

.store-selector-trigger:hover {
  background: rgba(var(--overlay-rgb), 0.07);
  border-color: rgba(var(--overlay-rgb), 0.12);
}

.store-selector-trigger-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(135deg, #16c79a, #0ea37a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: #fff;
}

.store-selector-trigger-label {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-selector-trigger-arrow {
  flex-shrink: 0;
  font-size: 0.625rem;
  color: var(--color-text-dim);
  transition: transform 0.15s;
}

.store-selector-trigger-arrow.is-open {
  transform: rotate(180deg);
}

.store-selector-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid rgba(var(--overlay-rgb), 0.08);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
  padding: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.store-selector-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.15s, color 0.15s;
}

.store-selector-option:hover {
  background: rgba(var(--overlay-rgb), 0.04);
  color: var(--color-text);
}

.store-selector-option.is-active {
  color: #16c79a;
  background: rgba(22, 199, 154, 0.1);
}

.store-selector-option-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: linear-gradient(135deg, #16c79a, #0ea37a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5625rem;
  font-weight: 700;
  color: #fff;
}

.store-selector-option-check {
  margin-left: auto;
  color: #16c79a;
  font-size: 0.75rem;
}

.store-selector-dropdown::-webkit-scrollbar {
  width: 4px;
}

.store-selector-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.store-selector-dropdown::-webkit-scrollbar-thumb {
  background: rgba(var(--overlay-rgb), 0.1);
  border-radius: 2px;
}

.store-selector-no-stores {
  padding: 12px;
  text-align: center;
  color: var(--color-text-dim);
  font-size: 0.8125rem;
}
