/* ==========================================================================
   Responzivni vzhled (mobil / maly tablet)
   Nacita se jako posledni styl, jen pro obrazovku a jen do sirky 820 px.
   Pocitacovy vzhled (>= 821 px) a tisk zustavaji beze zmeny.
   ========================================================================== */

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

  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  body {
    min-width: 0;
    padding: 0;
    font-size: 100%;
    background-attachment: scroll;
    background-size: cover;
  }

  img { max-width: 100%; height: auto; }

  /* ---- hlavni bloky: pruzna sirka ---------------------------------------- */
  .hlavniBloky,
  #header, #menu, #main, #footer {
    width: auto !important;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
  }

  /* ---- hlavicka: logo (obrazek) nahore, prihlaseni pod nim --------------- */
  #header {
    position: relative;
    height: auto;
    background: #fff none;
    padding: 0;
  }
  #header::before {            /* obrazek hlavicky se zmensi na sirku displeje */
    content: "";
    display: block;
    padding-bottom: 19.37%;    /* pomer 821 x 159 */
    background: url("../img/header_bg.png") no-repeat left top;
    background-size: 100% 100%;
  }
  #clickable {                 /* klikaci plocha loga */
    position: absolute;
    top: 0; left: 0;
    float: none;
    width: 100%;
    height: 19.37vw;
  }
  #login_box {
    float: none;
    width: auto;
    height: auto;
    margin: 6px;
    padding: 8px;
    box-sizing: border-box;
    overflow: hidden;
  }
  #login_box table { width: 100%; }
  #login_box td:first-child { white-space: nowrap; padding-right: 6px; }
  #login_box .login_input { width: 100%; max-width: 100%; box-sizing: border-box; }
  #login_box a.bookmark { display: inline-block; margin: 2px 2px 4px 0; padding: 6px 10px; }
  #lang_switch { float: none; clear: both; margin: 6px 6px 0 6px; }

  /* ---- hlavni menu: mrizka, bunky se prizpusobi sirce ---------------------- */
  #menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    height: auto;
    margin-top: 4px;
  }
  #menu a {
    float: none;
    box-sizing: border-box;
    width: auto;
    margin: 0;
    padding: 11px 8px;
    text-align: center;
    border-left: 0;
    border-bottom: 1px solid #ec6ea6;
  }
  #menu a#prvni { padding-left: 8px; }

  /* ---- obsah: sloupce pod sebe, stred prvni ------------------------------ */
  #main {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    padding: 0 6px;
    background: #fff none;
  }
  #central { order: 1; }
  #left    { order: 2; }
  #right   { order: 3; }
  #bottomend { order: 4; }

  #left, #right, #central {
    float: none;
    width: auto;
    min-height: 0;
    min-width: 0;
    box-sizing: border-box;
  }
  #central { padding: 8px 4px; }
  #left, #right { padding: 4px; }

  /* ---- formulare ---------------------------------------------------------- */
  #central form { margin: 6px 0; }
  input[type="text"], input[type="password"], input[type="email"], input[type="tel"],
  input[type="number"], input[type="date"], input[type="search"], input[type="url"],
  select, textarea {
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;           /* iOS jinak pri zamereni pole priblizuje stranku */
  }
  textarea { width: 100%; }
  input[type="submit"], input[type="button"], button {
    padding: 8px 12px;
    font-size: 100%;
  }
  div.filter { width: auto !important; }

  /* ---- tabulky ------------------------------------------------------------ */
  #central table,
  table.pager {
    display: block;
    max-width: 100%;
    width: auto;
    margin: 0 0 10px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* formulare a profily zalozene na tabulkach: bunky pod sebe */
  table.reg_form, table.reg_form tbody, table.reg_form tr, table.reg_form td, table.reg_form th,
  table.profile,  table.profile tbody,  table.profile tr,  table.profile td,  table.profile th {
    display: block;
    width: auto;
    min-width: 0;
    box-sizing: border-box;
  }
  table.reg_form td, table.profile td { padding: 2px 4px; }

  /* ---- dialogy jQuery UI a lightbox -------------------------------------- */
  .ui-dialog {
    width: auto !important;
    max-width: 96vw !important;
    left: 2vw !important;
    box-sizing: border-box;
  }
  .ui-dialog .ui-dialog-content { width: auto !important; max-width: 100%; overflow: auto; }
  #colorbox, #cboxWrapper, #cboxContent { max-width: 100vw; }

  /* ---- paticka ------------------------------------------------------------ */
  #footer {
    height: auto;
    padding: 6px 8px 18px 8px;
    background: #fff none;
    clear: both;
  }
  #footer p { padding-top: 4px; }

  /* ---- plovouci prvky ladici/komunikacni listy se nesmi prekryvat obsah -- */
  #im-bar, #im-contact-list { max-width: 100vw; }
  #debug-bar, #debug-bar-bottom { max-width: 100%; box-sizing: border-box; }

  /* ---- hlasky (flash) ----------------------------------------------------- */
  #central div#flash-messages,
  #central div#flash-messages div.flash-message {
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* uplne male displeje */
@media screen and (max-width: 480px) {
  #login_box .login_input { width: 100%; }
}
