/* ==========================================================================
   31_mobile.css — mobile + tablet layout fixes (Claude, 2026-11-17)
   Loaded after every other file in /css (alphabetical order), so it only adds
   overrides. Desktop (> 1100px) is untouched except the language/level menu.
   ========================================================================== */

/* ---------- Language & level menu (the "Nyelv és szint kiválasztása" dropdown), all widths ---------- */
nav .dropdown .dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  white-space: normal;
  border-radius: 10px;
  font-weight: 600;
}
nav .dropdown .dropdown-menu {
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(40, 20, 80, 0.35);
}
nav .dropdown .dropdown-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7057a5;
  border-top: 1px solid #eee;
}
nav .dropdown .dropdown-header:first-child {
  border-top: 0;
}
nav .dropdown .dropdown-header img {
  height: 12px;
  border-radius: 2px;
}
nav .dropdown .dropdown-item {
  position: relative;
  padding: 9px 34px 9px 12px !important;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.3;
  white-space: normal;
  color: #202020;
}
nav .dropdown .dropdown-item:hover,
nav .dropdown .dropdown-item:focus {
  background: #f1edf8;
  color: #4b3680;
}
nav .dropdown .dropdown-item.is-current {
  background: #7057a5;
  color: #fff;
  font-weight: 600;
}
nav .dropdown .dropdown-item.is-current::after {
  content: "\2713";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
}

/* ---------- Navigation becomes an off-canvas drawer below 1100px ---------- */
nav .nav-drawer-close {
  display: none;
}
@media (max-width: 1100px) {
  nav {
    display: flex !important; /* 05_portal.js toggles inline display; the drawer uses a class instead */
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100% !important;
    width: 340px;
    max-width: 86vw;
    padding-top: 0 !important;
    z-index: 1060;
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.3);
  }
  body.nav-open nav {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.25s ease, visibility 0s;
  }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(25, 12, 50, 0.5);
    z-index: 1055;
    animation: onycFadeIn 0.2s ease;
  }
  @keyframes onycFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  /* drawer header: small logo + close button (button injected by 31_mobile.js) */
  nav .nav-drawer-close {
    display: block;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 26px;
    line-height: 40px;
    text-align: center;
    padding: 0;
    z-index: 2;
  }
  nav .nav-drawer-close:focus {
    outline: 2px solid #fff;
  }
  nav > div > div:first-child > .text-center:first-child {
    padding-top: 18px;
  }
  nav > div > div:first-child > .text-center:first-child img {
    max-height: 64px;
    width: auto;
  }
  nav .text-center.mt-5 {
    margin-top: 14px !important;
  }

  /* menu items: one comfortable row each */
  nav .nav-buttons {
    margin-top: 12px !important;
  }
  nav .nav-buttons a {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 16px !important;
    min-height: 52px;
    font-size: 15px !important;
    font-weight: 600;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  nav .nav-buttons a span {
    float: none !important;
    flex: 0 0 34px;
    width: 34px !important;
    height: 34px !important;
    margin: 0 !important;
    background-size: auto !important;
    background-position: center center !important;
  }
  nav .nav-buttons a:nth-child(6) span {
    background-size: 20px !important;
  }
  nav .nav-buttons a div {
    float: none !important;
    flex: 1 1 auto;
    padding: 0 !important;
  }
  nav .nav-buttons a i {
    float: none !important;
    margin: 0 !important;
    font-size: 11px;
  }
  nav .nav-buttons a i::before {
    content: "\e080"; /* glyphicon-chevron-right */
  }
  nav .nav-buttons a.active {
    box-shadow: inset 4px 0 0 #f26a28;
  }
  nav .nav-buttons a.active i::before {
    content: "\e080";
  }
  nav .mt-auto a.py-4 {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
  }
  nav .mt-auto p {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }
}

/* ---------- Header: one row on phones and tablets ---------- */
@media (max-width: 1100px) {
  main > header {
    flex-wrap: nowrap !important;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: 56px;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }
  main > header > .d-flex:first-child {
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
  }
  main > header > .d-flex:first-child > .d-flex {
    min-width: 0;
  }
  main > header .nav-toggler {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    margin-left: 4px;
    flex: 0 0 44px;
  }
  main > header .navbar-toggler-icon {
    width: 26px;
    height: 26px;
    background-size: 100% 100%;
    filter: brightness(0.35);
  }
  main > header .font-size-14.font-weight-600 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  main > header > .d-flex.pr-2 {
    flex: 0 0 auto;
    align-items: center;
    padding-right: 6px !important;
  }
  main > header .ml-5.pr-4 {
    margin-left: 8px !important;
    padding-right: 0 !important;
    gap: 2px;
  }
  main > header .head-btn {
    width: 44px;
    height: 44px;
    margin-left: 4px !important;
    justify-content: center;
  }
  main > header .head-btn img {
    margin-left: 0 !important;
  }
  /* 992–1100px: the drawer is active but Bootstrap's d-lg-block labels would still show and overflow */
  main > header .head-btn > .d-lg-block {
    display: none !important;
  }
  main > header .head-btn span {
    right: 0;
    top: 2px;
  }
  .head-search-form {
    min-width: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    width: 220px;
  }
}

@media (max-width: 767px) {
  /* search collapses to a round button and expands over the header when tapped */
  main > header {
    position: sticky;
  }
  .head-search-form {
    width: 44px;
    height: 44px;
    position: relative;
  }
  .head-search-form .search-input {
    width: 44px;
    height: 44px;
    padding: 0 0 0 44px;
    border-radius: 22px;
    color: transparent;
    cursor: pointer;
    transition: width 0.2s ease;
  }
  .head-search-form .search-input::placeholder {
    color: transparent;
  }
  .head-search-form .search-btn {
    position: absolute;
    left: 0;
    top: 0;
    width: 44px;
    height: 44px;
    margin: 0 !important;
    padding: 0;
    pointer-events: none; /* a tap on the closed search focuses the input instead of submitting */
  }
  .head-search-form:focus-within {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 6px;
    width: auto;
    z-index: 5;
    background: #fff;
  }
  .head-search-form:focus-within .search-input {
    width: 100%;
    padding: 0 48px 0 16px;
    color: #202020;
    cursor: text;
    border-color: #7057a5;
  }
  .head-search-form:focus-within .search-input::placeholder {
    color: #8a8a8a;
  }
  .head-search-form:focus-within .search-btn {
    left: auto;
    right: 0;
    pointer-events: auto;
  }
}

@media (max-width: 575px) {
  /* phones: avatar only, the name would push the icons off the row */
  main > header .head-avatar + div {
    display: none;
  }
  main > header .head-avatar img {
    margin-right: 0 !important;
  }
  main > header .head-avatar.online::before {
    right: -2px;
  }
}

/* ---------- Content spacing on phones ---------- */
@media (max-width: 575px) {
  main > .sm-padding25 {
    margin-top: 12px !important;
  }
  main .p-4.mt-4 {
    padding: 8px !important;
    margin-top: 8px !important;
  }
  main .p-5 {
    padding: 20px 16px !important;
  }
  main section.categories-list {
    padding: 8px !important;
  }
  main h1 {
    font-size: 24px;
    line-height: 1.2;
    word-break: break-word;
  }
  main h2 {
    font-size: 20px;
  }

  /* info boxes: slim icon strip instead of a 70px column */
  .response-box {
    padding: 14px 14px 14px 52px !important;
    font-size: 14px;
    line-height: 1.45;
  }
  .response-box::before {
    width: 38px !important;
    background-size: 20px !important;
  }

  /* lesson downloads: one full-width row per file */
  main a.btn.w-50[href*="secured-files"] {
    float: none !important;
    display: flex !important;
    align-items: center;
    width: 100% !important;
    min-height: 48px;
    margin-bottom: 8px;
    padding: 10px 12px !important;
    white-space: normal;
    text-align: left;
    font-size: 14px;
    line-height: 1.35;
    border-radius: 8px;
  }

  /* pagination wraps instead of pushing the page sideways */
  .pagination {
    flex-wrap: wrap;
    row-gap: 6px;
  }
}

/* bootbox popups ("Új üzeneted érkezett!") fit the screen and scroll inside */
@media (max-width: 575px) {
  .bootbox .modal-dialog {
    margin: 12px;
  }
  .bootbox .modal-body {
    max-height: calc(100vh - 170px);
    overflow-y: auto;
  }
  .bootbox .response-box {
    font-weight: 400 !important;
  }
}

/* profile forms: "Új jelszó újra" / "Új e-mail cím újra" + Mentés stack instead of squeezing the field */
@media (max-width: 575px) {
  main .input-group:has(> .input-group-append.pl-3) {
    flex-wrap: wrap;
  }
  main .input-group:has(> .input-group-append.pl-3) > .form-control {
    flex: 1 1 100%;
    border-radius: 0.25rem !important;
  }
  main .input-group > .input-group-append.pl-3 {
    flex: 1 1 100%;
    padding-left: 0 !important;
    margin: 10px 0 0 0;
  }
  main .input-group > .input-group-append.pl-3 .btn {
    width: 100%;
  }
}
