/* Global Styles */
html,
body,
#__next {
  height: 100%;
  margin: 0;
  font-family: "Poppins", sans-serif;
  background: #f3f4f6;
  color: #374151;
  overflow: hidden;
}

/* Dashboard Container */
.dashboard-container {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px;
  max-width: 1500px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 16px 0;
  position: sticky;
  top: 0;
  background: #f3f4f6;
  z-index: 10;
  margin-bottom: 16px;
}

.dashboard-title {
  font-size: 30px;
  font-weight: 700;
  color: #1f2937;
}

.welcome-card {
  background: #ffffff;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.welcome-card p {
  color: #6b7280;
  font-size: 14px;
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  flex: 1;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}

/* Columns */
.content-left {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
  max-height: 100%;
  overflow: hidden;
  max-width: 700px;
}

.content-right {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-height: 100%;
  max-width: 400px;
  overflow: hidden;
}

/* Card */
.card {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card.full-width {
  grid-column: 1 / -1;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 16px;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  text-align: center;
}

.metric-card {
  padding: 16px;
  border-radius: 8px;
}

.metric-card.grade {
  background: #d1fae5;
}

.metric-card.score {
  background: #dbeafe;
}

.metric-card.tests {
  background: #ede9fe;
}

.metric-card.rank {
  background: #fef3c7;
}

.metric-label {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 30px;
  font-weight: 700;
}

.metric-card.grade .metric-value {
  color: #059669;
}

.metric-card.score .metric-value {
  color: #2563eb;
}

.metric-card.tests .metric-value {
  color: #7c3aed;
}

.metric-card.rank .metric-value {
  color: #d97706;
}

/* Test Tabs (New) */
.test-tabs {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 24px;
}

.tab-button {
  padding: 16px 4px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.tab-button:hover {
  color: #374151;
}

.tab-button.active-tab {
  border-bottom: 2px solid #4f46e5;
  color: #4f46e5;
  font-weight: 600;
}

.test-content {
  flex: 1;
  overflow: hidden;
}

.tab-content {
  display: block;
}

.tab-content.hidden {
  display: none;
}

.tab-title {
  font-size: 24px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 16px;
}

.table-container {
  overflow-x: auto;
  max-height: calc(100vh - 200px);
}

/* Tables */
.test-table {
  width: 100%;
  border-collapse: collapse;
  max-height: 300px;
  display: block;
  overflow-y: auto;
  scrollbar-width: none;
}

.test-table::-webkit-scrollbar {
  display: none;
}

.test-table th,
.test-table td {
  padding: 16px;
  text-align: left;
  font-size: 14px;
}

.test-table th {
  font-weight: 600;
  color: #4b5563;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
}

.test-table td {
  border-bottom: 1px solid #e5e7eb;
}

.test-table tr:hover {
  background: #f3f4f6;
}

/* Action Button */
.action-button {
  padding: 8px 16px;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.action-button:not(.disabled) {
  background: #10b981;
}

.action-button:not(.disabled):hover {
  background: #059669;
}

.action-button.disabled {
  background: #d1d5db;
  color: #6b7280;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Chart Container */
.chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  max-height: 200px;
  width: 100%;
}

.chart-canvas {
  max-height: 200px;
  max-width: 100%;
  height: auto;
  width: 100%;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 32px;
  color: #6b7280;
}

.empty-state .material-icons {
  font-size: 40px;
  margin-bottom: 8px;
}

/* Profile Section */
.profile-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
}

.profile-picture {
  width: 96px;
  height: 96px;
  background: #e0e7ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-initials {
  color: #4f46e5;
  font-size: 32px;
  font-weight: 700;
}

.profile-info {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-size: 24px;
  font-weight: 600;
  color: #374151;
}

.profile-meta {
  font-size: 14px;
  color: #6b7280;
}

.personal-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-item {
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
}

.detail-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.detail-value {
  font-size: 14px;
  color: #4b5563;
}

/* Error Message */
.error-message {
  font-size: 14px;
  color: #dc2626;
  text-align: center;
  padding: 16px;
  background: #fef2f2;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .dashboard-container {
    margin-left: 0;
    width: 100%;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid,
  .personal-details {
    grid-template-columns: 1fr;
  }

  .dashboard-title {
    font-size: 24px;
  }

  .test-table th:nth-child(3),
  .test-table td:nth-child(3),
  .test-table th:nth-child(4),
  .test-table td:nth-child(4) {
    display: none;
  }

  .chart-container,
  .chart-canvas {
    max-height: 150px;
  }

  .test-tabs {
    gap: 16px;
  }

  .tab-button {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 16px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .profile-picture {
    width: 80px;
    height: 80px;
  }

  .profile-name {
    font-size: 20px;
  }
}
