/*
 * css/mobile.css
 * ─────────────────────────────────────────────────────────────
 * Mobile navigation bar, responsive breakpoints, and print styles.
 * Loaded last so these rules override desktop styles when needed.
 * ─────────────────────────────────────────────────────────────
 */

/* ── Mobile bottom nav bar ── */
.mobile-nav {
  display: none; /* shown only on small screens via media query */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); /* respects iPhone home bar */
  z-index: 50;
  justify-content: space-around;
}
.mob-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  border-radius: var(--radius);
  transition: color 0.15s;
}
.mob-item.active { color: var(--accent); }
.mob-item svg    { width: 20px; height: 20px; }

/* ── Responsive: below 680px, show mobile nav, hide sidebar ── */
@media (max-width: 680px) {
  .sidebar    { display: none; }
  .mobile-nav { display: flex; }
  .gear-btn   { display: flex; }

  .main {
    padding: 20px 16px 80px; /* extra bottom padding for the nav bar */
  }
  .page-title { font-size: 24px; }

  /* Stack form grids to single column */
  .form-grid          { grid-template-columns: 1fr; }
  .form-group.span2   { grid-column: span 1; }

  /* Smaller tab pills on mobile */
  .tab { font-size: 12px; padding: 5px 10px; }

  /* Invoice row wraps on small screens */
  .inv-row     { flex-wrap: wrap; }
  .inv-actions { width: 100%; justify-content: flex-end; }

  /* Total bar stacks vertically */
  .total-bar { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* Invoice preview has tighter padding */
  .invoice-preview { padding: 24px 16px; }
  .inv-parties     { grid-template-columns: 1fr; gap: 20px; }
}

/* ── Print: hide UI, show only the invoice or contract ── */
@media print {
  body    { background: #fff; }
  .app    { display: block; }

  /* Hide everything except the active printable content */
  .sidebar,
  .main > *:not(.page.active),
  .total-bar,
  .tab-row,
  .btn    { display: none !important; }

  .invoice-preview { box-shadow: none; }
}
