/* ==========================================
   LAYOUT (Container / Sidebar / Header / Main)
   ========================================== */

/* Background Effects (layout-level wrappers) */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1;
}

/* Layout */
.container {
  display: flex;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height */
  position: relative;
  z-index: 2;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  flex-shrink: 0;
}

/* Logo */
.logo {
  padding: 0 24px 32px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 20px;
  height: 20px;
  stroke: white;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-text span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.operator-phone {
  font-size: 12px;
  line-height: 1;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 4px;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-tab::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-cyan);
  transform: scaleY(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 4px 4px 0;
}

.nav-tab:hover {
  background: var(--bg-card);
}

.nav-tab.active {
  background: var(--bg-card);
}

.nav-tab.active::before {
  transform: scaleY(1);
}

.nav-tab-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.nav-tab[data-tab="new-users"] .nav-tab-icon {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

[data-tab="8800"] .nav-tab-icon {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

.nav-tab[data-tab="support"] .nav-tab-icon {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
}

.nav-tab[data-tab="avito"] .nav-tab-icon {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
}

/* Telegram tab icon */
[data-tab="telegram"] .nav-tab-icon {
  background: rgba(0, 136, 204, 0.15);
  color: #0088cc;
}

.nav-tab-icon svg {
  width: 20px;
  height: 20px;
}

.nav-tab-content {
  flex: 1;
}

.nav-tab-title {
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 2px;
}

.nav-tab-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

/* Sidebar Stats */
.sidebar-stats {
  margin-top: auto;
  padding: 24px;
  border-top: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* Sidebar Logout wrapper */
.sidebar-logout {
  padding: 16px 24px 0;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Header */
.header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.header-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.header-title span {
  color: var(--text-secondary);
  font-weight: 400;
}

/* Cards List container (layout only) */
.cards-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================
   Mobile Responsive (Layout only)
   ========================================== */

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    height: 100dvh;
    z-index: 50;

    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;

    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
  }

  .main-content {
    width: 100%;
  }

  .header {
    padding: 16px 20px;
    flex-wrap: wrap;
    gap: 16px;
  }

  .header-left {
    width: 100%;
  }

  .header-title {
    font-size: 20px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cards-container {
    padding: 16px 20px;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 85%;
    max-width: 300px;
  }

  .logo {
    padding: 0 20px 24px;
    font-size: 18px;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
  }

  .logo-icon svg {
    width: 18px;
    height: 18px;
  }

  .nav-tabs {
    padding: 0 10px;
  }

  .nav-tab {
    padding: 12px 14px;
    gap: 12px;
  }

  .nav-tab-icon {
    width: 36px;
    height: 36px;
  }

  .nav-tab-icon svg {
    width: 18px;
    height: 18px;
  }

  .nav-tab-title {
    font-size: 14px;
  }

  .nav-tab-count {
    font-size: 11px;
  }

  .sidebar-stats {
    padding: 20px;
  }

  .sidebar-logout {
    padding: 16px 20px 0;
  }

  .header {
    padding: 14px 16px;
  }

  .header-title {
    font-size: 18px;
  }

  .cards-container {
    padding: 14px 16px;
  }
}
