/* Dashboard Styles */
:root {
  --bg: #1b1410;
  --bg-soft: #241a15;
  --card: #2c211b;
  --card-glow: rgba(255, 132, 43, 0.18);
  --accent: #ff7a1a;
  --accent-2: #ff9a3c;
  --text: #f5eee7;
  --muted: #b8a99e;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at 15% 20%, #2a1d16, #1b1410 60%);
  color: var(--text);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #1a120e;
  border-right: 1px solid var(--border);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar-small {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #2b2019;
  display: grid;
  place-items: center;
  font-size: 22px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.profile-avatar-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-profile h2 {
  font-size: 16px;
  font-weight: 600;
}

.sidebar-profile p {
  font-size: 12px;
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-nav a {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
  color: #111;
  background: var(--accent);
}

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

.main-content {
  padding: 28px 32px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.brand-pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}

.topbar-title h1 {
  font-size: 30px;
  margin-bottom: 6px;
}

.topbar-title p {
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.3);
}

#cardCourses {
  background: linear-gradient(135deg, #3a2317 0%, #5a2b12 55%, #7a3715 100%);
  border-color: rgba(255, 154, 60, 0.5);
  box-shadow: 0 18px 34px rgba(255, 122, 26, 0.22);
}

#cardCourses .card-head h3 {
  color: #ffd6b0;
}

#cardCourses .loading {
  color: #ffe7d2;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-head h3 {
  font-size: 16px;
}

.card-action {
  color: var(--muted);
}

.card-stat {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.card-label {
  color: var(--muted);
  font-size: 12px;
}

.card-value {
  font-size: 22px;
  font-weight: 700;
}

.progress-bar {
  height: 8px;
  background: #3a2d25;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.card-foot {
  color: var(--muted);
  font-size: 13px;
}

.activity-list {
  list-style: none;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.activity-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.activity-icon {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  flex: 0 0 12px;
  display: inline-block;
}

.activity-icon::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--accent);
  border-top: 2px solid var(--accent);
  transform: rotate(45deg);
  margin-left: 1px;
  box-shadow: 0 0 10px rgba(255, 122, 26, 0.35);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 120px;
}

.bars div {
  flex: 1;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.bars span {
  display: block;
  width: 100%;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent), #5a2d12);
}

.bars label {
  font-size: 12px;
  color: var(--muted);
}

.card-note {
  color: var(--muted);
  font-size: 13px;
}

.courses-container {
  display: grid;
  gap: 10px;
}

.loading {
  color: var(--muted);
}

.btn {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: 100%;
}

@media (max-width: 1100px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .sidebar-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    display: grid;
    gap: 8px;
  }

  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 700px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }
}

.course-card-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 20px;
  color: white;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.course-card-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.course-card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.course-card-meta {
  font-size: 12px;
  opacity: 0.9;
}

.course-card-body {
  padding: 20px;
}

.course-progress-section {
  margin-bottom: 16px;
}

.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  min-width: 35px;
  text-align: right;
}

.course-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.course-stat-item {
  font-size: 13px;
  color: var(--text-light);
}

.course-stat-label {
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
}

.course-stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
}

.course-card-footer {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.course-card-footer button {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-view {
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--border);
}

.btn-view:hover {
  background: var(--primary);
  color: white;
}

.btn-resume {
  background: var(--primary);
  color: white;
}

.btn-resume:hover {
  background: var(--primary-dark);
}

/* Loading State */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 16px;
}

.loading::after {
  content: " ...";
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { color: rgba(0, 0, 0, 0); }
  40%, 60% { color: var(--text-light); }
  80%, 100% { color: rgba(0, 0, 0, 0); }
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.modal.active ~ .modal-overlay {
  display: block;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-light);
  cursor: pointer;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.modal-close:hover {
  color: var(--text);
  transform: rotate(90deg);
}

/* Course Modal */
.modal-course {
  max-width: 700px;
}

.course-modal-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 30px;
  border-radius: 12px 12px 0 0;
}

.course-header-info h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.course-roadmap-container {
  padding: 30px;
  max-height: 400px;
  overflow-y: auto;
}

.course-roadmap-container .path {
  position: relative;
  width: 100%;
  min-height: 300px;
}

.course-modal-footer {
  padding: 20px 30px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* Roadmap in Modal */
.path:before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 10px;
  height: 100%;
  border-radius: 999px;
  background: rgba(255, 102, 0, 0.1);
}

.node {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 50px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  font-weight: 600;
  font-size: 16px;
}

.node:hover {
  transform: translateX(-50%) scale(1.05);
  filter: brightness(0.95);
}

.node.done {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.node.next {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.node.locked {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f0f0f0;
}

/* Text utilities */
.text-muted {
  color: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
    text-align: center;
  }

  .dashboard-main {
    padding: 20px;
  }

  .courses-container {
    grid-template-columns: 1fr;
  }

  .welcome-section h1 {
    font-size: 24px;
  }

  .modal-content {
    border-radius: 16px 16px 0 0;
    max-height: 95vh;
  }
}
