/* User Dashboard Styles */

/* Dashboard Modal */
.dashboard-modal {
  z-index: 1100; /* Higher than auth dropdown */
}

.dashboard-content {
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card-bg, #fff);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  background: var(--accent-bg, #f8f9fa);
  border-radius: 12px 12px 0 0;
}

.modal-title {
  margin: 0;
  color: var(--text-primary, #333);
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-title i {
  color: var(--primary-color, #4A90E2);
}

.modal-close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary, #666);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close-button:hover {
  background: var(--hover-bg, #f5f5f5);
  color: var(--text-primary, #333);
}

/* Dashboard Loading */
.dashboard-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 2rem;
  color: var(--primary-color, #4A90E2);
  font-size: 1rem;
}

.dashboard-loading i {
  font-size: 1.5rem;
  animation: spin 1s linear infinite;
}

/* Dashboard Error */
.dashboard-error {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  padding: 1rem 2rem;
  border: 1px solid rgba(220, 53, 69, 0.2);
  font-size: 0.9rem;
}

/* Dashboard Body */
.dashboard-body {
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
}

/* Dashboard Sections */
.dashboard-section {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.dashboard-section:last-child {
  border-bottom: none;
}

.section-title {
  margin: 0 0 1.5rem 0;
  color: var(--text-primary, #333);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title i {
  color: var(--primary-color, #4A90E2);
  font-size: 1rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.stat-card {
  background: var(--accent-bg, #f8f9fa);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
}

.stat-card:hover {
  background: var(--hover-bg, #f0f0f0);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-color, #4A90E2);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary, #333);
  margin-bottom: 0.25rem;
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary, #666);
  font-weight: 500;
}

/* Progress Section */
.progress-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.progress-item {
  background: var(--accent-bg, #f8f9fa);
  border-radius: 8px;
  padding: 1.25rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-weight: 500;
  color: var(--text-primary, #333);
}

.progress-numbers {
  font-size: 0.875rem;
  color: var(--text-secondary, #666);
  font-weight: 600;
}

.progress-bar-container {
  height: 8px;
  background: var(--border-color, #e0e0e0);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color, #4A90E2), #66BB6A);
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.time-breakdown {
  margin-top: 0.5rem;
}

.text-muted {
  color: var(--text-secondary, #666) !important;
  font-size: 0.8125rem;
}

/* Recent Sessions */
.recent-sessions {
  min-height: 100px;
}

.no-sessions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary, #666);
  font-style: italic;
  background: var(--accent-bg, #f8f9fa);
  border-radius: 8px;
  border: 2px dashed var(--border-color, #e0e0e0);
}

.no-sessions i {
  font-size: 1.5rem;
  color: var(--text-muted, #999);
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--accent-bg, #f8f9fa);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-color, #e0e0e0);
  transition: all 0.2s ease;
}

.session-item:hover {
  background: var(--hover-bg, #f0f0f0);
  transform: translateX(4px);
}

.session-item:last-child {
  margin-bottom: 0;
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.session-title {
  font-weight: 600;
  color: var(--text-primary, #333);
}

.session-date {
  font-size: 0.8125rem;
  color: var(--text-secondary, #666);
}

.session-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.session-accuracy {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--success-color, #28a745);
  background: rgba(40, 167, 69, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* Achievements */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.achievement-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary, #666);
  background: var(--accent-bg, #f8f9fa);
  border-radius: 8px;
  border: 2px dashed var(--border-color, #e0e0e0);
}

.achievement-placeholder i {
  font-size: 2rem;
  color: var(--primary-color, #4A90E2);
  opacity: 0.7;
}

/* Modal Footer */
.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border-color, #e0e0e0);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  background: var(--accent-bg, #f8f9fa);
  border-radius: 0 0 12px 12px;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color, #4A90E2);
  color: white;
}

.btn-primary:hover {
  background: #357ABD;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-secondary {
  background: var(--secondary-bg, #f8f9fa);
  color: var(--text-primary, #333);
  border: 1px solid var(--border-color, #e0e0e0);
}

.btn-secondary:hover {
  background: var(--hover-bg, #f0f0f0);
  border-color: var(--border-hover, #d0d0d0);
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .dashboard-content {
    width: 95%;
    max-height: 95vh;
    margin: 1rem;
  }
  
  .modal-header,
  .dashboard-section,
  .modal-footer {
    padding: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .progress-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .session-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
  }
  
  .session-stats {
    align-items: flex-start;
    width: 100%;
  }
  
  .modal-footer {
    flex-direction: column-reverse;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .dashboard-content {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }
  
  .modal-title {
    font-size: 1.25rem;
  }
  
  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  .stat-number {
    font-size: 1.25rem;
  }
  
  .stat-label {
    font-size: 0.8125rem;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .dashboard-content {
    background: var(--card-bg-dark, #2d2d2d);
    color: var(--text-primary-dark, #e0e0e0);
  }
  
  .modal-header,
  .modal-footer {
    background: var(--accent-bg-dark, #404040);
    border-color: var(--border-color-dark, #555);
  }
  
  .stat-card,
  .progress-item,
  .session-item,
  .achievement-placeholder,
  .no-sessions {
    background: var(--accent-bg-dark, #404040);
    border-color: var(--border-color-dark, #555);
  }
  
  .stat-card:hover,
  .session-item:hover {
    background: var(--hover-bg-dark, #4a4a4a);
  }
  
  .progress-bar-container {
    background: var(--border-color-dark, #555);
  }
}

/* Animation for modal appearance */
.dashboard-modal {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.3s ease;
}

.dashboard-modal[style*="display: flex"] {
  opacity: 1;
  transform: scale(1);
}

/* Focus styles for accessibility */
.modal-close-button:focus,
.btn:focus {
  outline: 2px solid var(--primary-color, #4A90E2);
  outline-offset: 2px;
}