/* ============================================================================
 * mobile.css — ProRent admin responsive layer.
 * ALL rules are under mobile @media queries → desktop is untouched.
 * Loaded after theme.bundle.css + appa.css so it wins specificity on mobile.
 * ========================================================================== */

/* ===== Nav: mobile menu (collapsed < 992px = Bootstrap navbar-expand-lg) ===== */
@media (max-width: 991.98px) {
  #topnav .navbar-toggler {
    min-width: 44px;
    min-height: 44px;
  }
  #topnav .navbar-collapse {
    padding: 6px 12px 10px;
  }
  #topnav .navbar-nav {
    width: 100%;
  }
  #topnav .navbar-nav .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
  }
  #topnav .navbar-nav .nav-link:hover,
  #topnav .navbar-nav .nav-link:active {
    background: rgba(255, 255, 255, 0.12);
  }
  /* Dropdowns expand inline (no floating menu) on mobile */
  #topnav .navbar-nav .dropdown-menu {
    position: static !important;
    float: none;
    width: 100%;
    border: 0;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.10);
    margin: 2px 0 6px;
    padding: 4px 0;
    transform: none !important;
  }
  #topnav .navbar-nav .dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 18px;
  }
}

/* ===== Phone layout (< 768px) ===== */
@media (max-width: 767.98px) {
  /* Content spacing — use the width */
  .main-content > .container,
  .main-content .container,
  body > .container {
    padding-left: 12px;
    padding-right: 12px;
  }
  .card { margin-bottom: 12px; }
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }

  /* Page header: stack title + primary action, action full width */
  .header-title { font-size: 1.4rem; }
  .header .header-body .col-auto { width: 100%; margin-top: 8px; }
  .header .header-body .col-auto .btn { width: 100%; }

  /* Tap targets >= 44px */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .form-control, .form-select { min-height: 44px; }
  .dropdown-item { min-height: 44px; display: flex; align-items: center; }
  .page-link {
    min-width: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  /* Icon action buttons inside tables get a bigger touch area */
  td .btn-sm,
  td .btn { min-height: 40px; min-width: 40px; }

  /* DataTables controls stack and never overflow */
  .dataTables_wrapper .row { row-gap: 8px; }
  .dataTables_length,
  .dataTables_filter { width: 100%; text-align: left; float: none; }
  .dataTables_filter input {
    width: 100%;
    margin-left: 0;
    margin-top: 4px;
    min-height: 44px;
  }
  .dataTables_paginate { display: flex; flex-wrap: wrap; gap: 4px; }
  .dataTables_info { font-size: 12px; }

  /* Bare tables (not wrapped, not DataTables, not card-ified) -> horizontal scroll */
  .card .table:not(.responsive-cards):not(.dataTable) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Visible scroll affordance for horizontally-scrollable tables.
   * 1) thin styled scrollbar (desktop/Android, + iOS where it shows)
   * 2) scroll-shadow: edge shadow appears while more content exists, hides at the end
   *    (pure CSS, works on iOS where the scrollbar is hidden). */
  .table-responsive,
  .card .table:not(.responsive-cards):not(.dataTable) {
    scrollbar-width: thin;
    scrollbar-color: #b9c0cb #eef0f3;
    background:
      linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) 0 0,
      linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) 100% 0,
      radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0)) 0 0,
      radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 32px 100%, 32px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  .table-responsive::-webkit-scrollbar,
  .card .table:not(.responsive-cards):not(.dataTable)::-webkit-scrollbar {
    height: 8px;
    -webkit-appearance: none;
  }
  .table-responsive::-webkit-scrollbar-thumb,
  .card .table:not(.responsive-cards):not(.dataTable)::-webkit-scrollbar-thumb {
    background: #b9c0cb;
    border-radius: 4px;
  }
  .table-responsive::-webkit-scrollbar-track,
  .card .table:not(.responsive-cards):not(.dataTable)::-webkit-scrollbar-track {
    background: #eef0f3;
    border-radius: 4px;
  }

  /* ===== Reservations list -> cards ===== */
  table.responsive-cards thead { display: none; }
  table.responsive-cards,
  table.responsive-cards tbody,
  table.responsive-cards tr,
  table.responsive-cards td { display: block; width: 100%; }
  table.responsive-cards tr {
    border: 1px solid #e3e6ec;
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 4px 10px;
    background: #fff;
  }
  table.responsive-cards td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 9px 4px;
    border: 0;
    border-bottom: 1px solid #f1f2f5;
    text-align: right;
    white-space: normal;
  }
  table.responsive-cards td:last-child { border-bottom: 0; }
  table.responsive-cards td::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: #8a93a2;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-align: left;
    flex: 0 0 auto;
  }
  /* Long-content cells: value gets its own full-width row under the label */
  table.responsive-cards td[data-label="Broj rez."],
  table.responsive-cards td[data-label="Kupac"] {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 3px;
  }

  /* ===== Reservation detail — voucher action buttons usable on mobile ===== */
  .rez-detail-header .col.text-end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    text-align: left !important;
    margin-top: 10px;
  }
  .rez-detail-header .col.text-end .btn {
    flex: 1 1 30%;
    min-height: 44px;
    margin: 0 !important;
    white-space: nowrap;
  }
  .rez-detail-header .col.text-end small { flex: 1 1 100%; margin-top: 2px; }
}
