/* ============================================================
   ANDROID ACADEMY LMS — RESPONSIVE CSS
   Mobile-first breakpoints: sm(640) md(768) lg(1024) xl(1280)
   ============================================================ */

/* ─────────────────────────────────────────
   NAVBAR RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar__nav { display: none; }
  .navbar__toggle { display: flex; }
  .navbar { position: sticky; }

  /* Hide sign-in/register on mobile, use mobile menu */
  .navbar__actions .btn { display: none; }
  .navbar__actions .theme-toggle,
  .navbar__actions .user-menu { display: flex; }
}

/* ─────────────────────────────────────────
   HERO RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero__grid { grid-template-columns: 1fr; gap: var(--space-10); }
  .hero__visual { display: none; }
  .hero { padding: var(--space-16) 0; }
  .hero__stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .hero { padding: var(--space-12) 0; }
  .hero__stats { grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
  .hero__actions { flex-direction: column; }
  .hero__actions .btn { width: 100%; justify-content: center; }
}

/* ─────────────────────────────────────────
   SECTION RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 768px) {
  .section-py { padding-block: var(--space-12); }
  .section-header { margin-bottom: var(--space-8); }
  .section-header__title { font-size: var(--text-3xl); }
  .section-header__description { font-size: var(--text-base); }
}

@media (max-width: 640px) {
  .section-py { padding-block: var(--space-10); }
}

/* ─────────────────────────────────────────
   GRID RESPONSIVE — Course Cards
───────────────────────────────────────── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

@media (max-width: 1024px) { .courses-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .courses-grid { grid-template-columns: 1fr; } }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .stats-grid { grid-template-columns: 1fr 1fr; } }

/* Benefits grid */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}
@media (max-width: 1024px) { .benefits-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .benefits-grid { grid-template-columns: 1fr; } }

/* Testimonials grid */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}
@media (max-width: 1024px) { .testimonials-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .testimonials-grid { grid-template-columns: 1fr; } }

/* Dashboard stats */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
@media (max-width: 1024px) { .dashboard-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .dashboard-stats { grid-template-columns: 1fr 1fr; } }

/* ─────────────────────────────────────────
   FOOTER RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 1024px) {
  .footer__grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer__grid > *:first-child { grid-column: span 3; }
}

@media (max-width: 768px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: var(--space-8); }
  .footer__grid > *:first-child { grid-column: span 2; }
}

@media (max-width: 640px) {
  .footer__grid { grid-template-columns: 1fr; }
  .footer__grid > *:first-child { grid-column: span 1; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
}

/* ─────────────────────────────────────────
   AUTH PAGES RESPONSIVE
───────────────────────────────────────── */
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
}

.auth-brand-panel {
  background: linear-gradient(135deg, #042F2E 0%, #0D4038 50%, #0C3350 100%);
  color: white;
  padding: var(--space-12) var(--space-10);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 1024px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .auth-panel { padding: var(--space-6) var(--space-4); }
}

.auth-form-container {
  width: 100%;
  max-width: 440px;
}

/* ─────────────────────────────────────────
   DASHBOARD LAYOUT RESPONSIVE
───────────────────────────────────────── */
.dashboard-layout {
  display: flex;
  min-height: calc(100vh - var(--navbar-height));
}

.dashboard-sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
  position: sticky;
  top: var(--navbar-height);
  height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  transition: transform var(--transition-base);
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-8);
  background: var(--color-bg-soft);
}

@media (max-width: 1024px) {
  .dashboard-main { padding: var(--space-6); }
}

@media (max-width: 768px) {
  .dashboard-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0; bottom: 0;
    z-index: var(--z-fixed);
    transform: translateX(-100%);
    box-shadow: var(--shadow-2xl);
  }
  .dashboard-sidebar.open { transform: translateX(0); }
  .dashboard-main { padding: var(--space-4); }
}

/* ─────────────────────────────────────────
   LEARNING PLAYER RESPONSIVE
───────────────────────────────────────── */
.learning-layout {
  display: flex;
  height: calc(100vh - var(--navbar-height));
  overflow: hidden;
}

.learning-sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  transition: transform var(--transition-base);
}

.learning-content {
  flex: 1;
  overflow-y: auto;
  background: var(--color-bg-soft);
}

@media (max-width: 1024px) {
  .learning-sidebar { width: 280px; }
}

@media (max-width: 768px) {
  .learning-layout { flex-direction: column; height: auto; }
  .learning-sidebar {
    width: 100%; height: auto;
    position: fixed; top: var(--navbar-height);
    left: 0; right: 0; bottom: 0;
    z-index: var(--z-fixed);
    transform: translateX(-100%);
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .learning-sidebar.open { transform: translateX(0); }
  .learning-content { min-height: calc(100vh - var(--navbar-height)); }
}

/* ─────────────────────────────────────────
   ADMIN LAYOUT RESPONSIVE
───────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: calc(100vh - var(--navbar-height));
}

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  position: sticky;
  top: var(--navbar-height);
  height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  transition: transform var(--transition-base);
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-8);
  background: var(--color-bg-soft);
}

@media (max-width: 1024px) {
  .admin-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0; bottom: 0;
    z-index: var(--z-fixed);
    transform: translateX(-100%);
    box-shadow: var(--shadow-2xl);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { padding: var(--space-6); }
}

@media (max-width: 640px) {
  .admin-main { padding: var(--space-4); }
}

/* ─────────────────────────────────────────
   SIDEBAR NAV
───────────────────────────────────────── */
.sidebar-nav { padding: var(--space-4); }

.sidebar-nav__section-title {
  font-size: var(--text-xs); font-weight: var(--font-semibold);
  color: var(--color-text-light); text-transform: uppercase; letter-spacing: 0.1em;
  padding: var(--space-3) var(--space-3) var(--space-2);
  margin-top: var(--space-2);
}

.sidebar-nav__item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: var(--font-medium);
  color: var(--color-text-muted); text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer; background: none; border: none; width: 100%; text-align: left;
}

.sidebar-nav__item:hover { color: var(--color-text); background: var(--color-bg-muted); text-decoration: none; }
.sidebar-nav__item.active { color: var(--color-primary); background: var(--color-primary-50); font-weight: var(--font-semibold); }
.sidebar-nav__item svg { flex-shrink: 0; }
.sidebar-nav__badge {
  margin-left: auto; background: var(--color-primary);
  color: white; font-size: var(--text-xs); font-weight: var(--font-bold);
  padding: 1px 6px; border-radius: var(--radius-full); min-width: 20px; text-align: center;
}

/* ─────────────────────────────────────────
   TABLE RESPONSIVE
───────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border); border-radius: var(--radius-xl);
}

.table {
  width: 100%; border-collapse: collapse; font-size: var(--text-sm);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left; font-weight: var(--font-semibold);
  color: var(--color-text-muted); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--color-bg-soft);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border-soft);
  color: var(--color-text); vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--color-bg-soft); }
.table--striped tbody tr:nth-child(even) { background: var(--color-bg-soft); }

/* ─────────────────────────────────────────
   MODAL RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    max-height: 90vh;
  }
  .modal--lg, .modal--xl { max-width: 100%; }
}

/* ─────────────────────────────────────────
   COURSE DETAIL PAGE RESPONSIVE
───────────────────────────────────────── */
.course-detail-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--space-8);
  align-items: start;
}

@media (max-width: 1024px) {
  .course-detail-layout {
    grid-template-columns: 1fr;
  }
  .course-detail-sidebar { order: -1; }
}

/* ─────────────────────────────────────────
   FILTER BAR RESPONSIVE
───────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
}

@media (max-width: 768px) {
  .filter-bar { gap: var(--space-2); }
  .filter-bar .search-bar { max-width: 100%; width: 100%; }
}

/* ─────────────────────────────────────────
   GENERAL RESPONSIVE UTILITIES
───────────────────────────────────────── */
@media (max-width: 768px) {
  .hide-mobile   { display: none !important; }
  .show-mobile   { display: flex !important; }
  .text-center-mobile { text-align: center; }
  .page-header__title { font-size: var(--text-3xl); }
}

@media (min-width: 769px) {
  .show-mobile { display: none !important; }
}

@media (max-width: 640px) {
  .hide-sm { display: none !important; }
}

/* Two-column to one-column helpers */
.col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.col-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-6); }

@media (max-width: 768px) {
  .col-2, .col-3 { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────
   TOAST RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 640px) {
  .toast-container {
    bottom: 0; left: 0; right: 0;
    max-width: 100%;
    width: 100%;
    padding: var(--space-4);
  }
}
