@import url("variables.css");

body {
  font-family: var(--font-en);
  background: var(--bg-page);
  color: var(--color-gray-800);
  line-height: 1.55;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--color-primary-dark) 0%, #0f1f33 100%);
  color: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-4);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.25s ease;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.sidebar__logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--fs-sm);
}

.sidebar__title {
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1.25;
}

.sidebar__subtitle {
  font-size: var(--fs-xs);
  opacity: 0.72;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  font-size: var(--fs-sm);
  opacity: 0.86;
  border: 1px solid transparent;
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.sidebar__link:hover {
  background: rgba(255, 255, 255, 0.06);
  opacity: 1;
}

.sidebar__link.is-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
  opacity: 1;
}

.sidebar__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar__user {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__user-name {
  font-weight: 600;
  font-size: var(--fs-sm);
}

.sidebar__user-meta {
  font-size: var(--fs-xs);
  opacity: 0.75;
  margin-top: var(--space-1);
}

.sidebar__logout {
  margin-top: var(--space-3);
  width: 100%;
}

.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-header {
  height: var(--header-height);
  flex-shrink: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 30;
}

.top-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-gray-200);
  background: var(--bg-card);
  cursor: pointer;
}

.mobile-toggle:hover {
  border-color: var(--color-gray-400);
}

.page-title {
  font-size: var(--fs-xl);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.main-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 960px) {
  .mobile-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 35;
  }

  .sidebar-backdrop.is-visible {
    display: block;
  }

  .main-content {
    padding: var(--space-4);
  }
}

@media print {
  .sidebar,
  .top-header,
  .mobile-toggle,
  .sidebar-backdrop,
  .no-print {
    display: none !important;
  }

  .modal-backdrop {
    display: none !important;
  }

  .modal-root {
    position: static !important;
    inset: auto !important;
  }

  .modal-dialog {
    box-shadow: none !important;
    margin: 0 auto !important;
    max-width: none !important;
    border: none !important;
  }

  .modal-header button {
    display: none !important;
  }

  .main-wrap {
    display: block;
  }

  .main-content {
    max-width: none;
    padding: 0;
  }

  body {
    background: white;
  }
}
