/* =========================================================
   EklavyaX — MY COURSES
   Responsive Student Course Page
   ========================================================= */

:root {
  --board: #0b1c15;
  --board-dark: #07140f;
  --board-surface: #10271d;

  --chalk: #f5f0e2;
  --chalk-dim: #a9bdae;

  --marigold: #eeb43e;
  --marigold-dark: #d4982a;
  --terracotta: #d97a5c;

  --paper: #f3ead4;
  --paper-soft: #eae0c8;

  --ink: #2a3b4d;
  --ink-soft: #5a6b78;

  --accent-green: #22c55e;
  --accent-blue: #3b82f6;

  --font-body: 'Work Sans', sans-serif;
  --font-heading: 'Kalam', cursive;
}

/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(
      1000px 600px at 50% -10%,
      rgba(255, 255, 255, 0.035),
      transparent 60%
    ),
    radial-gradient(
      800px 500px at 90% 100%,
      rgba(0, 0, 0, 0.3),
      transparent 60%
    ),
    linear-gradient(
      135deg,
      #081a12 0%,
      #0d2419 50%,
      #07160f 100%
    );

  color: var(--chalk);
  font-family: var(--font-body);
}

/* =========================================================
   MAIN CONTAINER
   ========================================================= */

.container {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* =========================================================
   SIDEBAR - DESKTOP
   ========================================================= */

.sidebar,
aside.sidebar {
  position: fixed;
  top: 0;
  left: 0;

  width: 240px;
  min-width: 240px;
  height: 100vh;

  z-index: 100;

  display: flex;
  flex-direction: column;

  background:
    linear-gradient(
      180deg,
      #10271d 0%,
      #091a13 100%
    );

  border-right: 1px dashed rgba(245, 240, 226, 0.15);

  box-shadow:
    8px 0 30px rgba(0, 0, 0, 0.3);

  overflow: hidden;
}

/* =========================================================
   LOGO
   ========================================================= */

.sidebar .logo,
aside .logo {
  display: flex;
  align-items: center;

  gap: 10px;

  padding: 22px 18px 18px;

  flex-shrink: 0;
}

.sidebar .logo img,
aside .logo img {
  width: 34px;
  height: 34px;

  max-width: 34px;
  max-height: 34px;

  object-fit: contain;

  flex-shrink: 0;
}

.sidebar .logo-text,
aside .logo-text {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;

  color: var(--marigold);

  white-space: nowrap;
}

/* =========================================================
   NAVIGATION
   ========================================================= */

nav.menu {
  flex: 1;

  display: flex;
  flex-direction: column;

  gap: 4px;

  padding: 8px 10px;

  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;
}

nav.menu a {
  display: flex;
  align-items: center;

  width: 100%;
  min-width: 0;

  gap: 12px;

  padding: 10px 12px;

  border-radius: 10px;

  color: var(--chalk-dim);

  font-size: 0.82rem;
  font-weight: 600;

  text-decoration: none;

  white-space: nowrap;

  transition: 0.2s ease;
}

nav.menu a i {
  width: 18px;
  min-width: 18px;

  text-align: center;

  font-size: 0.9rem;
}

nav.menu a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--chalk);
}

nav.menu a.active {
  background:
    linear-gradient(
      135deg,
      var(--paper),
      var(--paper-soft)
    );

  color: var(--ink);

  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2);
}

nav.menu a.active i {
  color: var(--terracotta);
}

/* =========================================================
   PROFILE
   ========================================================= */

aside .profile {
  display: flex;
  align-items: center;

  gap: 10px;

  margin: 10px;

  padding: 10px;

  min-width: 0;

  background: rgba(255, 255, 255, 0.035);

  border: 1px dashed rgba(245, 240, 226, 0.15);

  border-radius: 12px;

  flex-shrink: 0;
}

aside .profile img {
  width: 38px;
  height: 38px;

  min-width: 38px;

  border-radius: 50%;

  border: 2px solid var(--marigold);

  object-fit: cover;
}

aside .profile-info {
  min-width: 0;
}

aside .profile-info strong {
  display: block;

  color: var(--chalk);

  font-size: 0.82rem;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

aside .profile-info span {
  display: block;

  margin-top: 2px;

  color: var(--terracotta);

  font-size: 0.7rem;
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */

.content {
  width: calc(100% - 240px);

  min-width: 0;
  min-height: 100vh;

  margin-left: 240px;

  padding: 30px 32px 50px;

  display: flex;
  flex-direction: column;

  gap: 24px;

  overflow-x: hidden;
}

/* =========================================================
   COURSES SECTION
   ========================================================= */

.courses {
  width: 100%;
  min-width: 0;

  background:
    repeating-linear-gradient(
      transparent,
      transparent 27px,
      rgba(60, 45, 20, 0.08) 28px
    ),
    linear-gradient(
      145deg,
      var(--paper),
      var(--paper-soft)
    );

  border-radius: 20px;

  padding: 24px;

  box-shadow:
    0 12px 35px rgba(0, 0, 0, 0.2);
}

/* =========================================================
   COURSES HEADER
   ========================================================= */

.courses > div:first-child {
  width: 100%;
  min-width: 0;
}

.courses h2 {
  margin: 0;

  color: var(--ink);

  font-family: var(--font-heading);

  font-size: 1.6rem;
  line-height: 1.2;
}

.courses p {
  color: var(--ink-soft);
}

/* =========================================================
   BADGE
   ========================================================= */

.badge {
  display: inline-flex;
  align-items: center;

  padding: 5px 10px;

  border-radius: 999px;

  font-size: 0.7rem;
  font-weight: 800;

  white-space: nowrap;
}

.badge-cs {
  background: rgba(238, 180, 62, 0.18);
  color: #9b6810;

  border: 1px solid rgba(238, 180, 62, 0.35);
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn-primary,
.btn-secondary {
  display: inline-flex;

  align-items: center;
  justify-content: center;

  gap: 7px;

  border-radius: 10px;

  cursor: pointer;

  font-family: var(--font-body);

  transition: 0.2s ease;

  text-align: center;

  white-space: normal;
}

.btn-primary {
  background:
    linear-gradient(
      135deg,
      var(--marigold),
      var(--terracotta)
    );

  color: white;

  border: none;

  font-weight: 800;

  box-shadow:
    0 5px 14px rgba(217, 122, 92, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn-secondary {
  background: rgba(16, 39, 29, 0.95);

  color: var(--chalk);

  border: 1px solid rgba(238, 180, 62, 0.3);
}

.btn-secondary:hover {
  background: #163426;
}

/* =========================================================
   COURSES GRID
   ========================================================= */

.courses-grid {
  display: grid;

  width: 100%;
  min-width: 0;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 18px;

  margin-top: 22px;
}

/* =========================================================
   COURSE CARD
   ========================================================= */

.course-card {
  width: 100%;
  min-width: 0;

  display: flex;
  flex-direction: column;

  padding: 18px;

  background:
    linear-gradient(
      145deg,
      #132b20,
      #0b1d15
    );

  border: 1px solid rgba(245, 240, 226, 0.13);

  border-radius: 16px;

  color: var(--chalk);

  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.2);

  overflow: hidden;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.course-card:hover {
  transform: translateY(-4px);

  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.28);
}

/* =========================================================
   COURSE CARD CONTENT
   ========================================================= */

.course-card h3 {
  margin: 0 0 6px;

  color: var(--chalk);

  font-size: 1rem;

  line-height: 1.3;

  overflow-wrap: anywhere;
}

.course-card p {
  color: var(--chalk-dim);

  font-size: 0.78rem;

  line-height: 1.5;

  overflow-wrap: anywhere;
}

.course-card img {
  width: 100%;
  max-width: 100%;

  height: 150px;

  object-fit: cover;

  border-radius: 12px;

  margin-bottom: 12px;
}

/* =========================================================
   COURSE META
   ========================================================= */

.course-meta {
  display: flex;

  flex-wrap: wrap;

  gap: 8px;

  margin: 10px 0;

  color: var(--chalk-dim);

  font-size: 0.75rem;
}

.course-meta span {
  min-width: 0;
}

/* =========================================================
   PROGRESS
   ========================================================= */

.progress-bar {
  width: 100%;

  height: 7px;

  background: rgba(255, 255, 255, 0.1);

  border-radius: 999px;

  overflow: hidden;

  margin: 8px 0 5px;
}

.progress-fill {
  height: 100%;

  border-radius: 999px;

  background:
    linear-gradient(
      90deg,
      #3b82f6,
      #60a5fa
    );
}

/* =========================================================
   COURSE CARD BUTTONS
   ========================================================= */

.course-card .btn-primary,
.course-card .btn-secondary {
  width: 100%;

  margin-top: 8px;

  padding: 10px 12px;

  font-size: 0.78rem;
}

/* =========================================================
   CATALOG / EXPLORE COURSES FILTER BAR & TABS
   ========================================================= */

.catalog-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 22px;
  width: 100%;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 480px;
}

.search-box i {
  position: absolute;
  left: 14px;
  color: var(--chalk-dim);
  font-size: 0.95rem;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  background: rgba(16, 39, 29, 0.9);
  border: 1px solid rgba(245, 240, 226, 0.18);
  border-radius: 12px;
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 0.88rem;
  outline: none;
  transition: 0.2s ease;
}

.search-box input:focus {
  border-color: var(--marigold);
  box-shadow: 0 0 0 3px rgba(238, 180, 62, 0.2);
  background: rgba(16, 39, 29, 1);
}

.search-box input::placeholder {
  color: var(--chalk-dim);
  opacity: 0.7;
}

.catalog-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.catalog-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: rgba(16, 39, 29, 0.85);
  border: 1px solid rgba(245, 240, 226, 0.15);
  border-radius: 10px;
  color: var(--chalk-dim);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.catalog-tab:hover {
  background: rgba(16, 39, 29, 0.98);
  color: var(--chalk);
  border-color: rgba(238, 180, 62, 0.35);
}

.catalog-tab.active {
  background: linear-gradient(135deg, var(--marigold), var(--terracotta));
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(238, 180, 62, 0.25);
}

/* =========================================================
   COURSE CARD RICH HEADER & ACTIONS
   ========================================================= */

.course-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.course-icon-wrap {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(238, 180, 62, 0.2), rgba(217, 122, 92, 0.15));
  border: 1px solid rgba(238, 180, 62, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--marigold);
  font-size: 1.2rem;
}

.course-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.course-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--marigold);
  font-size: 0.8rem;
  font-weight: 700;
}

.course-desc {
  color: var(--chalk-dim);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 6px 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.course-actions .btn-primary,
.course-actions .btn-secondary {
  margin-top: 0;
  padding: 9px 12px;
  font-size: 0.8rem;
}

.enrolled-btn {
  border-color: #4ade80 !important;
  color: #4ade80 !important;
  background: rgba(34, 197, 94, 0.12) !important;
}

.enrolled-btn:hover {
  background: rgba(34, 197, 94, 0.22) !important;
}

/* Badges for subjects */
.badge-math { background: rgba(59, 130, 246, 0.2); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35); }
.badge-physics { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.35); }
.badge-chemistry { background: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.35); }
.badge-biology { background: rgba(34, 197, 94, 0.2); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.35); }
.badge-humanities { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.35); }

/* =========================================================
   CATALOG SECTION
   ========================================================= */

.catalog-section {
  width: 100%;
  min-width: 0;
  background:
    linear-gradient(
      145deg,
      #132b20,
      #0b1d15
    );

  border:
    1px dashed rgba(245, 240, 226, 0.18);

  border-radius: 18px;

  color: var(--chalk);

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.18);
}

.catalog-section h3 {
  color: var(--chalk) !important;

  line-height: 1.3;
}

.catalog-section p {
  color: var(--chalk-dim) !important;

  line-height: 1.5;
}

/* =========================================================
   MODALS
   ========================================================= */

.app-modal {
  position: fixed;

  inset: 0;

  z-index: 2000;

  display: none;

  align-items: center;
  justify-content: center;

  padding: 20px;

  background:
    rgba(5, 15, 10, 0.9);

  backdrop-filter: blur(8px);

  overflow-y: auto;
}

.app-modal.show,
.app-modal.active {
  display: flex;
}

.modal-card {
  width: 100%;

  max-width: 720px;

  max-height: calc(100vh - 40px);

  overflow-y: auto;

  background:
    linear-gradient(
      145deg,
      #132b20,
      #0b1d15
    );

  border:
    1px solid rgba(245, 240, 226, 0.15);

  border-radius: 18px;

  padding: 22px;

  color: var(--chalk);

  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 15px;

  margin-bottom: 18px;
}

.modal-header h2 {
  color: var(--chalk);

  font-family: var(--font-heading);

  line-height: 1.2;
}

.close-modal {
  width: 38px;
  height: 38px;

  min-width: 38px;

  border: none;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.08);

  color: white;

  font-size: 24px;

  cursor: pointer;
}

/* =========================================================
   RESPONSIVE DESIGN (DESKTOP & TABLET)
   ========================================================= */

@media (max-width: 1100px) {
  .content {
    padding: 24px;
  }

  .courses-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================================================
   MOBILE RESPONSIVE (PHONES: <= 768px)
   ========================================================= */

@media (max-width: 768px) {
  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .container {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* -----------------------------
     MOBILE SIDEBAR
     ----------------------------- */

  .sidebar,
  aside.sidebar,
  .container > .sidebar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    display: block !important;
    overflow: visible !important;
    border-right: none !important;
    border-bottom: 1px dashed rgba(245, 240, 226, 0.15) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25) !important;
  }

  .sidebar .logo,
  aside .logo,
  .container > .sidebar .logo {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 12px 16px !important;
  }

  .sidebar .logo img,
  aside .logo img,
  .container > .sidebar .logo img {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 !important;
  }

  .sidebar .logo-text,
  aside .logo-text,
  .container > .sidebar .logo-text {
    font-size: 1.25rem !important;
    white-space: nowrap !important;
  }

  /* Horizontal scrolling navigation on phones */
  nav.menu {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 8px !important;
    padding: 4px 12px 12px !important;
    flex: none !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch;
  }

  nav.menu::-webkit-scrollbar {
    display: none !important;
  }

  nav.menu a {
    width: auto !important;
    min-width: max-content !important;
    padding: 8px 14px !important;
    gap: 7px !important;
    font-size: 0.76rem !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    transform: none !important;
  }

  nav.menu a i {
    width: auto !important;
    min-width: auto !important;
    font-size: 0.85rem !important;
  }

  aside .profile {
    display: none !important;
  }

  /* -----------------------------
     MOBILE MAIN CONTENT
     ----------------------------- */

  .content,
  main.content,
  .container > .content {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    padding: 16px 14px 40px !important;
    gap: 16px !important;
    overflow-x: hidden !important;
  }

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

  .explore-more-btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 11px 16px !important;
  }

  /* -----------------------------
     CATALOG FILTER BAR & TABS ON MOBILE
     ----------------------------- */

  .catalog-filter-bar {
    gap: 12px !important;
    margin-bottom: 16px !important;
  }

  .search-box {
    max-width: 100% !important;
  }

  .catalog-tabs {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    padding-bottom: 4px !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch;
  }

  .catalog-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .catalog-tab {
    flex-shrink: 0 !important;
    padding: 7px 12px !important;
    font-size: 0.76rem !important;
  }

  /* -----------------------------
     COURSES & GRID
     ----------------------------- */

  .courses {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 16px 14px !important;
    border-radius: 16px !important;
  }

  .courses-grid {
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    margin-top: 14px !important;
  }

  .course-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 16px !important;
    border-radius: 14px !important;
  }

  .course-card h3 {
    font-size: 0.95rem !important;
  }

  .course-card p {
    font-size: 0.76rem !important;
  }

  .course-actions {
    grid-template-columns: 1fr auto !important;
  }

  /* -----------------------------
     MODALS
     ----------------------------- */

  .app-modal {
    padding: 12px !important;
  }

  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px !important;
    border-radius: 14px !important;
  }
}

/* =========================================================
   EXTRA SMALL PHONES (<= 480px)
   ========================================================= */

@media (max-width: 480px) {
  nav.menu a {
    padding: 7px 11px !important;
    font-size: 0.72rem !important;
  }

  .content,
  main.content,
  .container > .content {
    padding: 12px 10px 35px !important;
  }

  .courses {
    padding: 14px 10px !important;
  }

  .courses h1,
  .page-title-row h1 {
    font-size: 1.3rem !important;
  }

  .course-actions {
    grid-template-columns: 1fr !important;
  }
}
