html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
  margin-bottom: 60px;
}

/* ============================================
   RESPONSIVE TABLE STYLES
   ============================================ */

/* Table wrapper for horizontal scrolling on mobile */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Better table styling */
.table {
  margin-bottom: 0;
}

.table th, .table td {
  white-space: nowrap;
  vertical-align: middle;
}

/* Card-style tables on mobile */
@media (max-width: 767.98px) {
  .table-mobile-cards thead {
    display: none;
  }
  
  .table-mobile-cards tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  
  .table-mobile-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border: none;
    border-bottom: 1px solid #eee;
  }
  
  .table-mobile-cards tbody td:last-child {
    border-bottom: none;
  }
  
  .table-mobile-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #495057;
    margin-right: 1rem;
  }
}

/* ============================================
   RESPONSIVE FORM STYLES
   ============================================ */

/* Form controls full width on mobile */
@media (max-width: 767.98px) {
  .form-control, .form-select {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
  
  .form-group, .mb-3 {
    margin-bottom: 1rem;
  }
  
  /* Stack form buttons */
  .form-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .form-actions .btn {
    width: 100%;
  }
}

/* ============================================
   RESPONSIVE BUTTON STYLES
   ============================================ */

/* Action buttons on mobile */
.btn-group-actions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

@media (max-width: 767.98px) {
  .btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  
  /* Stack action buttons vertically */
  .btn-group-actions {
    flex-direction: column;
  }
  
  .btn-group-actions .btn {
    width: 100%;
    margin-bottom: 0.25rem;
  }
}

/* ============================================
   RESPONSIVE NAVIGATION STYLES
   ============================================ */

/* Better mobile navbar */
@media (max-width: 575.98px) {
  .navbar-brand {
    font-size: 1.1rem;
  }
  
  .navbar-nav {
    padding-top: 0.5rem;
  }
  
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
  }
  
  .dropdown-menu {
    border: none;
    padding-left: 1rem;
    background: #f8f9fa;
  }
  
  .dropdown-item {
    padding: 0.5rem 1rem;
  }
}

/* ============================================
   RESPONSIVE CONTAINER STYLES
   ============================================ */

/* Full width container on mobile */
@media (max-width: 767.98px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ============================================
   RESPONSIVE CARD STYLES
   ============================================ */

.card {
  margin-bottom: 1rem;
}

@media (max-width: 767.98px) {
  .card-body {
    padding: 1rem;
  }
}

/* ============================================
   RESPONSIVE MODAL STYLES
   ============================================ */

@media (max-width: 767.98px) {
  .modal-dialog {
    margin: 0.5rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
}

/* ============================================
   RESPONSIVE PAGE HEADER
   ============================================ */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1, .page-header h2 {
  margin-bottom: 0;
}

@media (max-width: 575.98px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .page-header h1, .page-header h2 {
    font-size: 1.5rem;
  }
  
  .page-header .btn {
    width: 100%;
  }
}

/* ============================================
   RESPONSIVE FILTER/SEARCH FORMS
   ============================================ */

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.filter-form .form-group {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0;
}

@media (max-width: 767.98px) {
  .filter-form {
    flex-direction: column;
  }
  
  .filter-form .form-group {
    width: 100%;
  }
  
  .filter-form .btn {
    width: 100%;
  }
}

/* ============================================
   RESPONSIVE FOOTER
   ============================================ */

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
}

@media (max-width: 575.98px) {
  .footer {
    line-height: 1.5;
    padding: 1rem 0;
    text-align: center;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Hide on mobile */
@media (max-width: 767.98px) {
  .d-mobile-none {
    display: none !important;
  }
}

/* Hide on desktop */
@media (min-width: 768px) {
  .d-desktop-none {
    display: none !important;
  }
}

/* Text truncate */
.text-truncate-mobile {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .text-truncate-mobile {
    max-width: none;
  }
}

/* Touch-friendly spacing */
@media (max-width: 767.98px) {
  .touch-spacing > * {
    margin-bottom: 0.75rem;
  }
}

/* Amount/Number columns - right align */
.text-amount {
  text-align: right;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
}

/* Status badges */
.badge {
  font-weight: 500;
}

/* Better scrollbars on mobile */
::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}