/* ========================================
   layout.css - Main Layout & Sidebar
   ======================================== */

/* === Root Layout === */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
}

/* === Sidebar === */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-6) 0;
  z-index: 100;
  transition: transform var(--transition-base);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-6);
  animation: pulse-glow 3s ease-in-out infinite;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  position: relative;
  flex-shrink: 0;
}


.sidebar-nav-item {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-base);
  z-index: 1;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.sidebar-nav-item:hover {
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  color: var(--accent-primary);
  background: transparent;
}

.sidebar-nav-item svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}


/* Tooltip */
.sidebar-nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.sidebar-nav-item:hover::after {
  opacity: 1;
}

/* Active pill indicator */
.sidebar-pill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(79,110,247,0.12);
  border: 1px solid var(--border-glow);
  transition: top var(--transition-slow) cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 0;
}

/* Scroll progress container in middle */
.sidebar-middle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--space-4) 0;
}

.scroll-progress {
  width: 2px;
  height: 100%;
  max-height: 100%;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.scroll-progress-fill {
  width: 100%;
  background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-full);
  transition: height 0.1s linear;
  height: 0%;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Lang switcher in sidebar footer */
.lang-switcher {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  border: 1px solid transparent;
  background: transparent;
}

.lang-btn svg {
  flex-shrink: 0;
  box-shadow: 0 0 1px rgba(0,0,0,0.6);
}

.lang-btn:hover { color: var(--text-secondary); background: rgba(255,255,255,0.04); }

.lang-btn.active {
  color: var(--accent-primary);
  background: rgba(79,110,247,0.12);
  border-color: var(--border-subtle);
}

/* === Main Content === */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

/* === Section base === */
.section {
  padding: var(--space-24) var(--space-12);
  max-width: calc(var(--content-max) + var(--space-24));
  margin: 0 auto;
}

/* === Custom Cursor === */
.cursor-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: background 0.3s ease, transform 0.1s ease;
}

.cursor-ring {
  position: fixed;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--accent-primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: border-color 0.3s ease, width 0.25s ease, height 0.25s ease, opacity 0.25s ease;
  opacity: 0.6;
}

.cursor-ring.hover {
  width: 52px;
  height: 52px;
  border-color: var(--accent-secondary);
  opacity: 0.9;
}

@media (hover: none), (pointer: coarse), (max-width: 1024px) {
  .cursor-dot, .cursor-ring {
    display: none !important;
  }
}

/* === Mobile Rotate Overlay === */
.rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  z-index: 99999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  text-align: center;
  padding: var(--space-8);
}

.rotate-overlay svg {
  width: 64px;
  height: 64px;
  color: var(--accent-primary);
  animation: spin-slow 2s linear infinite;
}

.rotate-overlay p {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text-secondary);
  max-width: 300px;
}

@media (orientation: portrait) and (max-width: 1024px) {
  .rotate-overlay { display: flex; }
}

/* === Navbar mobile (top) === */
.navbar-mobile {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: 100;
}

/* === Responsive === */
@media (max-width: 1279px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding-top: 60px; }
  .navbar-mobile { display: flex; }
  .section { padding: var(--space-16) var(--space-6); }
}

@media (max-width: 767px) {
  .section { padding: var(--space-12) var(--space-4); }
}

/* === Utility === */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.w-full { width: 100%; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
