/* Finaku Mobile-First CSS — makes Filament panel usable on phones */

/* ===== SIDEBAR — full-width on mobile ===== */
@media (max-width: 767px) {
  .fi-sidebar {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .fi-sidebar-header {
    padding: 0.5rem 1rem !important;
  }
  
  .fi-sidebar-nav {
    padding: 0.25rem !important;
  }
  
  .fi-sidebar-item a {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.875rem !important;
  }
  
  /* Collapse sidebar by default on mobile - show hamburger */
  .fi-sidebar:not(.fi-sidebar-open) {
    display: none !important;
  }
}

/* ===== TOP NAV / HEADER — compact ===== */
@media (max-width: 767px) {
  .fi-topbar {
    padding: 0.5rem 0.75rem !important;
    min-height: auto !important;
  }
  
  .fi-topbar nav {
    gap: 0.25rem !important;
  }
  
  .fi-topbar .fi-topbar-title {
    font-size: 1rem !important;
  }
  
  .fi-dropdown-trigger button,
  .fi-dropdown-trigger a {
    padding: 0.375rem !important;
  }
}

/* ===== MAIN CONTENT — full width ===== */
@media (max-width: 767px) {
  .fi-main {
    padding: 0.75rem !important;
    margin-left: 0 !important;
  }
  
  .fi-main-ctn {
    padding: 0 !important;
  }
  
  .fi-section {
    border-radius: 0.5rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  .fi-section-header {
    padding: 0.75rem !important;
  }
  
  .fi-section-content {
    padding: 0.75rem !important;
  }
  
  .fi-section-header-heading {
    font-size: 0.9375rem !important;
  }
}

/* ===== FORMS — touch-friendly ===== */
@media (max-width: 767px) {
  .fi-input,
  .fi-select,
  .fi-input-wrp,
  input:not([type=file]):not([type=checkbox]):not([type=radio]),
  select,
  textarea {
    font-size: 16px !important; /* prevent iOS zoom */
    min-height: 2.75rem !important;
    padding: 0.5rem 0.75rem !important;
  }
  
  .fi-fo-field {
    padding: 0.25rem 0 !important;
  }
  
  .fi-fo-field-label label {
    font-size: 0.8125rem !important;
  }
  
  /* Buttons easier to tap */
  button.fi-btn,
  .fi-btn {
    min-height: 2.75rem !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.9375rem !important;
  }
  
  /* Radio/checkbox spacing */
  .fi-fo-radio label,
  .fi-fo-checkbox label {
    padding: 0.5rem 0 !important;
  }
  
  /* File upload */
  .fi-fo-file-upload {
    min-height: 3rem !important;
  }
}

/* ===== TABLES — scroll horizontally ===== */
@media (max-width: 767px) {
  .fi-ta-ctn {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .fi-ta-table {
    min-width: 600px !important; /* force scroll on small screens */
  }
  
  .fi-ta-header-cell,
  .fi-ta-cell {
    padding: 0.5rem 0.5rem !important;
    font-size: 0.8125rem !important;
  }
}

/* ===== CARDS & GRID — stack vertically ===== */
@media (max-width: 767px) {
  .fi-grid {
    grid-template-columns: 1fr !important;
  }
  
  .fi-card {
    margin-bottom: 0.75rem !important;
  }
}

/* ===== LOGIN PAGE — responsive ===== */
@media (max-width: 767px) {
  .fi-simple-layout {
    padding: 1rem !important;
  }
  
  .fi-simple-layout .fi-simple-card {
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding: 1rem !important;
  }
}

/* ===== POS/TOUCH INTERFACE ===== */
@media (max-width: 767px) {
  .fi-panel {
    padding: 0.5rem !important;
  }
  
  /* Product grid for POS */
  [class*="grid"] {
    gap: 0.5rem !important;
  }
  
  /* Cart items */
  [class*="cart"] {
    font-size: 0.875rem !important;
  }
}

/* ===== MODALS — full screen on mobile ===== */
@media (max-width: 767px) {
  .fi-modal-window {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  
  .fi-modal-content {
    padding: 1rem !important;
  }
  
  .fi-modal-header {
    padding: 0.75rem 1rem !important;
  }
}

/* ===== NOTIFICATIONS ===== */
@media (max-width: 767px) {
  .fi-notification {
    width: calc(100% - 2rem) !important;
    max-width: calc(100% - 2rem) !important;
    right: 1rem !important;
    font-size: 0.875rem !important;
  }
}

/* ===== GLOBAL — prevent horizontal scroll ===== */
@media (max-width: 767px) {
  body,
  .fi,
  .fi-body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  img {
    max-width: 100% !important;
    height: auto !important;
  }
}