/*
 * mobile.css — адаптация под мобильные устройства
 *
 * Брейкпоинты:
 *   768px — планшеты / мобильные устройства (landscape / portrait)
 *   480px — телефоны (portrait)
 *
 * Этот файл дополняет styles.css, не изменяя его.
 * Подключается ПОСЛЕ styles.css в header.html.
 */

/* ============================================================
   768px — Планшеты и телефоны в landscape
   ============================================================ */

@media screen and (max-width: 768px) {

  /* ----- Основной контентный контейнер ----- */

  .page_wrap {
    width: 100%;
    margin: 12px 0 0;
    padding: 0 14px;
    box-sizing: border-box;
  }

  .page_inner {
    margin: 8px 0 0;
  }

  /* ----- Header ----- */

  header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
  }

  .header_space {
    display: none;
  }

  .schulename_item {
    max-width: 100%;
    font-size: 13px;
    order: 2;
  }

  .logo_item,
  .logo_item a {
    max-width: 70px;
  }

  .search-container {
    order: 3;
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  /* Аватар и имя — схлопываем в иконку */
  .name_box {
    display: none !important;
  }

  /* ----- Навигация (вкладки классов) ----- */

  .blockTabs {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-bottom: 8px;
  }

  .blockTabs_holder {
    width: 100%;
  }

  .scrolling {
    max-width: 100%;
    width: 100%;
  }

  .tab_box {
    gap: 4px 14px;
    padding: 6px 0;
  }

  /* Bootstrap nav-tabs: горизонтальный скролл вместо переноса */
  .nav-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid #bdbdbd !important;
    padding-bottom: 0;
  }

  .nav-tabs .nav-item {
    flex-shrink: 0;
  }

  /* ----- Панель действий (кнопки) ----- */

  .button_container {
    flex-wrap: wrap;
    gap: 10px;
  }

  .button_container .button,
  .button_container a.button {
    flex: 1 1 auto;
    min-width: 120px;
    text-align: center;
  }

  .blockBtn {
    flex-wrap: wrap;
    gap: 10px;
  }

  .previous_nav {
    flex-direction: column;
    gap: 10px;
  }

  .previous_nav_holder {
    flex-wrap: wrap;
    gap: 12px;
  }

  /* ----- Блоки данных (box_wrap / bigBoxClasse) ----- */

  .bigBoxClasse {
    flex-direction: column;
  }

  /* box_col — контейнер таблицы коллег (без custom_table_wrap) */
  .box_col {
    width: 100%;
    padding: 10px 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  .box_wrap {
    width: 100% !important;
    min-width: unset !important;
    max-width: 100% !important;
    padding: 10px 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  /* ----- Три колонки (threelistsBox) ----- */

  .zeugnis_three_tables {
    flex-direction: column;
  }

  .threelistsBox {
    width: 100%;
    min-height: unset;
    max-height: unset;
  }

  .table_for_zeugnis {
    width: 100%;
  }

  /* ----- Колонки с данными учеников / предметов ----- */

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

  .col_1 {
    flex: auto;
    width: 100%;
    max-width: 100%;
  }

  .col_row input,
  .col_row textarea,
  .col_row_text {
    width: 100%;
  }

  /* ----- Schuldaten: горизонтальные блоки -> вертикальные ----- */

  .frameField {
    flex-direction: column;
    align-items: stretch;
  }

  .schuldatenBlock {
    width: 100%;
    max-width: 100%;
    padding: 16px;
  }

  .schriftSchuldatenBlock {
    padding: 16px;
  }

  /* ----- Заголовок блока (Titel + кнопка) ----- */

  .boxesHeader {
    height: auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
  }

  .boxesHeader h2 {
    flex: 1 1 auto;
  }

  .boxesHeader .button,
  .boxesHeader a.button {
    flex: 0 0 auto;
    min-width: unset;
    width: auto;
  }

  /* ----- Таблицы (горизонтальный скролл) ----- */

  .custom_table_wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Коллеги: 6 колонок — нужна увеличенная ширина */
  .custom_kollegen_table {
    min-width: 640px;
    font-size: 12px;
  }

  .custom_kollegen_table .table_header_inner,
  .custom_kollegen_table .custom_table_inner {
    min-width: unset;
    padding: 6px 4px;
    font-size: 12px;
    word-break: normal;
    white-space: normal;
  }

  .custom_kollegen_table .table_header_inner div,
  .custom_kollegen_table .custom_table_inner div,
  .custom_kollegen_table .custom_table_inner p,
  .custom_kollegen_table .custom_table_inner a,
  .custom_kollegen_table .custom_table_inner span {
    font-size: 12px;
  }

  .custom_Schuler_table,
  .custom_klassen_table,
  .custom_table {
    min-width: 560px; /* таблица не схлопывается */
  }

  /* ----- Форма справа (создание ученика, учителя и т.д.) ----- */

  .form_placing {
    width: 100%;
    max-width: 100%;
    position: relative;
    top: auto;
    right: auto;
    overflow: visible;
    padding: 14px;
  }

  .form_container {
    height: auto;
  }

  .Ausfühlen_form {
    height: auto;
    padding: 16px;
  }

  /* ----- Попапы (создание elem.) ----- */

  .uploadpopup_container,
  .popupFormKompetenz_container,
  .deletform_container {
    width: 90%;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 16px;
  }

  /* ----- Форма обратной связи / feedback ----- */

  .layot_feld {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .layot_input {
    width: 100%;
  }

  .layot_input_feld {
    width: 100%;
  }

  .choose_btn {
    flex-wrap: wrap;
  }

  .choose_btn_caption {
    min-width: unset;
    max-width: 100%;
  }

  /* ----- Строка навигации предыдущих записей (школьник) ----- */

  .previous_nav_control {
    max-width: 100%;
    width: 100%;
    justify-content: flex-start;
  }

  /* ----- Zeugnis предпросмотр ----- */

  .zeugnisVorschau {
    width: 100%;
    height: auto;
    max-height: none;
    scale: 1;
  }

  .table_zeugnisVorschau {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .zeugnis_toshow {
    width: 100%;
    height: auto;
    max-height: none;
  }

  .zeugnis_toshow-title {
    font-size: 5vw;
  }

  .zeugnis_toshow-subtitle {
    font-size: 3.5vw;
  }

  .zeugnis_toshow-headline {
    font-size: 4vw;
    margin-top: 20px;
  }

  /* ----- Popup (настройки аккаунта) ----- */

  .popup-content {
    width: 92%;
    max-width: 100%;
    margin: 50px auto;
  }

  /* ----- Wids (ширины колонок Lehrer-Seite) ----- */

  .wids1,
  .wids2,
  .wids3 {
    width: 100% !important;
  }

  /* Горизонтальный скролл у Zeugnismaker таблицы нот */
  .table_noten {
    min-width: 480px;
  }

  .table_zeugnisVorschau > * {
    min-width: 320px;
  }

  /* ----- Zeugnisart описание ----- */

  .zeugnisart_desc {
    flex-wrap: wrap;
    gap: 8px;
  }

  .zeugnis_desc {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ----- Сообщение об ошибке / info --- */

  .row_holder {
    gap: 16px;
  }

  /* ----- Таблица "Leistungsübersicht" ----- */

  .notenfeld_container {
    margin-bottom: 8px;
  }

  /* ----- Прочее ----- */

  h1 {
    font-size: 22px;
  }

  h2, h2 span, .h2 {
    font-size: 18px !important;
  }

  .size-2 {
    font-size: 18px;
  }

  /* Запрещаем горизонтальный скролл всей страницы —
     скролл таблиц идёт внутри .box_col / .box_wrap */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

} /* конец 768px */


/* ============================================================
   Landscape на телефонах — компактный header
   ============================================================ */

@media screen and (max-height: 500px) and (orientation: landscape) {

  /* Компактный header: всё в одну строку */
  header {
    flex-wrap: nowrap;
    padding: 6px 14px;
    gap: 8px;
  }

  .logo_item,
  .logo_item a {
    max-width: 60px;
    height: 14px;
  }

  .schulename_item {
    font-size: 12px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Поиск скрываем в landscape — места нет */
  .search-container {
    display: none;
  }

  /* Контент сразу под хедером без лишних отступов */
  .page_wrap {
    margin: 6px 0 0;
    padding: 0 10px;
  }

  /* Таблицы скроллятся горизонтально */
  .box_col,
  .box_wrap,
  .custom_table_wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Шрифт мельче для плотной таблицы */
  .custom_kollegen_table,
  .custom_klassen_table,
  .custom_Schuler_table,
  .custom_table {
    font-size: 12px;
  }

  .table_header_inner,
  .custom_table_inner {
    padding: 5px 4px;
    font-size: 12px;
  }

  .table_td, .table_rows {
    padding: 5px 0 5px 4px;
  }

  /* Заголовок блока компактнее */
  .boxesHeader {
    height: auto;
    padding: 6px 0;
  }

  h2, h2 span, .h2 {
    font-size: 16px !important;
  }

} /* конец landscape */


/* ============================================================
   480px — Телефоны в portrait
   ============================================================ */

@media screen and (max-width: 480px) {

  /* ----- Header ----- */

  .logo_item,
  .logo_item a {
    max-width: 56px;
  }

  .schulename_item {
    font-size: 12px;
  }

  /* ----- Кнопки ----- */

  .button,
  a.button {
    min-width: unset;
    width: 100%;
    text-align: center;
  }

  .button_container {
    flex-direction: column;
  }

  /* ----- Основные отступы ----- */

  .page_wrap {
    padding: 0 10px;
  }

  /* ----- Блоки данных ----- */

  .box_wrap {
    padding: 10px;
  }

  .schuldatenBlock {
    padding: 12px;
  }

  /* ----- Таблицы (ещё меньше) ----- */

  .custom_Schuler_table,
  .custom_klassen_table,
  .custom_kollegen_table,
  .custom_table {
    min-width: 420px;
  }

  /* ----- Zeugnis предпросмотр ----- */

  .zeugnis_toshow-title {
    font-size: 6vw;
  }

  .zeugnis_toshow-subtitle {
    font-size: 4vw;
  }

  .zeugnis_toshow-headline {
    font-size: 5vw;
  }

  /* ----- Попапы ----- */

  .uploadpopup_container,
  .popupFormKompetenz_container,
  .deletform_container {
    width: 100%;
    padding: 12px;
    border-radius: 0;
  }

  /* ----- Формы ----- */

  .layot_container {
    width: 100%;
    padding: 10px;
  }

  /* ----- Заголовок блока ----- */

  .boxesHeader {
    gap: 6px;
  }

  /* ----- Таблицы — совсем маленький шрифт ----- */

  .custom_kollegen_table {
    font-size: 11px;
  }

  .custom_kollegen_table .table_header_inner,
  .custom_kollegen_table .custom_table_inner,
  .custom_kollegen_table .custom_table_inner div,
  .custom_kollegen_table .custom_table_inner p,
  .custom_kollegen_table .custom_table_inner a,
  .custom_kollegen_table .custom_table_inner span {
    font-size: 11px;
    padding: 4px 3px;
  }

  /* ----- Заголовки ----- */

  h1 {
    font-size: 18px;
  }

  h2, h2 span, .h2 {
    font-size: 16px !important;
  }

} /* конец 480px */
