/* Mobile-first enhancements for the Zeiterfassung app */

:root {
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --radius: 0.5rem;
}

/* Base typography adjustments for small screens */
html { font-size: 17px; }
@media (max-width: 420px) {
  html { font-size: 16px; }
}

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Global mobile-safe defaults */
html, body { width: 100%; }
body { overflow-x: hidden; }
img, video, canvas, svg { max-width: 100%; height: auto; }
iframe { max-width: 100%; }
.table th, .table td { word-break: break-word; }

/* Navbar compact spacing on mobile */
.navbar .navbar-brand { font-weight: 600; }
.navbar .dropdown-toggle { line-height: 1.2; }

/* Ensure the toggler is easy to tap */
.navbar-toggler { padding: 0.5rem 0.75rem; border-radius: var(--radius); }

/* Container spacing */
.container, .container-fluid { padding-left: var(--spacing-4); padding-right: var(--spacing-4); }

/* Card polish */
.card { border-radius: var(--radius); overflow: hidden; }
.card-header { font-weight: 600; }
.card + .card { margin-top: 1rem; }

/* Forms */
.form-label { margin-bottom: 0.25rem; font-weight: 500; }
.form-control, .form-select {
  min-height: 2.5rem;
  border-radius: 0.5rem;
}
.form-check-input {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  margin-top: 0.125rem;
}
textarea.form-control { min-height: 6rem; }

/* Buttons */
.btn { border-radius: 0.5rem; }
.btn.w-100 { padding-top: 0.8rem; padding-bottom: 0.8rem; }

/* Table responsiveness tweaks */
.table-responsive { -webkit-overflow-scrolling: touch; }
.table { margin-bottom: 0; }
.table th, .table td { vertical-align: middle; }

/* Sticky bottom action bar for mobile */
@media (max-width: 576px) {
  .sticky-bottom-bar {
    position: sticky;
    bottom: 0;
    z-index: 1020; /* above card body */
    background: #ffffffea;
    backdrop-filter: saturate(180%) blur(4px);
    padding: 0.75rem 0.5rem;
    border-top: 1px solid rgba(0,0,0,0.05);
  }
}

/* Utility: hide-on-xs, show-on-xs */
@media (max-width: 576px) {
  .hide-xs { display: none !important; }
  .show-xs { display: block !important; }
}

/* Improve tap size for table checkboxes (keep compact to avoid overlap) */
.entry-checkbox, #select-all { width: 1.25rem; height: 1.25rem; vertical-align: middle; }

/* Spacing utilities */
.mt-1 { margin-top: var(--spacing-1) !important; }
.mt-2 { margin-top: var(--spacing-2) !important; }
.mt-3 { margin-top: var(--spacing-3) !important; }
.mt-4 { margin-top: var(--spacing-4) !important; }

/* Reduce container top margin on very small screens to save space */
@media (max-width: 375px) {
  .container.mt-4 { margin-top: 1rem !important; }
}

/* Responsive width utility */
@media (min-width: 576px) {
  .w-sm-auto { width: auto !important; }
}


/* Mobile sizing and native-feel overrides */
html { -webkit-text-size-adjust: 100%; }
:root { -webkit-tap-highlight-color: rgba(0,0,0,0.08); }

@media (max-width: 576px) {
  /* Typography */
  body { line-height: 1.5; }
  h1, .h1 { font-size: 1.5rem; }
  h2, .h2 { font-size: 1.375rem; }
  h3, .h3 { font-size: 1.25rem; }
  small, .small, .text-muted { font-size: 0.875rem; }

  /* Buttons */
  .btn { font-size: 1.0625rem; padding: 0.625rem 0.875rem; min-height: 44px; border-radius: 0.6rem; }
  .input-group .btn { height: auto; }

  /* Forms */
  .form-control, .form-select { font-size: 1rem; min-height: 2.875rem; padding: 0.625rem 0.75rem; }
  .form-label { font-size: 1rem; }
  .form-check-input { width: 1.25rem; height: 1.25rem; margin-top: 0.2rem; }
  textarea.form-control { min-height: 7rem; }

  /* Navigation */
  #sidebarToggle { min-width: 44px; min-height: 44px; padding: 0.5rem; }
  .app-sidebar .nav-link { font-size: 1.0625rem; padding: 0.625rem 0.875rem; }
  .app-sidebar .nav-section { font-size: 0.9rem; }
  .sidebar-brand { font-size: 1.125rem; }

  /* Topbar */
  .app-topbar .btn { min-width: 44px; min-height: 44px; }

  /* Tables */
  .table { font-size: 0.9875rem; }
  .table th, .table td { padding: 0.625rem 0.5rem; }
}
