/* Layout Container */
.layout-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

/* Header */
.header {
  height: 60px;
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: var(--header-shadow);
  flex-shrink: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  width: 100%;
}

.header-content h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--header-text);
}

.header-logo {
  height: 40px;
  width: auto;
  display: block;
}



/* Layout Wrapper */
.layout-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 90px;
  background-color: var(--bg-surface-alt);
  border-right: 1px solid var(--border-default);
  box-shadow: none;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 99;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  width: 100%;
}

/* Navigation Items */
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 0;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
  gap: 4px;
  box-sizing: border-box;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background-color: var(--nav-hover-bg);
  color: var(--text-primary);
}

.nav-item:active {
  background-color: var(--nav-active-bg);
  color: var(--nav-active-color);
}

/* Active page indicator */
.nav-item.active {
  color: var(--nav-active-color);
  background-color: var(--nav-active-bg);
  border-left: 3px solid var(--nav-active-border);
}

.nav-item.active .nav-icon {
  stroke: var(--nav-active-color);
}

.nav-item.active .nav-label {
  color: var(--nav-active-color);
  font-weight: 600;
}

/* Navigation Icon */
.nav-icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* Navigation Label */
.nav-label {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 0 14px;
  font-size: 12px;
  flex-shrink: 0;
}

.breadcrumb-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 2px 5px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.breadcrumb-link:hover {
  color: var(--text-primary);
  background: var(--nav-hover-bg);
}

.breadcrumb-sep {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
  padding: 2px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

/* Main Content */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(180deg, var(--bg-gradient-from), var(--bg-gradient-to))
      top / 100% 220px no-repeat,
    var(--bg-base);
}

.accent-bar {
  height: var(--accent-bar-height);
  background: linear-gradient(
    90deg,
    var(--accent-bar-from),
    var(--accent-bar-to)
  );
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  overflow: hidden;
  background-color: transparent;
  padding: 20px;
  padding-top: 48px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 20px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  font-size: 12px;
  color: var(--text-faint);
  flex-shrink: 0;
}

/* Nav Divider */
.nav-divider {
  width: calc(100% - 1.5rem);
  border: none;
  border-top: 1px solid var(--border-default);
  margin: 0.5rem auto;
  padding: 0;
  box-sizing: border-box;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header {
    height: 48px;
    padding: 0 12px;
  }

  .header-content h1 {
    font-size: 18px;
  }

  .layout-wrapper {
    flex-direction: column;
    padding-bottom: 56px;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 56px;
    border-right: none;
    border-top: 1px solid var(--border-default);
    box-shadow: var(--header-shadow);
    padding: 0;
    z-index: 100;
  }

  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    height: 100%;
  }

  .nav-item {
    padding: 6px 0;
    min-width: 64px;
    border-left: none;
    border-bottom: 3px solid transparent;
  }

  .nav-item.active {
    border-left: none;
    border-bottom: 3px solid var(--nav-active-border);
  }

  .nav-icon {
    width: 22px;
    height: 22px;
  }

  .nav-label {
    font-size: 10px;
  }

  .main-content {
    padding: 12px;
    padding-top: 20px;
  }

  .breadcrumb {
    padding: 0 0 10px;
  }

  .breadcrumb-current {
    max-width: 200px;
  }

  .content-area {
    background:
      linear-gradient(180deg, var(--bg-gradient-from), var(--bg-gradient-to))
        top / 100% 190px no-repeat,
      var(--bg-base);
  }

  .footer {
    display: none;
  }

  .nav-divider {
    width: 1px;
    height: calc(100% - 1rem);
    border-top: none;
    border-left: 1px solid var(--border-default);
    margin: auto 0;
    align-self: center;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .header {
    height: 44px;
    padding: 0 8px;
  }

  .header-content h1 {
    font-size: 16px;
  }

  .main-content {
    padding: 8px;
    padding-top: 10px;
  }

  .content-area {
    background:
      linear-gradient(180deg, var(--bg-gradient-from), var(--bg-gradient-to))
        top / 100% 160px no-repeat,
      var(--bg-base);
  }

  .nav-item {
    min-width: 48px;
  }
}

/* Safe area insets for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .sidebar {
      padding-bottom: env(safe-area-inset-bottom);
      height: calc(56px + env(safe-area-inset-bottom));
    }

    .layout-wrapper {
      padding-bottom: calc(56px + env(safe-area-inset-bottom));
    }
  }
}
