.dashboard-container {
  display: flex;
  min-height: calc(100vh - 80px);
  background: linear-gradient(
    135deg,
    var(--gray-50) 0%,
    rgba(79, 70, 229, 0.02) 100%
  );
}

.dashboard-sidebar {
  width: 280px;
  background: linear-gradient(
    180deg,
    var(--gray-900) 0%,
    var(--gray-800) 100%
  );
  color: white;
  padding: 0;
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  border-right: 1px solid var(--gray-700);
  box-shadow: var(--shadow-lg);
}

.dashboard-sidebar-header {
  padding: 32px 24px 24px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--gray-700);
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--secondary) 100%
  );
}

.dashboard-sidebar-header h3 {
  margin-bottom: 8px;
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
}

.dashboard-sidebar-header p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0;
  opacity: 0.9;
}

.sidebar-menu {
  list-style: none;
  padding: 16px 0;
  margin: 0;
}

.sidebar-menu li {
  margin-bottom: 4px;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  border-radius: 0;
  font-weight: 500;
}

.sidebar-menu a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.sidebar-menu a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(4px);
}

.sidebar-menu a:hover::before,
.sidebar-menu a.active::before {
  transform: scaleY(1);
}

.sidebar-menu a.active {
  background: rgba(79, 70, 229, 0.2);
  color: white;
  border-left: 4px solid var(--primary);
}

.sidebar-menu i {
  margin-right: 12px;
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
  opacity: 0.9;
}

.dashboard-content {
  flex: 1;
  padding: 40px;
  max-width: calc(100vw - 280px);
}

.dashboard-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-200);
}

.dashboard-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--secondary) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.dashboard-header p {
  color: var(--gray-600);
  font-size: 1.1rem;
  margin-bottom: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--secondary),
    var(--accent)
  );
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.stat-card:hover::before {
  transform: scaleX(1);
}

.stat-card .stat-title {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-bottom: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 16px;
  line-height: 1.2;
}

.stat-card .btn-purchase {
  margin-top: 16px;
  width: 100%;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--secondary) 100%
  );
  border: none;
  color: white;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.stat-card .btn-purchase:hover {
  background: linear-gradient(
    135deg,
    var(--primary-dark) 0%,
    var(--secondary-dark) 100%
  );
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-change {
  font-size: 0.85rem;
  margin-top: 8px;
  font-weight: 500;
}

.stat-card .stat-change.positive {
  color: var(--success);
}

.stat-card .stat-change.negative {
  color: var(--danger);
}

.api-key-section {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  position: relative;
  overflow: hidden;
}

.api-key-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.api-key-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.api-key-header h2 {
  margin-bottom: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

.api-key-container {
  display: flex;
  align-items: center;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 16px;
  transition: var(--transition);
}

.api-key-container:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.api-key-value {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  word-break: break-all;
  color: var(--gray-800);
  background: none;
  padding: 8px;
  border-radius: var(--border-radius-sm);
}

.api-key-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.usage-section {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  position: relative;
  overflow: hidden;
}

.usage-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
}

.usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.usage-header h2 {
  margin-bottom: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

.usage-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.usage-chart {
  height: 320px;
  margin-bottom: 32px;
  background: var(--gray-50);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-style: italic;
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.usage-table th,
.usage-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.usage-table th {
  font-weight: 600;
  background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
  color: var(--gray-800);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.usage-table tbody tr {
  transition: var(--transition);
}

.usage-table tbody tr:hover {
  background: rgba(79, 70, 229, 0.03);
}

.usage-table tbody tr:last-child td {
  border-bottom: none;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  gap: 4px;
}

.pagination-btn {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  background: white;
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  color: var(--gray-700);
}

.pagination-btn:hover {
  background: var(--gray-50);
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.api-key-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--warning);
  font-size: 0.9rem;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--warning);
}

.api-key-warning i {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.hidden {
  display: none;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--border-radius-sm);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
  border: none;
  transition: var(--transition);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.form-control-sm {
  height: 36px;
  padding: 8px 12px;
  font-size: 0.875rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--gray-300);
  transition: var(--transition);
}

.form-control-sm:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  outline: none;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.user-greeting {
  margin-right: 16px;
  color: var(--gray-700);
  font-weight: 500;
  font-size: 0.95rem;
}

/* Mobile Responsive */
@media (max-width: 992px) {
  .dashboard-container {
    flex-direction: column;
  }

  .dashboard-sidebar {
    width: 100%;
    height: auto;
    position: static;
    top: 0;
    padding: 16px 0;
    border-right: none;
    border-bottom: 1px solid var(--gray-700);
  }

  .dashboard-sidebar-header {
    padding: 16px 24px;
    text-align: center;
  }

  .sidebar-menu {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 8px;
    gap: 8px;
  }

  .sidebar-menu li {
    margin-bottom: 0;
  }

  .sidebar-menu a {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    white-space: nowrap;
  }

  .sidebar-menu a:hover {
    transform: none;
  }

  .dashboard-content {
    padding: 24px;
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .api-key-header,
  .usage-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .api-key-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .api-key-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .usage-filters {
    width: 100%;
    flex-direction: column;
  }

  .usage-filters .btn {
    width: 100%;
    justify-content: center;
  }

  .usage-table {
    font-size: 0.9rem;
  }

  .usage-table th,
  .usage-table td {
    padding: 12px 8px;
  }

  .dashboard-content {
    padding: 16px;
  }

  .api-key-section,
  .usage-section {
    padding: 24px;
  }

  .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .stat-card {
    padding: 24px;
  }

  .dashboard-header h1 {
    font-size: 2rem;
  }

  .api-key-header h2,
  .usage-header h2 {
    font-size: 1.5rem;
  }

  .sidebar-menu {
    flex-direction: column;
    align-items: center;
  }

  .sidebar-menu a {
    width: 100%;
    max-width: 200px;
    text-align: center;
  }
}
