
.dashboard-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  padding: 0 16px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo span {
  color: var(--text-primary);
}

.sidebar.collapsed .sidebar-logo span {
  display: none;
}

.toggle-sidebar {
  position: absolute;
  top: 24px;
  right: -16px;
  background: var(--accent);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 101;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transition: var(--transition);
}

.toggle-sidebar:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
}

.sidebar.collapsed .toggle-sidebar {
  transform: rotate(180deg);
}

.sidebar.collapsed .toggle-sidebar:hover {
  transform: rotate(180deg) scale(1.1);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  gap: 12px;
  white-space: nowrap;
  margin: 0 12px;
}

.sidebar.collapsed .nav-text {
  display: none;
}

.sidebar.collapsed .sidebar-nav a {
  margin: 0 auto;
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.sidebar.collapsed .sidebar-nav a svg {
  margin: 0;
  width: 20px;
  height: 20px;
}

.sidebar.collapsed .sidebar-nav a:hover,
.sidebar.collapsed .sidebar-nav a.active {
  background-color: var(--accent);
  border-color: var(--accent);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background-color: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}


.sidebar button:focus,
.sidebar a:focus {
  outline: none;
  box-shadow: none;
}

.sidebar button:focus-visible,
.sidebar a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-sidebar-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-size: 14px;
}

.sidebar.collapsed .btn-sidebar-action {
  justify-content: center;
}

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

.btn-sidebar-action.logout {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-sidebar-action.logout:hover {
  background: var(--danger);
  color: white;
}


.btn-popup-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.btn-popup-trigger::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-popup-trigger:hover::before {
  opacity: 1;
}

.btn-popup-trigger:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: var(--accent, #3b82f6);
  transform: translateX(2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.btn-popup-trigger:active {
  transform: translateX(0) scale(0.98);
}

.btn-popup-trigger:focus {
  outline: none;
}

.btn-popup-trigger:focus-visible {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 2px;
}

.btn-popup-trigger .popup-btn-icon {
  font-size: 16px;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.btn-popup-trigger:hover .popup-btn-icon {
  transform: rotate(-8deg) scale(1.15);
}

.sidebar.collapsed .btn-popup-trigger {
  justify-content: center;
  padding: 0;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 12px;
}

.sidebar.collapsed .btn-popup-trigger span.nav-text {
  display: none;
}

html[data-theme="light"] .btn-popup-trigger:hover {
  background: rgba(59, 130, 246, 0.08);
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.3s ease;
}

.dashboard-header {
  height: var(--header-height);
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 5;
  transition: var(--transition);
}

.dashboard-header h1 {
  font-size: 1.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-area {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent 40%);
  display: flex;
  flex-direction: column;
}

.content-container {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}


.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 8px;
  cursor: pointer;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}


@media (max-width: 1024px) {
  --sidebar-width: 200px;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    width: var(--sidebar-width) !important;
  }
  
  .sidebar.mobile-active {
    transform: translateX(0);
  }
  
  .dashboard-header {
    padding: 0 16px;
  }
  
  .content-area {
    padding: 20px 16px;
  }
  
  .grid-container {
    grid-template-columns: 1fr;
  }

  .mobile-nav-toggle {
    display: block;
  }
}
