/* =========================================================
   XVIONE PARKING — APPLICATION-WIDE RESPONSIVE SYSTEM
   Supported layouts: 1366×768, 1600×900, 1920×1080,
   tablets, and mobile phones.
   Loaded after page-specific styles so these rules win.
   ========================================================= */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  width: 100%;
  min-width: 320px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 90px;
}

body {
  max-width: 100%;
  min-width: 320px;
  overflow-x: clip;
}

/* The parking desk shares some legacy admin styles; explicitly reset the
   old fixed-height flex body so the tenant dashboard can use full-width flow. */
body.parking-desk-page {
  display: block;
  width: 100%;
  height: auto;
  min-height: 100vh;
  overflow-x: clip;
}
.user-app { width: 100%; min-width: 0; max-width: 100%; }

img, svg, video, canvas, iframe { max-width: 100%; }
img { height: auto; }
input, select, textarea, button { max-width: 100%; min-width: 0; }
input, select, textarea { overflow-wrap: anywhere; }
pre, code { overflow-wrap: anywhere; }

/* Shared admin shell — keep the sidebar visible on desktop and
   use the existing hamburger/overlay drawer on smaller screens. */
.sidebar { flex-shrink: 0; min-width: 0; }
.main { flex: 1 1 auto; min-width: 0; max-width: 100%; }
.topbar { min-width: 0; max-width: 100%; }
.content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
  overflow-wrap: anywhere;
}
.top-title, .dashboard-header, .profile, .topbar-actions,
.header-actions, .toolbar, .section-heading { min-width: 0; }

/* Wide screens: use the available canvas rather than leaving the
   application constrained to a narrow laptop-sized content column. */
@media (min-width: 1600px) {
  .sidebar { width: 260px; }
  .sidebar-logo { max-width: 100%; }
  .content { padding: 28px 32px; }
  .topbar { padding-left: 32px; padding-right: 32px; }
  .user-content {
    width: 100%;
    max-width: 1800px;
    padding: 28px 32px;
  }
  .user-topbar { padding-left: 32px; padding-right: 32px; }
  .card-panel, .section, .panel { min-width: 0; }
}

/* Standard desktop / laptop — includes 1366×768. */
@media (min-width: 1025px) and (max-width: 1599px) {
  .sidebar { width: 230px; }
  .content { padding: 20px; }
  .topbar { padding-left: 20px; padding-right: 20px; gap: 14px; }
  .top-title h1 { font-size: clamp(23px, 2vw, 32px); }
  .user-content {
    width: 100%;
    max-width: 1500px;
    padding: 22px;
  }
  .entry-form { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bottom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section, .table-responsive, .table-wrapper, .table-container,
  .data-table-container, .active-table-wrap { max-width: 100%; overflow-x: auto; }
}

/* Tablet and compact windows. Do not set .sidebar to display:none:
   the admin hamburger opens it as a fixed drawer. */
@media (max-width: 1024px) {
  body { display: block; width: 100%; height: auto; min-height: 100vh; overflow-x: clip; }
  .sidebar {
    display: flex;
    position: fixed;
    left: -270px;
    top: 0;
    bottom: 0;
    width: min(250px, 84vw);
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    z-index: 1000;
    transition: left .25s ease;
  }
  .sidebar.show { left: 0; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 999; }
  .sidebar-overlay.show { display: block; }
  .main { width: 100%; min-width: 0; }
  .topbar { width: 100%; min-height: 72px; height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .content { width: 100%; padding: 18px; }
  .cards, .stats-grid, .stats-cards, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .form-grid, .settings-grid, .content-grid, .two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-content { max-width: 100%; padding: 18px; }
  .user-topbar { padding: 12px 16px; gap: 12px; }
  .entry-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-button { width: 100%; }
  .section, .table-responsive, .table-wrapper, .table-container,
  .data-table-container, .active-table-wrap, .table-scroll, .responsive-table {
    max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .modal-dialog, .modal-content, .dialog, .popup-content {
    max-width: calc(100vw - 32px);
  }
}

/* Phones and portrait tablets. */
@media (max-width: 768px) {
  body { overflow-x: clip; }
  .content, .main-content, .page-content, .dashboard-content,
  .admin-content, .settings-content, .main-container, .content-wrapper {
    width: 100%; max-width: 100%; min-width: 0;
    padding-left: 12px; padding-right: 12px;
  }
  .topbar, .header, .page-header, .toolbar, .header-actions,
  .topbar-actions, .section-heading { flex-wrap: wrap; gap: 10px; }
  .top-title { flex: 1 1 180px; }
  .top-title h1 { font-size: clamp(20px, 5vw, 27px); line-height: 1.2; overflow-wrap: anywhere; }
  .dashboard-header { min-width: 0; max-width: 100%; }
  .dashboard-logo { max-width: 72px; max-height: 72px; }
  .profile { max-width: 100%; }
  .cards, .stats-grid, .stats-cards, .kpi-grid,
  .grid2, .form-grid, .settings-grid, .content-grid, .two-column,
  .three-column, .form-row, .filters-row, .filter-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .content > *, .main > *, .section, .card, .panel, .stat-card,
  .kpi-card, .form-group, .form-field { min-width: 0; max-width: 100%; }
  .user-topbar { min-height: 64px; padding: 9px 12px; gap: 10px; }
  .brand-area { flex: 1 1 170px; gap: 9px; }
  .facility-logo { width: 44px; height: 44px; flex-basis: 44px; }
  .facility-name { font-size: clamp(15px, 4vw, 19px); white-space: normal; overflow-wrap: anywhere; }
  .user-profile { flex: 0 0 auto; padding: 4px; gap: 6px; }
  .user-profile-copy { display: none; }
  .user-content { width: 100%; max-width: 100%; padding: 12px; }
  .quick-entry, .parking-panel { padding: 14px; border-radius: 16px; }
  .section-heading { align-items: flex-start; }
  .section-heading h1 { font-size: clamp(20px, 5vw, 25px); }
  .entry-form { grid-template-columns: minmax(0, 1fr) !important; }
  .entry-form > *, .field-group, .entry-field { width: 100%; min-width: 0; }
  .entry-button, .primary-button, .secondary-button { width: 100%; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-card strong { font-size: 21px; }
  .toolbar { width: 100%; align-items: stretch; }
  .search-box { flex: 1 1 140px; min-width: 0; }
  .search-box input { width: 100%; min-width: 0; }
  .refresh-button { flex: 0 0 42px; }
  .table-responsive, .table-wrapper, .table-container, .data-table-container,
  .table-scroll, .responsive-table, .active-table-wrap, .section {
    width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  table { max-width: 100%; }
  .modal, .modal-dialog, .modal-content, .dialog, .popup, .popup-content {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    margin-left: auto; margin-right: auto;
  }
  .modal-body, .dialog-body, .popup-body { max-height: calc(100dvh - 145px); overflow-y: auto; }
  .modal-actions, .pagination, .table-actions, .action-buttons, .toolbar-actions,
  .btn-group, .button-group { flex-wrap: wrap; gap: 8px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button, .btn-group > *, .button-group > * { max-width: 100%; }
  .force-password-overlay { padding: 10px; }
  .force-password-body { padding: 16px; }
  .force-password-head { padding: 18px 16px 14px; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Small phones. */
@media (max-width: 480px) {
  .content, .main-content, .page-content, .dashboard-content,
  .admin-content, .settings-content, .main-container, .content-wrapper {
    padding-left: 10px; padding-right: 10px;
  }
  .topbar { padding: 10px; gap: 8px; }
  .hamburger { flex: 0 0 40px; width: 40px; height: 40px; }
  .user-content { padding: 10px; }
  .quick-entry, .parking-panel { padding: 12px; }
  .section-heading.compact { flex-direction: column; align-items: stretch; }
  .live-indicator { display: none; }
  .stats-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  th, td { padding: 8px; }
  .btn, button, .button, input[type="submit"], input[type="button"] { min-height: 40px; }
  .login-card, .login-wrapper, .right-panel { width: 100%; max-width: 100%; min-width: 0; }
  .login-title { font-size: clamp(22px, 7vw, 28px); }
}

/* Short laptop screens such as 1366×768: preserve access to all
   content and let the document scroll instead of clipping vertically. */
@media (min-width: 1025px) and (max-height: 800px) {
  body { min-height: 100vh; height: auto; }
  .content { padding-top: 16px; padding-bottom: 20px; }
  .sidebar { max-height: 100vh; overflow-y: auto; }
  .user-content { padding-top: 16px; padding-bottom: 20px; }
}

@media print {
  html, body { min-width: 0; overflow: visible !important; }
  table { display: table !important; overflow: visible !important; }
}


/* Compact enterprise treatment for the Recent Exits panel */
.bottom-grid > .parking-panel {
  min-width: 0;
  padding: 16px 18px;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .045);
}
.bottom-grid .section-heading.compact {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eaecf0;
}
.bottom-grid .section-heading h2 {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -.01em;
}
.bottom-grid .section-heading p {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.4;
}
.recent-list { gap: 0; min-width: 0; }
.recent-item {
  min-height: 48px;
  padding: 7px 0;
  gap: 9px;
  border-bottom: 1px solid #f0f2f5;
}
.recent-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: #f4f6f8;
  color: #475467;
  font-size: 12px;
}
.recent-copy { min-width: 0; overflow: hidden; }
.recent-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #101828;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 650;
}
.recent-copy span {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #667085;
  font-size: 10px;
  line-height: 1.35;
}
.recent-fee {
  flex: 0 0 auto;
  color: #344054;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bottom-grid .info-list { font-size: 12px; }
@media (min-width: 1400px) {
  .bottom-grid > .parking-panel { padding: 18px 20px; }
}
@media (max-width: 1050px) {
  .bottom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 720px) {
  .bottom-grid { grid-template-columns: minmax(0, 1fr); }
  .bottom-grid > .parking-panel { padding: 13px 14px; border-radius: 12px; }
  .bottom-grid .section-heading.compact { margin-bottom: 7px; padding-bottom: 8px; }
  .recent-item { min-height: 44px; padding: 6px 0; gap: 8px; }
  .recent-icon { width: 28px; height: 28px; flex-basis: 28px; }
  .recent-copy strong { font-size: 12px; }
  .recent-copy span { font-size: 10px; }
  .recent-fee { font-size: 11px; }
}
@media (max-width: 360px) {
  .bottom-grid > .parking-panel { padding: 11px; }
  .recent-icon { display: none; }
  .recent-item { gap: 6px; }
  .recent-fee { font-size: 10px; }
}
