/* Application Layout - Modern CSS 2025 */

/* Base Styles */
html {
  scroll-behavior: smooth;
}

body {
  background-color: #f9fafb;
}

/* App Layout Container */
.app-layout {
  display: flex;
  min-height: 100vh;
  @media (min-width: 1024px) {
    margin-left: 15rem;
  }
}

/* Hidden Checkbox for Mobile Menu */
.app-sidebar-toggle,
.backoffice-sidebar-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* Content Area */
.app-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
}

/* App Header */
.app-header {
  position: relative;
  z-index: 50;
  background-color: #ffffff;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid #e5e7eb;
}

.app-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3rem;
  padding: 0.5rem;

  @media (min-width: 1024px) {
    padding-inline: 1.5rem;
  }
}

.app-header-left {
  display: flex;
  align-items: center;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: block;
  padding: 0.5rem;
  margin-right: 0.5rem;
  color: #6b7280;
  cursor: pointer;
  transition: opacity 200ms;
}

.mobile-menu-toggle .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.mobile-menu-toggle:hover {
  opacity: 0.75;
}

@media (min-width: 1024px) {
  .mobile-menu-toggle {
    display: none;
  }
}

/* Page Title */
.app-page-title-wrapper {
  margin-left: 1rem;
}

@media (min-width: 1024px) {
  .app-page-title-wrapper {
    margin-left: 0;
  }
}

.app-page-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
}

/* Main Content */
.app-main {
  flex: 1;
  overflow-y: auto;
  min-inline-size: 0;
  padding: 1rem;
}

/* Mobile Overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background-color: rgba(0, 0, 0, 0.3);
}

.app-sidebar-toggle:checked ~ .mobile-overlay {
  display: block;
}

@media (min-width: 1024px) {
  .mobile-overlay {
    display: none !important;
  }
}

/* Backoffice Mobile Overlay (darker) */
.mobile-overlay-dark {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background-color: rgba(0, 0, 0, 0.5);
}

.backoffice-sidebar-toggle:checked ~ .mobile-overlay-dark {
  display: block;
}

@media (min-width: 1024px) {
  .mobile-overlay-dark {
    display: none !important;
  }
}

/* Impersonate Banner */
.impersonate-banner {
  background-color: #fef3c7;
  border-bottom: 1px solid #fbbf24;
  padding: 0.75rem 1rem;
  z-index: 100;
}

.impersonate-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  font-size: 0.875rem;
  color: #92400e;
}

.impersonate-banner-content .btn.sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

/* Sandbox Banner */
.sandbox-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #fed7aa;
  border-bottom: 1px solid #fb923c;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #9a3412;
  z-index: 500;
}

body.has-sandbox-banner {
  --sandbox-banner-height: 2.5rem;
  padding-top: var(--sandbox-banner-height);
}

body.has-sandbox-banner .sidebar {
  top: var(--sandbox-banner-height);
}

/* Alert Banner (inline page banners) */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;

  a {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;

    @media (any-hover: hover) {
      &:hover { text-decoration-thickness: 2px; }
    }
  }
}

.alert-banner--warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning-text);
  border: 1px solid color-mix(in srgb, var(--color-warning) 25%, transparent);

  a { color: var(--color-warning-text); }
}

.alert-banner-icon {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
}
