/* Mobile adaptation shared by the Python static pages. */

@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body:not(.platform-page):not(.shell-page) {
    padding: 12px !important;
  }

  body.platform-page,
  body.shell-page {
    padding: 0 !important;
  }

  .top-bar {
    padding: 12px 14px !important;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start !important;
  }

  .top-bar h1 {
    width: 100%;
    font-size: 1.05rem !important;
  }

  .top-bar > div {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px !important;
  }

  .top-bar button {
    width: auto !important;
    padding: 7px 14px !important;
    font-size: 0.85rem !important;
  }

  .nav-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 8px !important;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tabs span {
    flex: 0 0 auto;
    padding: 12px 14px !important;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .app-container {
    height: 100dvh !important;
    padding: 10px !important;
  }

  .tab-content {
    padding: 12px !important;
  }

  .card {
    padding: 14px !important;
    border-radius: 12px !important;
  }

  .filter-bar {
    padding: 12px !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  .filter-left,
  .filter-right {
    width: 100% !important;
    gap: 10px !important;
  }

  .filter-group {
    flex: 1 1 100%;
    min-width: 0;
  }

  .filter-group input,
  .filter-group select {
    width: 100% !important;
    max-width: 100% !important;
  }

  .filter-right .btn-add,
  .filter-bar > .btn-primary {
    width: 100% !important;
    justify-content: center;
  }

  .inline-form {
    gap: 10px !important;
    align-items: stretch !important;
  }

  .inline-form input,
  .inline-form select {
    width: 100% !important;
    max-width: 100% !important;
  }

  .inline-form button {
    width: 100% !important;
  }

  .credit-form-row {
    gap: 10px !important;
    align-items: stretch !important;
  }

  .credit-form-group {
    flex: 1 1 100%;
  }

  .credit-form-group input,
  .credit-form-group select {
    width: 100% !important;
    max-width: 100% !important;
  }

  .credit-form-row > button {
    width: 100% !important;
  }

  .table-toolbar {
    align-items: stretch !important;
  }

  .table-toolbar > .btn-add {
    width: 100% !important;
    justify-content: center;
  }

  .search-box {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-box input {
    width: 100% !important;
    flex: 1 1 100%;
  }

  .search-box button {
    flex: 1 1 auto;
  }

  .history-header {
    gap: 8px;
  }

  .history-table-wrapper,
  .sub-table-wrapper,
  .page-table-wrapper,
  .offline-table-wrapper,
  .extract-table-wrapper,
  #subAccountList,
  #websiteList,
  #loginPageList,
  #taskList,
  #offlineAccountList {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .history-table {
    min-width: 760px;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  th,
  td {
    padding: 8px 10px !important;
    font-size: 0.8rem !important;
  }

  .pagination {
    justify-content: flex-start !important;
    flex-wrap: wrap;
  }

  .btn-group {
    flex-wrap: wrap !important;
  }

  .radio-group {
    width: 100%;
    justify-content: space-between;
  }

  .radio-label {
    flex: 1 1 auto;
    justify-content: center;
    padding: 6px 8px;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-box {
    width: min(100%, 500px) !important;
    max-width: 100% !important;
    padding: 18px !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-box .form-group input,
  .modal-box .form-group select,
  .modal-box .form-group textarea {
    width: 100% !important;
  }

  .modal-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-actions button {
    flex: 1 1 45%;
    width: auto !important;
    padding: 10px 14px !important;
  }

  .login-container {
    width: calc(100% - 24px);
    max-width: 400px;
    margin: 40px auto;
    padding: 28px 20px;
  }

  .container {
    max-width: calc(100vw - 24px) !important;
  }

  .grid-container,
  #waStatsGrid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .pricing-display {
    font-size: 1rem !important;
    padding: 12px !important;
  }

  .header {
    align-items: flex-start !important;
  }

  img,
  video,
  iframe {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  body:not(.platform-page):not(.shell-page) {
    padding: 8px !important;
  }

  .app-container {
    padding: 8px !important;
  }

  .card {
    padding: 12px !important;
  }

  .top-bar {
    padding: 10px 12px !important;
  }

  .top-bar h1 {
    font-size: 1rem !important;
  }

  .nav-tabs {
    padding: 0 6px !important;
  }

  .nav-tabs span {
    padding: 11px 12px !important;
    font-size: 0.82rem;
  }

  .tab-content {
    padding: 10px !important;
  }

  .login-container {
    margin: 24px auto;
    padding: 24px 16px;
    border-radius: 16px;
  }

  .modal-box {
    padding: 16px !important;
  }

  .modal-actions button {
    flex: 1 1 100%;
  }

  .container {
    padding: 24px 16px !important;
  }

  .pairing-code {
    font-size: 30px;
    letter-spacing: 2px;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .stats-grid .main-card {
    padding: 16px !important;
  }

  .total-number {
    font-size: 2.1rem !important;
  }

  .refresh-btn {
    width: 100%;
    justify-content: center;
  }

  .time-card {
    padding: 12px !important;
    flex-wrap: wrap;
    gap: 8px;
  }

  .time-count {
    font-size: 1.3rem !important;
  }

  #dailyStatsContainer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .daily-table {
    min-width: 520px;
  }
}
