/* ==========================================================================
   Layout — Sidebar, Main Content, Auth
   ========================================================================== */

/* App Wrapper */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-primary-dark);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand h2 {
  color: white;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-brand .logo-icon {
  font-size: 1.5rem;
}

.sidebar-nav {
  padding: 12px;
  flex: 1;
}

.sidebar-nav .nav-section {
  margin-bottom: 8px;
}

.sidebar-nav .nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  padding: 8px 12px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2px;
}

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

.nav-link.active {
  background: var(--color-accent);
  color: white;
}

.nav-link .nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .user-info {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}

.sidebar-footer .user-name {
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ----- Main Content ----- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.content-header {
  padding: 20px 32px;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.95);
}

.content-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.content-body {
  padding: 24px 32px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mobile toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.mobile-toggle:hover {
  background: var(--color-bg);
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

/* ----- Auth Layout ----- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, #1e40af 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(59, 130, 246, 0.08) 0%, transparent 40%);
  animation: authBgPulse 15s ease-in-out infinite;
}

@keyframes authBgPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.05) rotate(2deg); }
}

.auth-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

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

  .mobile-toggle {
    display: block;
  }

  .content-header {
    padding: 16px 20px;
  }

  .content-header h1 {
    font-size: 1.2rem;
  }

  .content-body {
    padding: 16px;
  }
}
