/* ==========================================================================
   Sidebar Styles
   ========================================================================== */

/* Sidebar Wrapper */
.sidebar-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width, 170px);
  height: 100vh;
  background: var(--bg-sidebar, linear-gradient(180deg, #4f46e5 0%, #6366f1 100%));
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-content {
  padding: 0.5rem;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: 1rem;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md, 0.375rem);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast, 150ms ease);
}

.sidebar-brand:hover {
  background-color: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}

.sidebar-brand i {
  font-size: 1rem;
  color: white;
}

.sidebar-brand-text {
  font-size: 0.8125rem;
  font-weight: var(--font-weight-bold, 700);
  color: white;
  margin-left: 0.375rem;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.sidebar-version {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.5);
  margin-left: auto;
}

/* Navigation */
.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}

.sidebar-nav-section {
  margin-bottom: 0.125rem;
}

.sidebar-nav-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-md, 0.375rem);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  font-weight: var(--font-weight-semibold, 600);
  cursor: pointer;
  transition: all var(--transition-fast, 150ms ease);
  text-align: left;
}

.sidebar-nav-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-nav-toggle i {
  font-size: 0.875rem;
  margin-right: 0.375rem;
  opacity: 0.85;
}

.sidebar-nav-toggle span {
  flex: 1;
}

/* Collapse chevron */
.sidebar-nav-toggle::after {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--transition-fast, 150ms ease);
  opacity: 0.6;
}

.sidebar-nav-toggle[aria-expanded="true"]::after {
  transform: rotate(45deg);
}

.sidebar-nav-toggle[aria-expanded="true"] {
  color: white;
  background-color: rgba(255, 255, 255, 0.05);
}

/* Subnav */
.sidebar-subnav {
  list-style: none;
  padding: 0.125rem 0;
  margin: 0;
}

.sidebar-subnav li {
  margin: 0;
}

.sidebar-subnav a {
  display: block;
  padding: 0.1875rem 0.5rem;
  padding-left: calc(0.5rem + 0.875rem + 0.375rem);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.6875rem;
  font-weight: var(--font-weight-normal, 400);
  border-radius: var(--radius-sm, 0.25rem);
  transition: all var(--transition-fast, 150ms ease);
  text-decoration: none;
}

.sidebar-subnav a:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.sidebar-subnav a.active {
  color: white;
  background-color: rgba(255, 255, 255, 0.15);
  font-weight: var(--font-weight-medium, 500);
}

/* Third-level Quick Navigation */
.sidebar-quicknav {
  list-style: none;
  padding: 0.25rem 0;
  margin: 0;
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  margin-left: calc(0.5rem + 0.875rem + 0.5rem);
}

.sidebar-quicknav li {
  margin: 0;
}

.sidebar-quicknav a {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.5rem;
  padding-left: 0.625rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.625rem;
  font-weight: var(--font-weight-normal, 400);
  border-radius: var(--radius-sm, 0.25rem);
  transition: all var(--transition-fast, 150ms ease);
  text-decoration: none;
}

.sidebar-quicknav a:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.sidebar-quicknav a.active {
  color: white;
  background-color: rgba(255, 255, 255, 0.15);
  font-weight: var(--font-weight-medium, 500);
}

.sidebar-quicknav a i {
  font-size: 0.6875rem;
  opacity: 0.85;
}

/* Active page parent styling */
.sidebar-subnav li.has-quick-nav > a {
  color: white;
  font-weight: var(--font-weight-medium, 500);
}

/* Active section toggle styling */
.sidebar-nav-toggle.active {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Account section - push to bottom if needed */
.sidebar-nav-account {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Logout form */
.sidebar-logout-form {
  margin: 0;
  padding: 0;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.1875rem 0.5rem;
  padding-left: calc(0.5rem + 0.875rem + 0.375rem);
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.6875rem;
  font-weight: var(--font-weight-normal, 400);
  border-radius: var(--radius-sm, 0.25rem);
  cursor: pointer;
  transition: all var(--transition-fast, 150ms ease);
  text-align: left;
}

.sidebar-logout-btn:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-logout-btn i {
  margin-right: 0.375rem;
}

/* Main Content Wrapper */
.main-content-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width, 170px);
  min-height: 100vh;
  background-color: var(--bg-body, #f8fafc);
}

.main-content-inner {
  padding: var(--spacing-8, 2rem);
  max-width: 1400px;
}

/* Legacy support - keep old classes working */
.btn-toggle {
  display: inline-flex;
  align-items: center;
  padding: .25rem .5rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  background-color: transparent;
  border: 0;
}

.btn-toggle:hover,
.btn-toggle:focus {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-toggle::before {
  width: 1.25em;
  line-height: 0;
  content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%28255,255,255,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
  transition: transform .35s ease;
  transform-origin: .5em 50%;
}

.btn-toggle[aria-expanded="true"] {
  color: white;
}

.btn-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

.btn-toggle-nav a {
  display: inline-flex;
  padding: .1875rem .5rem;
  margin-top: .125rem;
  margin-left: 1.25rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.75);
}

.btn-toggle-nav a:hover,
.btn-toggle-nav a:focus {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

/* Utility classes from old file */
.bi {
  vertical-align: -.125em;
  pointer-events: none;
  fill: currentColor;
}

.fw-semibold { font-weight: 600; }
.lh-tight { line-height: 1.25; }

.scrollarea {
  overflow-y: auto;
}

/* Responsive */
@media (max-width: 992px) {
  .sidebar-wrapper {
    width: 100%;
    height: auto;
    position: relative;
  }

  .main-content-wrapper {
    margin-left: 0;
  }

  .sidebar-content {
    padding: var(--spacing-4, 1rem);
  }

  .sidebar-brand {
    margin-bottom: var(--spacing-4, 1rem);
  }
}

@media (max-width: 768px) {
  .main-content-inner {
    padding: var(--spacing-4, 1rem);
  }
}
