.dashboard-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--bg-dark);
}

.app-footer {
  display: flex;
  justifyContent: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}

@media (max-width: 768px) {
  .app-footer {
    justify-content: center;
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
    padding: 1rem;
  }
}

.sidebar {
  width: 190px;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0.75rem;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  flex-shrink: 0;
  will-change: width;
  z-index: 100;
}

.sidebar.collapsed {
  width: 72px;
  padding: 1.5rem 0.5rem;
}

.sidebar-text {
  opacity: 1;
  max-width: 150px;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.15s ease, max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.sidebar.collapsed .sidebar-text {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding-left: 0;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding-left: 0.5rem;
}

.sidebar-logo svg {
  color: var(--color-cyan);
  font-size: 2rem;
}

.sidebar-logo div {
  display: flex;
  flex-direction: column;
}

.sidebar-logo span {
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 1.1rem;
  line-height: 1.1;
}

.sidebar-logo small {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}

.nav-item svg {
  flex-shrink: 0;
  min-width: 20px;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--color-cyan) 0%, #0284c7 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.nav-item.active svg {
  color: #ffffff;
}

.nav-item svg {
  font-size: 1.25rem;
}

.sidebar-footer {
  margin-top: auto;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  gap: 1.5rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  width: 400px;
  border: 1px solid var(--border-color);
}

.search-bar svg {
  color: var(--text-muted);
  margin-right: 0.75rem;
}

.search-bar input {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  width: 100%;
  font-size: 0.9rem;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-main);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-green);
}

.kpi-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.kpi-card {
  background-color: var(--bg-card);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.kpi-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 2.25rem;
  font-weight: 700;
}

.kpi-subtitle {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.kpi-trend.positive {
  color: var(--color-green);
}

.kpi-trend.negative {
  color: var(--color-red);
}

.chart-card {
  background-color: var(--bg-card);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.chart-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.chart-controls {
  display: flex;
  gap: 2rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.button-group {
  display: flex;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 0.5rem;
  overflow: hidden;
}

.control-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.control-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.control-btn.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  font-weight: 500;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  cursor: pointer;
  margin: 0 0.5rem;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle-switch.on {
  background-color: var(--color-cyan);
}

.toggle-switch.on::after {
  left: calc(100% - 18px);
}

.dashboard-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 1rem;
}

.dashboard-footer a {
  text-decoration: underline;
}

/* Mobile Responsiveness */
.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-only {
    display: flex !important;
  }

  .desktop-only {
    display: none !important;
  }

  .dashboard-container {
    flex-direction: column;
  }

  .sidebar {
    display: none;
  }

  .sidebar.mobile-open {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 1rem 0.5rem;
    gap: 1rem;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .topbar-mobile-header {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
  }

  .search-bar {
    width: 100%;
  }

  .search-bar input {
    display: none;
  }

  .search-bar {
    width: auto;
    background: transparent;
    border: none;
    padding: 0;
  }

  .search-bar svg {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-main);
  }

  .kpi-container {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-value {
    font-size: 1.75rem;
  }

  .kpi-subtitle {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .chart-card {
    padding: 1rem 0;
  }

  .chart-header {
    flex-direction: column;
    gap: 1rem;
  }

  .chart-title {
    font-size: 1.1rem;
    line-height: 1.3;
  }

  .chart-controls {
    width: 100%;
    flex-direction: column;
    gap: 1rem;
  }

  .control-group {
    width: 100%;
  }

  .button-group {
    width: 100%;
    justify-content: space-between;
  }

  .control-btn {
    padding: 0.5rem;
    flex: 1;
    text-align: center;
  }

  .chart-legend-container {
    flex-wrap: wrap;
    gap: 0.6rem !important;
    justify-content: center !important;
  }

  .chart-legend-container>span {
    flex: none !important;
    padding: 0.5rem 0.85rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 38px; /* Touch target optimized */
    box-sizing: border-box;
  }
}

/* Mobile Chart Optimizations */
@media (max-width: 768px) {
  .chart-ref-label {
    display: none !important;
  }
  
  .chart-tooltip {
    padding: 0.4rem 0.5rem !important;
    max-width: 200px !important;
    background-color: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
  }
  
  .chart-tooltip p, 
  .chart-tooltip div {
    font-size: 0.8rem !important;
    margin-bottom: 2px !important;
  }
  
  .recharts-cartesian-axis-tick text {
    font-size: 10px !important;
  }
}