/* Minimalistlikud mobiilitäiustused – desktopi ei muuda */
@media (max-width: 1024px) {

  /* --- ÜLAOSA / PÄIS --- */
  .header { padding: 4px 8px !important; min-height: 44px; }
  .header .block-group { display: none; margin: 0 !important; } /* peidus kuni burgerit vajutad */

  .header-title, .header-meta,
  .header .block, .header .b-50 {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
  }
  .header .title a { font-size: 18px; line-height: 1.1; }
  .header .iconbar { margin-top: 0; line-height: 1.25; }
  .header .iconbar a {
    display: inline-flex; align-items: center; gap: .35rem;
    margin-right: .35rem; white-space: nowrap;
  }

  /* Burger vasakul ülanurgas */
  .mnav-toggle{
    position: fixed;
    top: 8px; left: 12px; right: auto;
    z-index: 1200;
    display: inline-block;
    padding: 8px 10px;
    border: 0; border-radius: 8px;
    background: #ff6400; color: #fff;
    font-size: 20px; line-height: 1; cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
  }
  .mnav-toggle:active{ transform: translateY(1px); }
  body.nav-open .mnav-toggle{ background:#333; }

  /* Burgerit vajutades näitame ainult menüüikone (logo/pealkiri peidus) */
  body.nav-open .header .block-group{ display: block; padding: 6px 8px; }
  body.nav-open .header-title{ display: none; }
  body.nav-open .header-meta{ display: block; }
  body.nav-open .header .iconbar{ margin: 0; line-height: 1.4; }
  body.nav-open .header .iconbar a{
    display:inline-flex; align-items:center; gap:.35rem;
    margin-right:.5rem; white-space:nowrap;
  }

  /* --- SISU PADJAD / VORMID --- */
  .content_area { padding: 0 8px; }

  .content_area select,
  .content_area input[type="text"],
  .content_area input[type="number"],
  .content_area input[type="date"] { min-height: 32px; padding: 3px 6px; }
  .content_area .button, .content_area .btn, .content_area button { min-height: 32px; padding: 4px 8px; }

  /* --- ROHELINE BÄNNER peidus mobiilis --- */
  .bookings-grid-header{ display:none !important; }

  /* --- PÄEVA RIBA (← | dropdown | →) --- */
  .mobile-daybar{
    display:flex; align-items:center; justify-content:space-between;
    gap:8px; padding:6px 8px; margin:4px 0 6px;
    background:#fff;
  }
  .mobile-daybar .md-prev, .mobile-daybar .md-next{ width:25%; display:flex; }
  .mobile-daybar .md-center{ width:50%; display:flex; justify-content:center; }
  .mobile-daybar a{
    display:inline-block; padding:6px 10px;
    border:1px solid #d0d0d0; border-radius:8px; text-decoration:none;
    line-height:1.2; background:#fff;
  }
  .mobile-daybar .md-prev a{ justify-content:flex-start; }
  .mobile-daybar .md-next a{ justify-content:flex-end; }
  .mobile-daybar .filter-button{ width:100%; max-width:320px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .mobile-daybar input.up-datepicker-input{
    width:100%; max-width:320px; padding:6px 10px; border-radius:8px; border:1px solid #d0d0d0;
  }

  /* --- PÄEV/RUUM lüliti --- */
  .booking-view-row { margin: 4px 0 6px; display: flex; justify-content: center; padding: 0 8px; }
  .view-toggle { border-radius: 8px; box-shadow: none; width: 50%; max-width: 360px; margin: 0 auto; justify-content: stretch; }
  .view-toggle .toggle-btn { flex: 1 0 50%; text-align: center; padding: 5px 8px; font-weight: 600; }

  /* --- TABEL / GRID ---
     NB! scroll konteineril, tabel jääb "table" – nii toimib 1. veeru kitsendus */
  .content_area{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .content_area table{
    display: table !important;
    table-layout: fixed !important;
    width: max-content;
    min-width: 100%;
  }

  /* Mobiil: broneeringugridi vasak veerg kitsamaks (nt 90px) */
  .content_area thead th:first-child,
  .content_area tbody th:first-child,
  .content_area thead td:first-child,
  .content_area tbody td:first-child{
    width: 90px !important;
    max-width: 90px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    white-space: normal !important;
  }
  .content_area colgroup col:first-child{ width: 90px !important; }
  th.bookings-grid-header-cell-room,
  .bookings-grid-header-cell-room,
  .room-cell{
    width: 90px !important;
    max-width: 90px !important;
  }
}

/* Desktop – Tagasi / Edasi keskel ja nähtavad, mobiiliriba peidus */
@media (min-width: 1025px){

  .mobile-daybar{ display:none !important; }
  .mnav-toggle{ display:none !important; }

  .bookings-grid-header table{
    max-width: 980px;
    margin: 0 auto;
    table-layout: fixed;
  }
  .bookings-grid-header td{
    padding: 6px 10px;
    vertical-align: middle;
  }
  .bookings-grid-header td:first-child,
  .bookings-grid-header td:last-child{
    width: 25%;
    text-align: center;
  }
  .bookings-grid-header td:nth-child(2){
    font-weight: 700;
    font-size: 1.1rem;
  }
  .bookings-grid-header td a{
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid #d0d0d0;
    background: #fff;
    text-decoration: none;
    color: #222 !important;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    line-height: 1.2;
  }
  .bookings-grid-header td a:hover{
    background: #f8f8f8;
    box-shadow: 0 2px 4px rgba(0,0,0,.12);
  }

  /* Desktop: vasak veerg kitsamaks (nt 120px) – ülekirjutab ka colgroup’i */
  .bookings-grid table{ table-layout: fixed !important; }
  .bookings-grid colgroup col:first-child{ width:120px !important; }
  .bookings-grid thead th:first-child,
  .bookings-grid tbody th:first-child,
  .bookings-grid thead td:first-child,
  .bookings-grid tbody td:first-child{
    width:120px !important;
    max-width:120px !important;
    padding-left:6px !important;
    padding-right:6px !important;
    white-space:normal !important;
  }
  th.bookings-grid-header-cell-room,
  .bookings-grid-header-cell-room,
  .room-cell{
    width:120px !important;
    max-width:120px !important;
  }
}

/* --- Kompaktsemad ruumiread ja broneeringuslotid (mõlemas vaates) --- */

/* Ruumi nimi + omaniku rida õhemaks */
.room-cell { padding: 4px 6px !important; line-height: 1.2; }
.room-cell .room-name { display:block; font-weight:700; margin-bottom:2px; }
.room-cell .room-owner { display:block; font-size:0.85em; color:#567; }

/* Vabad slotid: madalam nupp */
.slot-available-cell .bookings-grid-button{
  display:block; width:100%;
  min-height:28px; padding:4px 6px;
  background:#fff; border:1px solid #e0e0e0; border-radius:6px;
}

/* Broneeritud slotid: padjad väiksemaks ja tekst murrab */
.slot-booked-cell .bookings-grid-button{
  display:block; width:100%;
  min-height:28px; padding:4px 6px;
  border-radius:6px;
}
.slot-booked-cell .booking-cell-user{
  font-weight:600; line-height:1.2; margin-bottom:2px;
}
.slot-booked-cell .booking-cell-notes{
  font-size:.85em; line-height:1.2;
  white-space:normal; word-break:break-word;
}

/* Mobiilis veel õhem */
@media (max-width: 1024px){
  .room-cell { padding: 3px 4px !important; }
  .slot-available-cell .bookings-grid-button,
  .slot-booked-cell .bookings-grid-button{
    min-height:26px; padding:3px 4px;
  }
  .slot-booked-cell .booking-cell-notes{ font-size:.82em; }
}
/* ---- ROOM VIEW: 1. veerg (periood/kellaaeg) kitsamaks ---- */

/* Desktop (nt 120px) */
@media (min-width: 1025px){
  /* kui tabel kasutab colgroup'i, proovi suruda ka seda */
  .bookings-grid colgroup col:first-child{ width:120px !important; }

  /* ainult siis, kui 1. veeru lahtril on period-klassi märge */
  .bookings-grid thead th:first-child.bookings-grid-header-cell-period,
  .bookings-grid thead td:first-child.bookings-grid-header-cell-period,
  .bookings-grid tbody th:first-child.col-period,
  .bookings-grid tbody td:first-child.col-period{
    width:120px !important;
    max-width:120px !important;
    padding-left:6px !important;
    padding-right:6px !important;
    white-space:normal !important; /* luba murrduda */
  }

  /* igaks juhuks: period-veeru üldklassid (kui pole first-child, ei mõjuta Day view’d) */
  .bookings-grid .col-period,
  .bookings-grid .bookings-grid-header-cell-period{
    max-width:120px !important;
  }
}

/* Mobiil (nt 90px) */
@media (max-width: 1024px){
  /* tabel jääb tabeliks; scroll konteineril, et widths toimiks */
  .content_area{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .content_area table{
    display: table !important;
    table-layout: fixed !important;
    width: max-content;
    min-width: 100%;
  }

  /* ainult Room view period-veeru 1. lahter */
  .bookings-grid thead th:first-child.bookings-grid-header-cell-period,
  .bookings-grid thead td:first-child.bookings-grid-header-cell-period,
  .bookings-grid tbody th:first-child.col-period,
  .bookings-grid tbody td:first-child.col-period{
    width:90px !important;
    max-width:90px !important;
    padding-left:4px !important;
    padding-right:4px !important;
    white-space:normal !important;
  }

  /* üldised period-veeru klassid (ei mõjuta Day view’d) */
  .bookings-grid .col-period,
  .bookings-grid .bookings-grid-header-cell-period{
    max-width:90px !important;
  }
}
/* ---- ROOM VIEW: 1. veerg (periood/kellaaeg) kindlale laiusele ---- */

/* Desktop: 120px */
@media (min-width: 1025px){
  /* tabel fikseeritud laotusega */
  .bookings-grid table{ table-layout: fixed !important; }

  /* tbody esimese veeru TH (Room view): meie lisatud klass */
  .bookings-grid tbody th.rv-period-cell{
    width:60px !important;
    max-width:120px !important;
    padding-left:6px !important;
    padding-right:6px !important;
    white-space:normal !important;
  }
}

/* Mobiil: 90px + scroll konteineril (tabel jääb "table") */
@media (max-width: 1024px){

  .content_area{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }
  .content_area table{
    display:table !important;
    table-layout:fixed !important;
    width:max-content;
    min-width:100%;
  }

  .bookings-grid tbody th.rv-period-cell{
    width:90px !important;
    max-width:90px !important;
    padding-left:4px !important;
    padding-right:4px !important;
    white-space:normal !important;
  }
}
/* Ühtlane tihendus (juba olemas, kuid kinnitame spetsiifiliselt single/recurring) */
.slot-booked-single .bookings-grid-button,
.slot-booked-recurring .bookings-grid-button{
  display:block; width:100%;
  min-height:28px; padding:4px 6px;
  border-radius:6px;
}

/* Korduvbroneeringule diskreetne “↻” enne kasutajat */
.slot-booked-recurring .booking-cell-user::before{
  content:"↻";
  margin-right:4px;
  opacity:.7;
  font-size:.95em;
}

/* Mobiilis veidi õhem */
@media (max-width:1024px){
  .slot-booked-single .bookings-grid-button,
  .slot-booked-recurring .bookings-grid-button{
    min-height:26px; padding:3px 4px;
  }
}
