/* AutoLabSidebar CSS - Adaptive Theme (Light/Dark) */

:root {
  /* Light Theme Variables */
  --als-bg: #ffffff;
  --als-text: #475569;
  --als-text-active: #ffffff;
  --als-text-muted: #64748b;
  --als-border: #f1f5f9;
  --als-bg-search: #f8fafc;
  --als-bg-hover: rgba(45, 106, 79, 0.05);
  --als-tree-line: #e2e8f0;
  --als-footer-bg: #f8fafc;
  --als-user-card-bg: rgba(0, 0, 0, 0.01);
  --als-toggle-bg: #ffffff;
  --als-toggle-border: #e2e8f0;
  --als-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  --als-primary: #1b4332;
  --als-primary-light: #2d6a4f;
}

.dark .als-container {
  /* Dark Theme Variables */
  --als-bg: #141414;
  --als-text: #ffffff;
  --als-text-active: #ffffff;
  --als-text-muted: #a0a0a0;
  --als-border: rgba(255, 255, 255, 0.03);
  --als-bg-search: #1e1e1e;
  --als-bg-hover: rgba(255, 255, 255, 0.03);
  --als-tree-line: #262626;
  --als-footer-bg: #0f0f0f;
  --als-user-card-bg: rgba(255, 255, 255, 0.02);
  --als-toggle-bg: #1e1e1e;
  --als-toggle-border: #333;
  --als-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.als-container {
  width: 260px;
  height: calc(100vh - 20px);
  background: var(--als-bg);
  color: var(--als-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 40;
  border-radius: 16px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: var(--als-shadow);
  border: 1px solid var(--als-border);
}

/* Subtle Top Glow - AutoLab Green */
.als-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--als-primary), transparent);
  opacity: 0.3;
}

.als-container.collapsed {
  width: 80px;
}

/* Toggle Area */
.als-toggle-container {
  padding: 1rem;
  display: flex;
  justify-content: flex-end;
  min-height: 56px;
  align-items: center;
}

.collapsed .als-toggle-container {
  justify-content: center;
}

.als-toggle-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--als-toggle-bg);
  border: 1px solid var(--als-toggle-border);
  color: var(--als-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.als-toggle-btn:hover {
  background: var(--als-bg-search);
  color: var(--als-primary);
  border-color: var(--als-primary);
  transform: scale(1.05);
}

/* Search Box */
.als-search-wrapper {
  padding: 0.5rem 1.25rem 1.5rem;
  transition: all 0.3s ease;
}

.collapsed .als-search-wrapper {
  opacity: 0;
  pointer-events: none;
  height: 0;
  padding: 0;
}

.als-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--als-bg-search);
  border: 1px solid var(--als-border);
  border-radius: 12px;
  color: var(--als-text);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s ease;
}

.als-search-input:focus {
  border-color: var(--als-primary);
  background: var(--als-bg);
  box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.1);
}

/* Navigation Content */
.als-nav-content {
  flex: 1;
  padding: 0.5rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.als-nav-content::-webkit-scrollbar {
  width: 3px;
}

.als-nav-content::-webkit-scrollbar-thumb {
  background: var(--als-border);
  border-radius: 10px;
}

/* Menu Item Wrapper */
.als-item-wrapper {
  margin-bottom: 6px;
}

/* Links & Tree Structure */
.als-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  color: var(--als-text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  gap: 14px;
}

.als-link:hover:not(.active) {
  background: var(--als-bg-hover);
  color: var(--als-primary);
}

.als-link.active {
  background: var(--als-primary) !important;
  color: var(--als-text-active) !important;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(27, 67, 50, 0.25);
}

.als-icon {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.als-link:hover .als-icon:not(.active) {
  transform: scale(1.1);
}

.als-label {
  flex: 1;
  font-size: 0.9rem;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.collapsed .als-label,
.collapsed .als-chevron {
  display: none;
}

.als-chevron {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--als-text-muted);
}

.als-chevron.expanded {
  transform: rotate(180deg);
}

/* Submenu & Tree Lines */
.als-submenu {
  margin-left: 0.5rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--als-tree-line);
  margin-top: 4px;
  margin-bottom: 8px;
}

.als-sublink {
  display: flex;
  align-items: center;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  color: var(--als-text-muted);
  font-size: 0.85rem;
  transition: all 0.2s ease;
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
  gap: 12px;
}

.als-sublink::before {
  content: '';
  position: absolute;
  left: -1.25rem;
  top: 50%;
  width: 0.75rem;
  height: 2px;
  background: var(--als-tree-line);
}

.als-sublink:hover {
  color: var(--als-primary);
  background: var(--als-bg-hover);
}

.als-sublink.active {
  color: var(--als-primary);
  font-weight: 700;
}

/* Icons in sublink */
.als-sublink .als-icon {
  opacity: 0.7;
}

.als-sublink.active .als-icon {
  opacity: 1;
  color: var(--als-primary);
}

/* Footer Section */
.als-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--als-border);
  background: var(--als-footer-bg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.collapsed .als-footer {
  padding: 1.25rem 0.5rem;
  align-items: center;
}

/* Brand Area in Footer */
.als-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.als-brand-logo {
  width: 36px;
  height: 36px;
  background: var(--als-primary);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 0 15px rgba(27, 67, 50, 0.2);
  flex-shrink: 0;
}

.als-brand-info {
  display: flex;
  flex-direction: column;
}

.als-brand-name {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--als-text);
}

.als-brand-name span {
  color: var(--als-primary);
}

.als-app-sub {
  font-size: 0.7rem;
  color: var(--als-text-muted);
  font-weight: 600;
}

/* User Card */
.als-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.625rem;
  background: var(--als-user-card-bg);
  border-radius: 12px;
  border: 1px solid var(--als-border);
}

.als-user-data {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.als-user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--als-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.als-logout-link {
  font-size: 0.75rem;
  color: var(--als-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: fit-content;
}

.als-logout-link:hover {
  color: #ef4444;
}

/* Locks */
.als-locked {
  opacity: 0.4;
  cursor: not-allowed !important;
}

.als-lock-icon {
  margin-left: auto;
  color: var(--als-primary) !important;
}
