/* ============================================================================
   PETTY CASH MANAGEMENT SYSTEM - responsive.css
   Tablet (<=1180px) · Mobile sidebar (<=960px) · Phone (<=640px)
   ========================================================================== */

/* ---------------------------------------------------------------------------
   LARGE TABLET / SMALL LAPTOP
--------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-23, .grid-32 { grid-template-columns: 1fr; }
  .content { padding: 22px 20px 40px; }
}

/* ---------------------------------------------------------------------------
   COLLAPSE SIDEBAR -> OVERLAY
--------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .hamburger { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

/* ---------------------------------------------------------------------------
   TABLET FORMS
--------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .filters-bar .fb-field { min-width: 138px; flex: 1; }
  .filters-bar .fb-actions { margin-left: 0; width: 100%; }
  .filters-bar .fb-actions .btn { flex: 1; }

  .approval-card { grid-template-columns: 1fr; }
  .approval-card .ac-actions { flex-direction: row; min-width: 0; }
  .approval-card .ac-actions .btn { flex: 1; }

  .kv-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------
   PHONE
--------------------------------------------------------------------------- */
@media (max-width: 640px) {
  body { font-size: 14px; }

  .content { padding: 16px 13px 40px; }

  .topbar { height: 58px; padding: 0 13px; gap: 10px; }
  .topbar-title { font-size: 15px; }
  .topbar-sub { display: none; }
  .user-meta { display: none; }
  .user-chip { padding: 4px; border: 0; background: transparent; }

  .page-header { margin-bottom: 16px; }
  .page-header h1 { font-size: 19.5px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  /* Summary cards stack */
  .stat-grid { grid-template-columns: 1fr; gap: 11px; }
  .stat-card { padding: 15px 17px; }
  .stat-value { font-size: 23px; }

  .grid-3 { grid-template-columns: 1fr; }
  .mb-grid { gap: 12px; margin-bottom: 12px; }

  .card-header { padding: 14px 16px; }
  .card-body { padding: 15px 16px; }
  .card-pad { padding: 17px 16px; }

  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .form-group { margin-bottom: 14px; }

  /* Tables scroll horizontally on small screens */
  .table-wrap {
    margin: 0 -16px;
    width: calc(100% + 32px);
    padding: 0 16px;
  }
  table.data-table { min-width: 560px; }
  .data-table thead th { padding: 10px 12px; font-size: 11px; }
  .data-table tbody td { padding: 11px 12px; }

  /* Filters stack */
  .filters-bar { padding: 13px 14px; gap: 9px; }
  .filters-bar .fb-field { min-width: 100%; }

  /* Tabs scroll horizontally */
  .tabs {
    width: calc(100% + 0px);
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .tab-btn { white-space: nowrap; padding: 8px 14px; }

  /* Modals become bottom sheets */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    animation: sheetIn .28s cubic-bezier(.2, .9, .3, 1.1);
  }
  @keyframes sheetIn { from { transform: translateY(60px); opacity: .6; } to { transform: none; opacity: 1; } }
  .modal-header, .modal-body, .modal-footer { padding-left: 17px; padding-right: 17px; }
  .modal-footer .btn { flex: 1; }
  .modal-lg, .modal-xl { max-width: 100%; }
  .receipt-view iframe { height: 400px; }
  .receipt-view img { max-height: 330px; }

  /* Dropzone touch friendly */
  .dropzone { padding: 24px 14px; }
  .dropzone .dz-icon { width: 46px; height: 46px; }

  .file-card { flex-wrap: wrap; }
  .file-actions { width: 100%; justify-content: flex-end; }

  .chart-box { height: 240px; }

  .detail-amount { font-size: 26px; }

  .auth-main { padding: 26px 18px; }
  .auth-card h1 { font-size: 23px; }

  .toast-container { left: 12px; right: 12px; max-width: none; top: 12px; }

  .wizard-step { font-size: 11.5px; }
  .sum-row { padding: 11px 2px; }
}

/* ---------------------------------------------------------------------------
   SMALL PHONE
--------------------------------------------------------------------------- */
@media (max-width: 400px) {
  .page-actions { flex-direction: column; }
  .btn-block-mobile { width: 100%; }
  .approval-card .ac-actions { flex-direction: column; }
}

/* ---------------------------------------------------------------------------
   TOUCH / MOTION PREFERENCES
--------------------------------------------------------------------------- */
@media (hover: none) {
  .data-table tbody tr:hover { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
