/**
 * LMS — mobile & tablet responsive styles
 */

/* ---- Global ---- */
html {
  -webkit-text-size-adjust: 100%;
}

img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

.lms-app main,
.lms-page {
  overflow-x: hidden;
}

/* Touch-friendly controls */
@media (max-width: 767.98px) {
  .btn,
  .nav-link,
  .form-control,
  .form-select {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 38px;
  }

  h1, .h1 { font-size: 1.75rem; }
  h2, .h2 { font-size: 1.5rem; }
  h3, .h3 { font-size: 1.25rem; }

  .container,
  .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .card-body {
    padding: 1rem;
  }

  .modal-dialog {
    margin: 0.75rem;
  }

  .table {
    font-size: 0.875rem;
  }
}

/* ---- Navbar ---- */
@media (max-width: 991.98px) {
  .navbar .navbar-brand {
    font-size: 0.95rem;
    max-width: calc(100vw - 120px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navbar-collapse {
    padding-top: 0.75rem;
    padding-bottom: 0.5rem;
  }

  .navbar-nav .nav-link {
    padding: 0.65rem 0.25rem;
  }

  .navbar-nav .dropdown-menu {
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  }
}

/* ---- Page headers (stack on mobile) ---- */
.lms-page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.lms-page-header .lms-page-header__main {
  flex: 1 1 100%;
  min-width: 0;
}

.lms-page-header .lms-page-header__aside {
  flex: 1 1 100%;
  width: 100%;
}

@media (min-width: 768px) {
  .lms-page-header .lms-page-header__main {
    flex: 1 1 auto;
  }

  .lms-page-header .lms-page-header__aside {
    flex: 0 0 auto;
    width: auto;
    text-align: right;
  }
}

.lms-progress-wrap {
  width: 100%;
  max-width: 280px;
}

@media (max-width: 767.98px) {
  .lms-progress-wrap {
    max-width: 100%;
  }

  .lms-progress-wrap .progress {
    width: 100% !important;
    height: 22px !important;
  }
}

/* ---- Dashboard sidebar ---- */
.lms-sidebar {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  margin-bottom: 1rem;
}

.lms-sidebar .nav-link {
  color: #334155;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
}

.lms-sidebar .nav-link:hover,
.lms-sidebar .nav-link.active {
  background: linear-gradient(135deg, var(--lms-primary), var(--lms-secondary));
  color: #fff;
}

@media (max-width: 991.98px) {
  .lms-sidebar .nav {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .lms-sidebar .nav-item {
    flex: 1 1 auto;
  }

  .lms-sidebar .nav-link {
    text-align: center;
    font-size: 0.875rem;
    white-space: nowrap;
  }

  .lms-sidebar h5 {
    width: 100%;
    margin-bottom: 0.75rem;
  }
}

/* ---- Course cards & grids ---- */
@media (max-width: 575.98px) {
  .course-card-actions .btn {
    width: 100%;
  }

  .lesson-card .card-title {
    font-size: 0.95rem;
  }

  .lesson-card .d-flex.justify-content-between {
    flex-direction: column;
    gap: 0.5rem;
  }

  .lesson-card .badge {
    align-self: flex-start;
  }
}

/* ---- Auth (login / register) ---- */
@media (max-width: 575.98px) {
  .auth-wrap {
    padding: 1rem;
    align-items: flex-start !important;
    padding-top: 2rem !important;
  }

  .auth-card {
    padding: 1.5rem 1.25rem !important;
    border-radius: 16px !important;
    margin-bottom: 1rem;
  }

  body .glow {
    width: 280px !important;
    height: 280px !important;
    top: -80px !important;
    right: -80px !important;
  }
}

/* ---- Homepage ---- */
body.lms-home .hero {
  height: 450px;
  min-height: 450px;
  max-height: 450px;
  padding: 3.5rem 1rem 2.5rem;
}

body.lms-home .hero h1 {
  font-size: clamp(1.5rem, 6vw, 3rem);
}

body.lms-home .hero p {
  font-size: clamp(0.95rem, 3.5vw, 1.2rem);
  padding: 0 0.5rem;
}

body.lms-home .hero .mt-4 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

body.lms-home .hero .btn {
  width: 100%;
  max-width: 280px;
  margin: 0 !important;
}

body.lms-home .home-top-nav {
  top: 12px;
  right: 12px;
  left: 12px;
}

body.lms-home .home-btn,
body.lms-home .home-nav-btn {
  padding: 8px 14px;
  font-size: 0.8rem;
}

body.lms-home .hero-dots {
  bottom: 16px;
}

body.lms-home .glow {
  width: 320px;
  height: 320px;
  top: -120px;
  right: -100px;
}

body.lms-home .section-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

body.lms-home section.container {
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 576px) {
  body.lms-home .hero .mt-4 {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }

  body.lms-home .hero .btn {
    width: auto;
    max-width: none;
  }
}

/* ---- Profile ---- */
@media (max-width: 575.98px) {
  body.lms-profile .profile-img {
    width: 110px;
    height: 110px;
    margin-top: -55px;
  }

  body.lms-profile .cover {
    height: 90px;
  }

  body.lms-profile .card {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }
}

/* ---- Admin panel ---- */
body.lms-admin .container {
  max-width: 100%;
}

@media (max-width: 575.98px) {
  body.lms-admin .admin-top-bar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 1rem;
  }

  body.lms-admin .admin-toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  body.lms-admin .admin-top-bar .admin-toolbar-actions .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 0.25rem);
  }
}

body.lms-admin .admin-nav-pills {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 0.25rem;
  margin-bottom: 1rem !important;
}

body.lms-admin .admin-nav-pills .nav-item {
  flex-shrink: 0;
}

body.lms-admin .admin-nav-pills .nav-link {
  white-space: nowrap;
  font-size: 0.875rem;
  padding: 0.5rem 0.85rem;
}

body.lms-admin .table-responsive {
  margin: 0 -0.25rem;
  border-radius: 8px;
}

body.lms-admin img.course-thumbnail {
  max-width: 80px;
  max-height: 60px;
}

@media (max-width: 991.98px) {
  body.lms-admin .row.g-4 > [class*="col-md-4"],
  body.lms-admin .row.g-4 > [class*="col-md-8"],
  body.lms-admin .row.g-3 > [class*="col-md-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  body.lms-admin .d-flex.justify-content-between.align-items-center:not(.admin-top-bar) {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.5rem;
  }

  body.lms-admin .btn-group {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  body.lms-admin .btn-group .btn {
    width: 100%;
    margin-bottom: 0.25rem;
  }
}

@media (max-width: 767.98px) {
  body.lms-admin .table thead {
    font-size: 0.75rem;
  }

  body.lms-admin .table td .btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* ---- Utilities ---- */
@media (max-width: 767.98px) {
  .d-flex.flex-mobile-column {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .w-100-mobile {
    width: 100% !important;
  }

  .text-center-mobile {
    text-align: center !important;
  }

  .gap-mobile-2 {
    gap: 0.5rem !important;
  }
}
