/* CoursHub Dashboard Styles */
/* Uses consolidated theme tokens from theme.css */
/* Note: theme.css must be loaded before this file */

/* Dark theme body override - More specific to ensure it applies */
html,
body {
  background: var(--color-bg-primary) !important;
  color: var(--color-text-primary) !important;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Ensure no white backgrounds from shared styles */
* {
  box-sizing: border-box;
  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;
}

/* Override shared typography colors for dashboard */
.dashboard-container h1,
.dashboard-container h2,
.dashboard-container h3,
.dashboard-container h4,
.dashboard-container h5,
.dashboard-container h6 {
  color: var(--color-text-primary) !important; /* Force white text */
}

.dashboard-container p {
  color: var(--color-text-secondary) !important; /* Force white text with opacity */
}

/* Ensure all text elements use the correct colors */
.dashboard-container * {
  color: inherit;
}

/* Specific overrides for module cards */
.module-card h3 {
  color: var(--color-text-primary) !important;
}

.module-card p {
  color: var(--color-text-secondary) !important;
}

/* Dashboard Container */
.dashboard-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gradient-bg-secondary);
  position: relative;
}

/* Background overlay for extra depth */
.dashboard-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-radial-ambient);
  pointer-events: none;
  z-index: var(--z-base);
}

/* Dashboard Header */
.dashboard-header {
  background: var(--color-bg-overlay-light);
  border-bottom: 1px solid var(--color-border-primary);
  padding: var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.header-content {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--space-8);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.logo-svg {
  width: var(--size-icon-base);
  height: var(--size-icon-base);
}

.logo-section h1 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-light);
  letter-spacing: var(--letter-spacing-wider);
}

.header-actions {
  display: flex;
  gap: var(--space-2);
}

.icon-button {
  background: transparent;
  border: 1px solid var(--color-border-primary);
  color: var(--color-text-secondary);
  width: var(--size-button-height);
  height: var(--size-button-height);
  border-radius: var(--radius-base);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-base);
}

.icon-button:hover {
  background: var(--color-hover-bg);
  color: var(--color-text-primary);
  border-color: var(--color-border-hover);
}

/* Support Button */
.support-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--white-pure);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  cursor: pointer;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.support-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--white-pure);
}

.support-button:active {
  background: rgba(255, 255, 255, 0.05);
}

/* Dashboard Main */
.dashboard-main {
  flex: 1;
  max-width: var(--container-max-width);
  width: 100%;
  margin: 0 auto;
  padding: var(--space-8);
  position: relative;
  z-index: var(--z-elevated);
}

.welcome-section {
  text-align: center;
  margin-bottom: var(--space-12);
}

.welcome-section h2 {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-light);
  margin-bottom: var(--space-2);
  background: var(--gradient-text-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-section p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xl);
}

/* Module Cards */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-grid-base);
  margin-bottom: var(--space-16);
}

/* Ensure modules don't get too wide on very large screens */
@media (min-width: 1600px) {
  .modules-grid {
    gap: var(--gap-grid-lg);
  }
}

/* Responsive adjustments for modules grid */
@media (max-width: 1200px) {
  .modules-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap-grid-base);
  }
}

@media (max-width: 768px) {
  .modules-grid {
    grid-template-columns: 1fr;
    gap: var(--gap-grid-base);
  }
}

.module-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  transition: var(--transition-moderate);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: var(--size-module-card-min-height);
}

.module-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-color);
  opacity: 0;
  transition: var(--transition-moderate);
}

.module-card[data-module="creator"]::before {
  background: var(--color-accent-canvas);
}

.module-card[data-module="quiz"]::before {
  background: var(--color-accent-quiz);
}

.module-card[data-module="360creator"]::before {
  background: var(--color-accent-360);
}

.module-card[data-module="glossary"]::before {
  background: var(--color-accent-glossary);
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-border-hover);
}

.module-card:hover::before {
  opacity: 1;
}

.module-icon {
  width: var(--size-icon-md);
  height: var(--size-icon-md);
  margin-bottom: var(--space-4);
}

.module-icon-svg {
  width: 100%;
  height: 100%;
}

.module-card h3 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-normal);
  margin-bottom: var(--space-3);
}

.module-card p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
  line-height: var(--line-height-snug);
  font-size: var(--font-size-base);
}

.module-features {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.feature-tag {
  background: var(--color-bg-tertiary);
  color: var(--color-text-tertiary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  border: 1px solid var(--color-border-primary);
}

.module-launch-btn {
  width: 100%;
  background: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-primary);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-base);
  font-size: var(--font-size-lg);
  cursor: pointer;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: auto;
}

.module-card[data-module="creator"] .module-launch-btn:hover {
  background: var(--color-accent-canvas);
  border-color: var(--color-accent-canvas);
  color: var(--white-pure) !important;
}

.module-card[data-module="quiz"] .module-launch-btn:hover {
  background: var(--color-accent-quiz);
  border-color: var(--color-accent-quiz);
  color: var(--white-pure) !important;
}

.module-card[data-module="360creator"] .module-launch-btn:hover {
  background: var(--color-accent-360);
  border-color: var(--color-accent-360);
  color: var(--white-pure) !important;
}

.module-card[data-module="glossary"] .module-launch-btn:hover {
  background: var(--color-accent-glossary);
  border-color: var(--color-accent-glossary);
  color: var(--white-pure) !important;
}

/* Recent Projects */
.recent-section {
  margin-bottom: var(--space-8);
}

.recent-section h3 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-light);
  margin-bottom: var(--space-6);
}

.recent-projects {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-md);
  padding: var(--space-8);
}

.no-projects {
  text-align: center;
  color: var(--color-text-tertiary);
}

/* Dashboard Footer */
.dashboard-footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border-primary);
  padding: var(--space-8);
  text-align: center;
  position: relative;
  z-index: var(--z-elevated);
}

.dashboard-footer p {
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-4);
}

.footer-links {
  display: flex;
  gap: var(--space-8);
  justify-content: center;
}

.footer-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: var(--transition-colors);
}

.footer-links a:hover {
  color: var(--color-text-primary);
}

/* Dashboard Responsive */
@media (max-width: 768px) {
  .dashboard-main {
    padding: var(--space-4);
  }

  .welcome-section h2 {
    font-size: var(--font-size-4xl);
  }

  .module-card {
    padding: var(--space-6);
  }

  .footer-links {
    flex-direction: column;
    gap: var(--space-4);
  }
}

/* Dashboard Loading Animation */
@keyframes pulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Saved list button colors (ensure visible, override any conflicting styles) */
.saved-list .ch-btn-primary {
  background: var(--color-primary) !important;
  color: var(--white-pure) !important;
  border: 0 !important;
}
.saved-list .ch-btn-primary:hover {
  background: var(--color-primary-hover) !important;
}
.saved-list .ch-btn-danger {
  background: var(--color-danger) !important;
  color: var(--white-pure) !important;
  border: 0 !important;
}
.saved-list .ch-btn-danger:hover {
  background: var(--color-danger-hover) !important;
}

/* Rounded corners to match app buttons */
.saved-list .ch-btn {
  border-radius: var(--radius-base) !important;
}

/* Improve saved-list button hover/focus interactions */
.saved-list .ch-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-tight);
  min-height: var(--size-button-height-sm);
  cursor: pointer;
  box-sizing: border-box;
  transition:
    var(--transition-fast),
    box-shadow var(--duration-fast) ease,
    transform var(--duration-instant) ease;
}
.saved-list .ch-btn:hover {
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}
.saved-list .ch-btn:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 2px var(--color-focus-ring) !important;
}

/* Move only the buttons closer to the title (approx 2px visual gap) */
.saved-list .project-actions {
  margin-top: calc(var(--space-2) * -1) !important;
}
/* Ensure the title doesn't add extra bottom margin so gap is exactly 2px */
.saved-list .project-info h4 {
  margin-bottom: 0 !important;
}
/* Add space between rows so buttons don't bleed into next title */
.saved-list .recent-project-item + .recent-project-item {
  margin-top: var(--space-3);
}

/* Stack buttons directly under the project text (text unchanged) */
.saved-list .recent-project-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Add spacing between Open and Delete buttons */
.saved-list .project-actions {
  display: flex;
  gap: var(--space-4);
}
