/* Mobile-specific optimizations for dashboard */
/* This file contains mobile-first improvements to make the dashboard feel like a native mobile app */

/* Mobile viewport optimizations */
@media (max-width: 768px) {
  /* Global dark mode baseline for mobile so every page benefits */
  [data-theme="dark"] .main-content,
  [data-theme="dark"] body {
    background: #181a20 !important;
    color: #e5e7eb !important;
  }

  /* Dashboard and listing tables in dark mode */
  [data-theme="dark"] .table-responsive,
  [data-theme="dark"] .recent-transactions,
  [data-theme="dark"] .invoice-table-container {
    background: #23262f !important;
    border-color: #2a2d3a !important;
  }

  [data-theme="dark"] table,
  [data-theme="dark"] table th,
  [data-theme="dark"] table td,
  [data-theme="dark"] .data-table,
  [data-theme="dark"] .data-table th,
  [data-theme="dark"] .data-table td {
    background: #23262f !important;
    color: #ffffff !important;
    border-color: #2a2d3a !important;
  }

  /* Mobile modal footer emphasis in dark mode */
  [data-theme="dark"] .modal-invoice .modal-footer,
  [data-theme="dark"] .modal .modal-footer {
    background: #23262f !important;
    border-top: 1px solid #2a2d3a !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.35) !important;
  }

  [data-theme="dark"] .btn.primary-btn {
    background: #2563eb !important;
    color: #fff !important;
  }
  [data-theme="dark"] .btn.secondary-btn {
    background: #2a2d3a !important;
    color: #e5e7eb !important;
    border: 1px solid #374151 !important;
  }

  /* Settings Page Mobile Optimizations */
  /* Horizontal tabs with icons only for mobile */
  .settings-nav {
    z-index: 100 !important;
    background: var(--card-background) !important;
    border-radius: 16px !important;
    padding: 1rem !important;
    margin-bottom: 1.5rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid var(--border-color) !important;
  }

  .settings-tabs {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem !important;
    overflow-x: auto !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
  }

  .settings-tabs::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Opera */
  }

  .settings-tabs li {
    flex: 0 0 auto !important;
    min-width: auto !important;
    width: auto !important;
  }

  .settings-tabs li a {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    padding: 0.75rem !important;
    min-width: 50px !important;
    height: 50px !important;
    border-radius: 12px !important;
    border: 2px solid transparent !important;
    background: var(--background-color) !important;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
  }

  .settings-tabs li a::before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: linear-gradient(
      135deg,
      var(--primary-color) 0%,
      var(--primary-dark) 100%
    ) !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    z-index: 0 !important;
  }

  .settings-tabs li a:hover::before {
    opacity: 0.1 !important;
  }

  .settings-tabs li a > * {
    position: relative !important;
    z-index: 1 !important;
  }

  .settings-tabs li a i {
    font-size: 1.25rem !important;
    width: auto !important;
    text-align: center !important;
    margin: 0 !important;
    color: inherit !important;
    transition: transform 0.3s ease !important;
  }

  .settings-tabs li a span {
    display: none !important;
  }

  .settings-tabs li a:hover {
    background: var(--card-background) !important;
    color: var(--primary-color) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 16px rgba(0, 126, 199, 0.15) !important;
  }

  .settings-tabs li a:hover i {
    transform: scale(1.1) !important;
  }

  .settings-tabs li a:hover span {
    opacity: 1 !important;
  }
  /*
    .settings-tabs li a.active {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
        color: white !important;
        border-color: var(--primary-color) !important;
        box-shadow: 0 6px 20px rgba(0, 126, 199, 0.3) !important;
        transform: translateY(-2px) !important;
    }
*/
  .settings-tabs li a.active::before {
    opacity: 0 !important;
  }

  .settings-tabs li a.active i {
    transform: scale(1.1) !important;
    color: var(--primary-color) !important;
  }

  .settings-tabs li a.active span {
    opacity: 1 !important;
    color: var(--primary-dark) !important;
    font-weight: 600 !important;
  }

  /* Settings content adjustments for mobile */
  .settings-content {
    min-height: auto !important;
    margin-top: 0 !important;
  }

  .settings-section {
    position: relative !important;
    padding: 1.25rem !important;
    margin-bottom: 1.25rem !important;
  }

  .section-header {
    margin-bottom: 1.5rem !important;
    padding-bottom: 1rem !important;
  }

  .section-header h2 {
    font-size: 1.1rem !important;
    margin-bottom: 0.5rem !important;
  }

  .section-header p {
    font-size: 0.85rem !important;
  }

  /* Dark mode specific settings optimizations */
  [data-theme="dark"] .settings-nav {
    background: #23262f !important;
    border-color: #2a2d3a !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }

  [data-theme="dark"] .settings-tabs li a {
    background: #181a20 !important;
    color: #a0a0a0 !important;
    border-color: #2a2d3a !important;
  }

  [data-theme="dark"] .settings-tabs li a:hover {
    background: #2a2d3a !important;
    color: #60a5fa !important;
    border-color: #60a5fa !important;
  }

  [data-theme="dark"] .settings-tabs li a.active {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
    color: white !important;
    border-color: #2563eb !important;
  }

  [data-theme="dark"] .settings-section {
    background: #23262f !important;
    border-color: #2a2d3a !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }

  /* Improve touch targets */
  .action-card,
  .chart-card,
  .metric-card,
  .drilldown-btn,
  .pagination-btn,
  .filter-select,
  .search-filter input {
    min-height: 44px; /* Apple's recommended minimum touch target size */
  }

  /* Native-like card styling */
  .action-card,
  .chart-card,
  .metric-card,
  .recent-transactions {
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  /* Improved spacing for mobile */
  .main-content {
    padding: 1rem;
    margin-top: 60px; /* Account for fixed top bar */
  }

  .main-content > * {
    margin-bottom: 1.5rem;
  }

  .main-content > *:last-child {
    margin-bottom: 2rem; /* Extra space at bottom for mobile */
  }

  /* Mobile-optimized typography */
  .main-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
  }

  .main-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
  }

  .main-content .subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.5;
  }

  /* Mobile-optimized quick actions - Updated to match design */
  .quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
  }

  .action-card {
    background: var(--card-background);
    padding: 1.25rem 1rem;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
  }

  .action-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
      135deg,
      var(--primary-color) 0%,
      var(--primary-dark) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
  }

  .action-card:hover::before,
  .action-card:active::before {
    opacity: 0.05;
  }

  .action-card > * {
    position: relative;
    z-index: 1;
  }

  .action-card:active {
    transform: scale(0.95);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
  }

  .action-card i {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
    background: rgba(0, 126, 199, 0.1);
    padding: 0.75rem;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .action-card:hover i {
    transform: scale(1.05);
    background: rgba(0, 126, 199, 0.15);
  }

  .action-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
  }

  .action-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
    margin: 0;
  }

  /* Mobile-optimized metrics - Updated to match design */
  .metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
  }

  .metric-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
  }

  .metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
  }

  .metric-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .metric-header i {
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(0, 126, 199, 0.1);
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .metric-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
  }

  .metric-header .dropdown-icon {
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
  }

  .metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.5rem 0;
    line-height: 1.2;
  }

  .metric-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
  }

  .metric-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
  }

  .metric-change {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
  }

  .metric-change.positive {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
  }

  .metric-change.negative {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
  }

  .metric-indicators {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .metric-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
  }

  .metric-indicator.help {
    background: var(--primary-color);
    color: white;
  }

  .metric-indicator.percentage {
    background: #22c55e;
    color: white;
  }

  .metric-indicator.percentage.positive {
    background: rgba(59, 176, 119, 0.1);
    color: #3bb077;
  }

  .metric-indicator.percentage.negative {
    background: rgba(229, 83, 83, 0.1);
    color: #e55353;
  }

  .metric-indicator.brand {
    background: var(--primary-color);
    color: white;
    font-size: 0.625rem;
  }

  /* Mobile-specific metric card improvements */
  .metric-card {
    margin-bottom: 1rem;
  }

  .metric-card:last-child {
    margin-bottom: 0;
  }

  /* Mobile page header improvements */
  .page-header {
    margin-bottom: 1.5rem;
  }

  .page-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .page-header .subtitle {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }

  .page-header .action-buttons {
    margin-top: 1rem;
  }

  .page-header .action-buttons .btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  /* Mobile chart improvements */
  .chart-card {
    margin-bottom: 1.5rem;
  }

  .chart-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }

  .chart-actions {
    gap: 0.5rem;
  }

  .chart-actions button {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  /* Mobile table improvements */
  .table-header {
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .table-filters {
    flex-direction: column;
    gap: 0.75rem;
  }

  .filter-group {
    width: 100%;
  }

  .filter-select {
    width: 100%;
    padding: 0.75rem;
  }

  .search-filter input {
    width: 100%;
    padding: 0.75rem;
  }

  /* Mobile WALAKA Assistant improvements */
  #walaka-chatbot {
    width: 320px !important;
    max-width: 90vw !important;
    bottom: 16px !important;
    right: 16px !important;
    border-radius: 20px 20px 0 0 !important;
  }

  #walaka-chatbot-toggle {
    bottom: 32px !important;
    right: 24px !important;
    width: 48px !important;
    height: 48px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
  }

  #walaka-chatbot-messages {
    height: 280px !important;
    padding: 16px 12px 12px 12px !important;
  }

  #walaka-chatbot-form {
    padding: 12px !important;
    gap: 12px !important;
  }

  #walaka-chatbot-input {
    padding: 12px 16px !important;
    border-radius: 12px !important;
    font-size: 16px !important;
  }

  #walaka-chatbot-form button[type="submit"] {
    padding: 0 20px !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
  }

  /* Dark mode specific mobile improvements */
  [data-theme="dark"] #walaka-chatbot {
    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.4) !important;
  }

  [data-theme="dark"] #walaka-chatbot-toggle {
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3) !important;
  }

  /* Mobile-optimized charts */
  .chart-grid {
    gap: 1.5rem;
    margin: 1.5rem 0;
  }

  .chart-card {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }

  .chart-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .chart-card .chart-actions {
    display: flex;
    gap: 0.5rem;
  }

  .chart-card .chart-actions button {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
  }

  .chart-card .chart-actions button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 126, 199, 0.3);
  }

  .chart-container {
    height: 250px;
    position: relative;
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
  }

  /* Ensure charts stay within mobile boundaries */
  .chart-container canvas,
  .chart-container svg {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Mobile-optimized metrics */
  .metrics-grid {
    gap: 1.5rem;
    margin: 1.5rem 0;
  }

  .metric-card {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
  }

  .metric-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(
      90deg,
      var(--primary-color) 0%,
      var(--primary-light) 100%
    );
    border-radius: 16px 16px 0 0;
  }

  .metric-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
  }

  .metric-header i {
    font-size: 1.5rem;
    padding: 0.75rem;
    border-radius: 12px;
    background: linear-gradient(
      135deg,
      var(--primary-color) 0%,
      var(--primary-light) 100%
    );
    color: white;
    box-shadow: 0 2px 8px rgba(0, 126, 199, 0.3);
  }

  .metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1rem 0;
    line-height: 1.1;
  }

  .metric-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .metric-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
  }

  .metric-change {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .metric-change.positive {
    background: linear-gradient(135deg, #3bb077 0%, #10b981 100%);
    color: white;
  }

  .metric-change.negative {
    background: linear-gradient(135deg, #e55353 0%, #ef4444 100%);
    color: white;
  }

  /* Mobile-optimized recent transactions */
  .recent-transactions {
    background: var(--card-background);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }

  .recent-transactions h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .recent-transactions .view-all {
    font-size: 0.9rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background: rgba(0, 126, 199, 0.1);
    transition: all 0.3s ease;
  }

  .recent-transactions .view-all:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
  }

  /* Mobile-optimized table filters */
  .table-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(
      135deg,
      var(--background-color) 0%,
      rgba(248, 250, 252, 0.8) 100%
    );
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    align-items: end;
  }

  .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
  }

  .filter-select {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    min-height: 36px;
    width: 100%;
    box-sizing: border-box;
  }

  .filter-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
    outline: none;
  }

  /* Status and Amount filters side by side */
  .filter-group.status-filter,
  .filter-group.amount-filter {
    grid-column: span 1;
  }

  /* Date filter and search stacked vertically */
  .filter-group.date-filter {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
    position: relative;
  }

  .search-filter {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
  }

  .search-filter input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    min-height: 36px;
    box-sizing: border-box;
  }

  .search-filter input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
    outline: none;
  }

  /* Compact filter layout for very small screens */
  @media (max-width: 480px) {
    .table-filters {
      grid-template-columns: 1fr 1fr;
      gap: 0.5rem;
      padding: 0.75rem;
    }

    .filter-group {
      gap: 0.2rem;
    }

    .filter-group label {
      font-size: 0.7rem;
    }

    .filter-select,
    .search-input-group input,
    .clear-filters-btn {
      padding: 0.5rem 0.6rem;
      font-size: 0.8rem;
      min-height: 32px;
    }

    .filter-group.date-filter,
    .search-filter,
    .filter-group.export-filter {
      margin-top: 0.25rem;
    }
  }

  /* Landscape orientation filter optimization */
  @media (max-width: 768px) and (orientation: landscape) {
    .table-filters {
      grid-template-columns: repeat(2, 1fr);
      gap: 0.5rem;
      padding: 0.75rem;
    }

    .filter-group.date-filter,
    .search-filter {
      grid-column: 1 / -1;
      margin-top: 0.5rem;
    }

    .filter-select,
    .search-input-group input,
    .clear-filters-btn {
      padding: 0.5rem 0.6rem;
      font-size: 0.8rem;
      min-height: 32px;
    }
  }

  /* Mobile-optimized table */
  .table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    background: var(--card-background);
    margin: 0.5rem 0 1.5rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  .table-responsive::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent 0%,
      var(--border-color) 50%,
      transparent 100%
    );
  }

  .recent-transactions table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    font-size: 0.85rem;
  }

  .recent-transactions th {
    background: linear-gradient(
      135deg,
      var(--background-color) 0%,
      rgba(248, 250, 252, 0.8) 100%
    );
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: 0.8rem;
  }

  .recent-transactions td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: background 0.3s ease;
    font-size: 0.8rem;
  }

  .recent-transactions tr:hover td {
    background: rgba(0, 126, 199, 0.05);
  }

  .recent-transactions td .status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  }

  .recent-transactions td .status.paid {
    background: linear-gradient(135deg, #3bb077 0%, #10b981 100%);
    color: white;
  }

  .recent-transactions td .status.pending {
    background: linear-gradient(135deg, #f7b924 0%, #f59e0b 100%);
    color: white;
  }

  .recent-transactions td .status.overdue {
    background: linear-gradient(135deg, #e55353 0%, #ef4444 100%);
    color: white;
  }

  /* Dark Mode Status Styles for Recent Transactions */
  [data-theme="dark"] .recent-transactions td .status.paid {
    background: linear-gradient(
      135deg,
      rgba(59, 176, 119, 0.8) 0%,
      rgba(16, 185, 129, 0.8) 100%
    );
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
  }

  [data-theme="dark"] .recent-transactions td .status.pending {
    background: linear-gradient(
      135deg,
      rgba(247, 185, 36, 0.8) 0%,
      rgba(245, 158, 11, 0.8) 100%
    );
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
  }

  [data-theme="dark"] .recent-transactions td .status.overdue {
    background: linear-gradient(
      135deg,
      rgba(229, 83, 83, 0.8) 0%,
      rgba(239, 68, 68, 0.8) 100%
    );
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.3);
  }

  /* Filter results indicator */
  .filter-results-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 126, 199, 0.05);
    border-radius: 8px;
    margin: 0.5rem 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 126, 199, 0.1);
  }

  .filter-results-indicator .active-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .filter-results-indicator .filter-tag {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .filter-results-indicator .filter-tag .remove-filter {
    background: none;
    border: none;
    color: white;
    font-size: 0.6rem;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
  }

  .filter-results-indicator .filter-tag .remove-filter:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  .filter-results-indicator .clear-all {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s ease;
  }

  .filter-results-indicator .clear-all:hover {
    background: rgba(0, 126, 199, 0.1);
  }

  /* No results styling */
  .no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    background: var(--card-background);
    border-radius: 12px;
    margin: 0.5rem 0;
    border: 1px dashed var(--border-color);
  }

  .no-results i {
    font-size: 2rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
  }

  .no-results p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
  }

  .no-results a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 126, 199, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
  }

  .no-results a:hover {
    background: var(--primary-color);
    color: white;
  }

  /* Mobile-optimized pagination */
  .pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--card-background);
    border-radius: 16px;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }

  .page-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex: 1;
    min-width: 200px;
    font-weight: 500;
  }

  .page-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
  }

  .pagination-btn {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--card-background);
    color: var(--text-primary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: 600;
  }

  .pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 126, 199, 0.3);
  }

  .pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 126, 199, 0.3);
  }

  .pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }

  .pagination-ellipsis {
    padding: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
  }

  /* Mobile-optimized modals */
  .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .modal-content {
    background: var(--card-background);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: none;
  }

  .modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
  }

  .close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s ease;
  }

  .close-modal:hover {
    background: var(--background-color);
    color: var(--text-primary);
    transform: scale(1.1);
  }

  .modal-body {
    padding: 1.5rem;
  }

  .modal-footer {
    padding: 1.5rem;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
  }

  .btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
  }

  .btn.primary-btn {
    background: linear-gradient(
      135deg,
      var(--primary-color) 0%,
      var(--primary-dark) 100%
    );
    color: white;
    box-shadow: 0 4px 12px rgba(0, 126, 199, 0.3);
  }

  .btn.primary-btn:hover {
    background: linear-gradient(
      135deg,
      var(--primary-dark) 0%,
      var(--primary-color) 100%
    );
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 126, 199, 0.4);
  }

  /* Touch-friendly improvements */
  .action-card,
  .chart-card,
  .metric-card,
  .recent-transactions,
  .pagination-btn,
  .filter-select,
  .search-filter input,
  .btn {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  /* Improved scrolling */
  .table-responsive,
  .modal-content {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Better focus states for accessibility */
  .action-card:focus,
  .chart-card:focus,
  .metric-card:focus,
  .pagination-btn:focus,
  .filter-select:focus,
  .search-filter input:focus,
  .btn:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
  }

  /* Loading states */
  .loading {
    opacity: 0.7;
    pointer-events: none;
  }

  .loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }

  @keyframes spin {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  /* Pull-to-refresh indicator - REMOVED */
  /* This feature was causing issues on mobile devices */

  /* Mobile-optimized invoice modal stepper */
  .modal-stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
  }

  .modal-stepper::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
      90deg,
      var(--primary-color) 0%,
      var(--primary-light) 100%
    );
    z-index: 1;
  }

  .step-indicator {
    flex: 1;
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #666;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    border-radius: 0;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .step-indicator.active {
    color: var(--primary-color);
    background: rgba(0, 126, 199, 0.1);
    position: relative;
  }

  .step-indicator.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 0;
  }

  .step-indicator:not(.active):hover {
    background: rgba(0, 126, 199, 0.05);
    color: var(--text-primary);
  }

  /* Mobile-optimized invoice modal content */
  .modal-invoice .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    margin: 1rem;
  }

  .modal-invoice .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--card-background);
    z-index: 10;
    border-radius: 16px 16px 0 0;
  }

  .modal-invoice .modal-body {
    padding: 1.5rem;
  }

  .modal-invoice .modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    background: var(--card-background);
    z-index: 10;
    border-radius: 0 0 16px 16px;
  }

  /* Mobile-optimized step 3 items section */
  .items-table-container {
    padding: 0.5rem;
    overflow-x: auto;
    max-width: 100%;
  }

  /* Mobile card view improvements */
  @media (max-width: 768px) {
    .items-table-container {
      padding: 0.75rem;
    }

    .items-table {
      min-width: 100%;
      font-size: 0.95rem;
    }

    .items-table th {
      font-size: 0.9rem;
      font-weight: 600;
      padding: 0.75rem 0.5rem;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text-primary);
      background: var(--card-background);
      border-bottom: 2px solid var(--border-color);
    }

    .items-table td {
      padding: 0.75rem 0.5rem;
      font-size: 0.9rem;
      line-height: 1.4;
    }

    .items-table input,
    .items-table select {
      font-size: 0.9rem;
      padding: 0.6rem 0.5rem;
      min-height: 2.5rem;
    }

    /* Mobile pagination improvements */
    .items-pagination {
      padding: 1rem 0.75rem;
      background: var(--card-background);
      border-radius: 8px;
      margin-top: 1rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .pagination-controls {
      gap: 0.5rem;
      flex-wrap: wrap;
      justify-content: center;
    }

    .pagination-btn {
      padding: 0.6rem 1rem;
      font-size: 0.9rem;
      min-height: 2.5rem;
      font-weight: 500;
      border-radius: 6px;
    }

    .pagination-btn.active {
      background: var(--primary-color);
      color: white;
      font-weight: 600;
    }

    .pagination-btn.active:hover {
      background: var(--primary-dark);
    }
  }

  /* Mobile card view improvements */
  @media (max-width: 768px) {
    .items-table-container {
      padding: 0.75rem;
    }

    .items-table {
      min-width: 100%;
      font-size: 0.95rem;
    }

    .items-table th {
      font-size: 0.9rem;
      font-weight: 600;
      padding: 0.75rem 0.5rem;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text-primary);
      background: var(--card-background);
      border-bottom: 2px solid var(--border-color);
    }

    .items-table td {
      padding: 0.75rem 0.5rem;
      font-size: 0.9rem;
      line-height: 1.4;
    }

    .items-table input,
    .items-table select {
      font-size: 0.9rem;
      padding: 0.6rem 0.5rem;
      min-height: 2.5rem;
    }

    /* Mobile pagination improvements */
    .items-pagination {
      padding: 1rem 0.75rem;
      background: var(--card-background);
      border-radius: 8px;
      margin-top: 1rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .pagination-controls {
      gap: 0.5rem;
      flex-wrap: wrap;
      justify-content: center;
    }

    .pagination-btn {
      padding: 0.6rem 1rem;
      font-size: 0.9rem;
      min-height: 2.5rem;
      font-weight: 500;
      border-radius: 6px;
    }

    .pagination-btn.active {
      background: var(--primary-color);
      color: white;
      font-weight: 600;
    }

    .pagination-btn.active:hover {
      background: var(--primary-dark);
    }
  }
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.1rem; /* Increased from 0.85rem (29% larger) */
}

.items-table th {
  background: var(--background-color);
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  font-size: 1rem; /* Increased from 0.8rem (25% larger) */
}

.items-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.items-table input,
.items-table select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem; /* Increased from 0.8rem (25% larger) */
  background: var(--card-background);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.items-table input:focus,
.items-table select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
  outline: none;
}

/* Mobile-optimized item row cards */
.item-row {
  background: var(--card-background);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.item-row:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.item-row td {
  border: none;
  padding: 0.75rem;
}

.item-description-wrapper {
  position: relative;
}

.item-description {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1.1rem; /* Increased from 0.85rem (29% larger) */
  background: var(--card-background);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.item-description:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
  outline: none;
}

/* Item description help text - smaller and less prominent */
.item-description-help small {
  color: var(--text-light, #999) !important;
  font-size: 0.675rem !important; /* Decreased from 0.75rem (10% smaller) */
  margin-top: 0.25rem;
  display: block;
  opacity: 0.8;
}

/* Product creation UX improvements */
.product-creation-section {
  background: linear-gradient(
    135deg,
    var(--background-color) 0%,
    rgba(248, 250, 252, 0.8) 100%
  );
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
  border: 1px solid var(--border-color);
}

.product-creation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.product-creation-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.product-creation-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 0 0;
}

.product-creation-buttons {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.product-creation-btn {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-background);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}

.product-creation-btn:hover {
  border-color: var(--primary-color);
  background: rgba(0, 126, 199, 0.05);
  transform: translateY(-1px);
}

.product-creation-btn.primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.product-creation-btn.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 126, 199, 0.3);
}

/* Mobile-optimized items pagination */
.items-pagination {
  background: var(--card-background);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pagination-info {
  text-align: center;
  font-size: 1rem; /* Increased from 0.8rem (25% larger) */
  color: var(--text-secondary);
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-background);
  color: var(--text-primary);
  font-size: 1rem; /* Increased from 0.8rem (25% larger) */
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--primary-color);
  background: rgba(0, 126, 199, 0.05);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.items-limit-info {
  text-align: center;
  font-size: 0.85rem; /* Increased from 0.75rem (13% larger) */
  color: var(--text-light);
  font-style: italic;
}

/* Mobile-optimized invoice totals */
.invoice-totals {
  background: var(--card-background);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 1.2rem; /* Increased from 0.95rem (26% larger) */
  color: var(--text-primary);
}

.totals-row:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

.totals-row:last-child {
  font-weight: 700;
  font-size: 1.4rem; /* Increased from 1.1rem (27% larger) */
  color: var(--primary-color);
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border-color);
}

/* Mobile-optimized form groups */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem; /* Increased from 0.9rem (22% larger) */
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-background);
  color: var(--text-primary);
  font-size: 1.1rem; /* Increased from 0.9rem (22% larger) */
  transition: all 0.2s ease;
  min-height: 44px;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
  outline: none;
}

/* Mobile-optimized step footer */
.step-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.step-footer .btn {
  flex: 1;
  min-width: 120px;
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem; /* Increased from 0.9rem (22% larger) */
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.2s ease;
  min-height: 44px;
}

/* Dark mode optimizations for invoice modal */
@media (max-width: 768px) {
  [data-theme="dark"] .modal-stepper {
    background: #2a2d3a;
  }

  [data-theme="dark"] .step-indicator {
    color: #a0a0a0;
  }

  [data-theme="dark"] .step-indicator.active {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
  }

  [data-theme="dark"] .items-table-container,
  [data-theme="dark"] .product-creation-section,
  [data-theme="dark"] .items-pagination,
  [data-theme="dark"] .invoice-totals {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .items-table th {
    background: #2a2d3a;
    color: #a0a0a0;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .items-table input,
  [data-theme="dark"] .items-table select,
  [data-theme="dark"] .item-description {
    background: #23262f;
    color: #fff;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .product-creation-btn {
    background: #23262f;
    color: #fff;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .product-creation-btn:hover {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
  }

  [data-theme="dark"] .product-creation-btn.primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
  }

  [data-theme="dark"] .product-creation-btn.primary:hover {
    background: #1e40af;
    border-color: #1e40af;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  }

  [data-theme="dark"] .product-creation-section {
    background: linear-gradient(135deg, #23262f 0%, rgba(35, 38, 47, 0.8) 100%);
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .pagination-btn {
    background: #23262f;
    color: #fff;
    border-color: #2a2d3a;
  }
}

/* Enhanced Modal Responsiveness Fixes */
/* Fixes scroll issues, see-through problems, and improves UX */

/* Modal base fixes */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent; /* Overlay handles the background */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 0; /* Remove padding to prevent scroll */
}

.modal.show,
.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-background, #ffffff);
  border-radius: 20px;
  width: 100%;
  max-width: 600px; /* Increased for better content visibility */
  max-height: 95vh; /* Increased height */
  overflow: hidden; /* Prevent double scrollbars */
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color, #e0e0e0);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Modal header - sticky and solid */
.modal-header {
  padding: 1.5rem;
  border-bottom: 2px solid var(--border-color, #e0e0e0);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-background, #ffffff);
  position: sticky;
  top: 0;
  z-index: 15;
  border-radius: 20px 20px 0 0;
  flex-shrink: 0; /* Prevent header from shrinking */
}

.modal-header h2 {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 700;
  color: var(--text-primary, #333);
}

/* Modal body - scrollable content area */
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  background: var(--card-background, #ffffff);
}

/* Modal footer - sticky and solid */
.modal-footer {
  padding: 1.5rem;
  border-top: 2px solid var(--border-color, #e0e0e0);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  background: var(--card-background, #ffffff);
  position: sticky;
  bottom: 0;
  z-index: 15;
  border-radius: 0 0 20px 20px;
  flex-shrink: 0; /* Prevent footer from shrinking */
}

/* Enhanced stepper for better mobile experience */
.modal-stepper {
  display: flex;
  background: var(--background-color, #f8f9fa);
  border-radius: 16px;
  margin-bottom: 2rem;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color, #e0e0e0);
  flex-shrink: 0; /* Prevent stepper from shrinking */
  position: relative;
}

.modal-stepper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color, #007ec7) 0%,
    var(--primary-light, #60a5fa) 100%
  );
  z-index: 1;
}

.step-indicator {
  flex: 1;
  padding: 1.25rem 0.75rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary, #666);
  background: var(--background-color, #f8f9fa);
  border-right: 1px solid var(--border-color, #e0e0e0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.step-indicator:last-child {
  border-right: none;
}

.step-indicator.active {
  background: var(--primary-color, #007ec7);
  color: white;
  box-shadow: 0 4px 16px rgba(0, 126, 199, 0.4);
  transform: translateY(-2px);
}

.step-indicator.completed {
  background: var(--success-color, #10b981);
  color: white;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.step-indicator:hover:not(.active):not(.completed) {
  background: rgba(0, 126, 199, 0.05);
  color: var(--primary-color, #007ec7);
  transform: translateY(-1px);
}

.step-indicator::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-color, #007ec7);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.step-indicator.active::after,
.step-indicator.completed::after {
  transform: scaleX(1);
}

/* Enhanced step content with better spacing */
.step {
  background: var(--card-background, #ffffff);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color, #e0e0e0);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

/* Mobile-specific stepper and pagination improvements */
@media (max-width: 768px) {
  .modal-stepper {
    margin-bottom: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .step-indicator {
    padding: 1rem 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    min-height: 48px;
  }

  .step {
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 12px;
  }

  /* Mobile pagination improvements */
  .items-pagination {
    padding: 1rem 0.75rem;
    background: var(--card-background);
    border-radius: 8px;
    margin-top: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .pagination-controls {
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .pagination-btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    min-height: 2.5rem;
    font-weight: 500;
    border-radius: 6px;
  }

  .pagination-btn.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
  }

  .pagination-btn.active:hover {
    background: var(--primary-dark);
  }
}

.step::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary-color, #007ec7) 0%,
    var(--primary-light, #60a5fa) 100%
  );
  border-radius: 16px 16px 0 0;
}

.step h3 {
  color: var(--text-primary, #333);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--primary-color, #007ec7);
  position: relative;
}

.step h3::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--primary-color, #007ec7);
  border-radius: 1px;
}

/* Step content wrapper for better organization */
.step-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Enhanced form layout with better spacing */
.form-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.form-group {
  flex: 1;
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-primary, #333);
  font-size: 0.95rem;
  position: relative;
}

.form-group label::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 20px;
  height: 2px;
  background: var(--primary-color, #007ec7);
  border-radius: 1px;
  opacity: 0.6;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border-color, #e0e0e0);
  border-radius: 12px;
  background: var(--card-background, #ffffff);
  color: var(--text-primary, #333);
  font-size: 16px; /* Prevent zoom on iOS */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 52px;
  box-sizing: border-box;
  font-weight: 500;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-color, #007ec7);
  box-shadow: 0 0 0 4px rgba(0, 126, 199, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

/* Enhanced step footer with better button styling */
.step-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: var(--card-background, #ffffff);
  border-top: 2px solid var(--border-color, #e0e0e0);
  margin: 2rem -2rem -2rem -2rem;
  border-radius: 0 0 16px 16px;
  position: sticky;
  bottom: 0;
  z-index: 10;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

.step-footer .btn {
  flex: 1;
  min-width: 140px;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 52px;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.step-footer .btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.step-footer .btn:hover::before {
  left: 100%;
}

.step-footer .btn.primary-btn {
  background: linear-gradient(
    135deg,
    var(--primary-color, #007ec7) 0%,
    var(--primary-dark, #1e40af) 100%
  );
  color: white;
  box-shadow: 0 6px 20px rgba(0, 126, 199, 0.4);
}

.step-footer .btn.primary-btn:hover {
  background: linear-gradient(
    135deg,
    var(--primary-dark, #1e40af) 0%,
    var(--primary-color, #007ec7) 100%
  );
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 126, 199, 0.5);
}

.step-footer .btn.secondary-btn {
  background: var(--background-color, #f8f9fa);
  color: var(--text-primary, #333);
  border: 2px solid var(--border-color, #e0e0e0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.step-footer .btn.secondary-btn:hover {
  background: var(--border-color, #e0e0e0);
  border-color: var(--primary-color, #007ec7);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Enhanced review section with better organization */
.review-section-wrapper {
  background: linear-gradient(
    135deg,
    var(--background-color, #f8f9fa) 0%,
    rgba(248, 250, 252, 0.8) 100%
  );
  border-radius: 16px;
  padding: 2rem;
  border: 1px solid var(--border-color, #e0e0e0);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.review-section-wrapper h3 {
  color: var(--primary-color, #007ec7);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary-color, #007ec7);
}

.review-section {
  background: var(--card-background, #ffffff);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color, #e0e0e0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Enhanced preview action section */
.preview-action-section {
  text-align: center;
  padding: 2rem;
  background: var(--card-background, #ffffff);
  border-radius: 12px;
  border: 2px dashed var(--primary-color, #007ec7);
  position: relative;
  overflow: hidden;
}

.preview-action-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 126, 199, 0.05) 0%,
    rgba(96, 165, 250, 0.05) 100%
  );
  z-index: 0;
}

.preview-action-section > * {
  position: relative;
  z-index: 1;
}

.preview-btn {
  background: linear-gradient(
    135deg,
    var(--primary-color, #007ec7) 0%,
    var(--primary-light, #60a5fa) 100%
  );
  color: white;
  border: none;
  padding: 1.25rem 2.5rem;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 60px;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 8px 25px rgba(0, 126, 199, 0.4);
  margin-bottom: 1rem;
}

.preview-btn:hover {
  background: linear-gradient(
    135deg,
    var(--primary-light, #60a5fa) 0%,
    var(--primary-color, #007ec7) 100%
  );
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(0, 126, 199, 0.5);
}

.preview-btn i {
  font-size: 1.25rem;
}

.preview-help-text {
  color: var(--text-secondary, #666);
  font-size: 0.9rem;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0.8;
}

.preview-help-text i {
  color: var(--primary-color, #007ec7);
  font-size: 0.875rem;
}

/* Enhanced items table for mobile */
.items-table-container {
  background: var(--card-background, #ffffff);
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color, #e0e0e0);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.items-table {
  width: 100%;
  min-width: 800px; /* Ensure table doesn't break on mobile */
  border-collapse: collapse;
  font-size: 0.9rem;
}

.items-table th {
  background: var(--background-color, #f8f9fa);
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary, #666);
  border-bottom: 2px solid var(--border-color, #e0e0e0);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
}

.items-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  vertical-align: middle;
}

.items-table input,
.items-table select {
  width: 100%;
  min-width: 60px;
  padding: 0.75rem;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--card-background, #ffffff);
  color: var(--text-primary, #333);
  transition: all 0.2s ease;
}

.items-table input:focus,
.items-table select:focus {
  border-color: var(--primary-color, #007ec7);
  box-shadow: 0 0 0 3px rgba(0, 126, 199, 0.1);
  outline: none;
}

/* Enhanced invoice totals */
.invoice-totals {
  background: var(--card-background, #ffffff);
  border-radius: 16px;
  padding: 2rem;
  margin: 2rem 0;
  border: 1px solid var(--border-color, #e0e0e0);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.invoice-totals::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--success-color, #10b981) 0%,
    var(--primary-color, #007ec7) 100%
  );
  border-radius: 16px 16px 0 0;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  font-size: 1.1rem;
  font-weight: 500;
}

.totals-row:last-child {
  border-bottom: none;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--primary-color, #007ec7);
  padding-top: 1.5rem;
  margin-top: 1rem;
  border-top: 2px solid var(--primary-color, #007ec7);
}

/* Enhanced review section for better visibility */
#invoiceReviewSummary {
  background: var(--background-color, #f8f9fa);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid var(--border-color, #e0e0e0);
  font-size: 1rem;
  line-height: 1.7;
}

#invoiceReviewSummary h4 {
  color: var(--primary-color, #007ec7);
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}

#invoiceReviewSummary p {
  margin-bottom: 0.75rem;
  color: var(--text-primary, #333);
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
  .modal {
    padding: 0.5rem;
  }

  .modal-content {
    max-height: 98vh;
    border-radius: 16px;
    margin: 0;
  }

  .modal-header {
    padding: 1.25rem;
    border-radius: 16px 16px 0 0;
  }

  .modal-body {
    padding: 1.25rem;
  }

  .modal-footer {
    padding: 1.25rem;
    border-radius: 0 0 16px 16px;
  }

  .step {
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 12px;
  }

  .step-footer {
    padding: 1.5rem;
    margin: 1.5rem -1.5rem -1.5rem -1.5rem;
    border-radius: 0 0 12px 12px;
    flex-direction: column;
    gap: 1rem;
  }

  .step-footer .btn {
    width: 100%;
    min-width: auto;
    padding: 1rem 1.5rem;
  }

  .form-row {
    flex-direction: column;
    gap: 1rem;
  }

  .step-indicator {
    font-size: 0.75rem;
    padding: 0.75rem 0.25rem;
    min-height: 44px;
  }

  .items-table-container {
    padding: 1rem;
    margin: 1rem 0;
  }

  .invoice-totals {
    padding: 1.5rem;
    margin: 1.5rem 0;
  }

  .review-section {
    padding: 1.5rem;
    margin: 1.5rem 0;
  }

  .review-section-wrapper {
    padding: 1.5rem;
  }

  .preview-action-section {
    padding: 1.5rem;
  }

  .preview-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    min-height: 56px;
  }

  .step-content-wrapper {
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .modal-content {
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .modal-header {
    border-radius: 0;
    padding: 1rem;
  }

  .modal-footer {
    border-radius: 0;
    padding: 1rem;
  }

  .step {
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 8px;
  }

  .step-footer {
    padding: 1rem;
    margin: 1rem -1rem -1rem -1rem;
    border-radius: 0 0 8px 8px;
  }

  .step-indicator {
    font-size: 0.7rem;
    padding: 0.5rem 0.25rem;
    min-height: 40px;
  }

  .preview-btn {
    padding: 0.875rem 1.75rem;
    font-size: 0.95rem;
    min-height: 52px;
  }

  .step-content-wrapper {
    gap: 1rem;
  }

  .review-section-wrapper {
    padding: 1rem;
  }

  .preview-action-section {
    padding: 1rem;
  }

  .invoice-totals {
    padding: 1rem;
    margin: 1rem 0;
  }

  .items-table-container {
    padding: 0.75rem;
    margin: 0.75rem 0;
  }

  .items-pagination {
    padding: 1rem;
    margin: 1rem 0;
  }
}

/* Dark mode enhancements */
[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .modal-content {
  background: #23262f;
  border-color: #2a2d3a;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .step,
[data-theme="dark"] .items-table-container,
[data-theme="dark"] .invoice-totals,
[data-theme="dark"] .review-section,
[data-theme="dark"] .review-section-wrapper,
[data-theme="dark"] .preview-action-section {
  background: #23262f;
  border-color: #2a2d3a;
}

[data-theme="dark"] .step-indicator {
  background: #181a20;
  color: #a0a0a0;
  border-color: #2a2d3a;
}

[data-theme="dark"] .step-indicator.active {
  background: #2563eb;
  color: #ffffff;
}

[data-theme="dark"] .step-indicator.completed {
  background: #059669;
  color: #ffffff;
}

[data-theme="dark"] .items-table th {
  background: #181a20;
  color: #a0a0a0;
  border-color: #2a2d3a;
}

[data-theme="dark"] .items-table td {
  border-color: #2a2d3a;
}

[data-theme="dark"] .items-table input,
[data-theme="dark"] .items-table select {
  background: #23262f;
  color: #ffffff;
  border-color: #2a2d3a;
}

[data-theme="dark"] #invoiceReviewSummary {
  background: #181a20;
  border-color: #2a2d3a;
  color: #e5e7eb;
}

[data-theme="dark"] .review-section-wrapper {
  background: linear-gradient(135deg, #181a20 0%, rgba(34, 38, 47, 0.8) 100%);
}

[data-theme="dark"] .preview-action-section {
  background: #23262f;
  border-color: #60a5fa;
}

[data-theme="dark"] .preview-action-section::before {
  background: linear-gradient(
    135deg,
    rgba(96, 165, 250, 0.1) 0%,
    rgba(37, 99, 235, 0.1) 100%
  );
}

/* Fix for see-through issues */
.modal::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: -1;
}

/* Ensure modal content is fully opaque */
.modal-content,
.modal-header,
.modal-body,
.modal-footer,
.step,
.step-footer,
.items-table-container,
.invoice-totals,
.review-section,
.review-section-wrapper,
.preview-action-section {
  background: var(--card-background, #ffffff) !important;
}

[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .step,
[data-theme="dark"] .step-footer,
[data-theme="dark"] .items-table-container,
[data-theme="dark"] .invoice-totals,
[data-theme="dark"] .review-section,
[data-theme="dark"] .review-section-wrapper,
[data-theme="dark"] .preview-action-section {
  background: #23262f !important;
}

/* Enhanced scroll behavior */
.modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color, #e0e0e0) transparent;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color, #e0e0e0);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color, #007ec7);
}

/* Ensure proper z-index stacking */
.modal {
  z-index: 2000;
}

.modal-content {
  z-index: 2001;
}

.modal-header {
  z-index: 2002;
}

.modal-footer {
  z-index: 2002;
}

.step-footer {
  z-index: 2003;
}

/* Fix for floating elements interfering with modal */
.modal .floating-icon,
.modal .chat-widget {
  display: none !important;
}

/* Enhanced focus management for accessibility */
.modal:focus-within {
  outline: none;
}

.modal-content:focus-within {
  outline: 2px solid var(--primary-color, #007ec7);
  outline-offset: 2px;
}

/* Smooth transitions for all modal elements */
.modal,
.modal-content,
.modal-header,
.modal-body,
.modal-footer,
.step,
.step-footer {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced client input wrapper */
.client-input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
  position: relative;
  overflow: visible;
  z-index: 1;
  margin-bottom: 2rem;
}

/* Ensure parent containers don't clip suggestions */
.form-group {
  overflow: visible !important;
  position: relative;
  margin-bottom: 1rem;
}

.accordion-body {
  overflow: visible !important;
}

.form-row {
  overflow: visible !important;
}

/* Modal specific overrides for client suggestions */
.modal .form-group {
  overflow: visible !important;
}

.modal .accordion-body {
  overflow: visible !important;
}

.modal .form-row {
  overflow: visible !important;
}

.modal .client-input-wrapper {
  overflow: visible !important;
}

.client-input-wrapper input {
  flex: 1;
  min-width: 200px;
}

.client-input-wrapper .btn {
  white-space: nowrap;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  min-height: 52px;
}

/* Estilos para a lista de sugestões de clientes personalizada */
.client-suggestions {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--card-background, #ffffff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: var(--card-radius, 8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  max-height: 400px;
  overflow: hidden;
  animation: fadeInDown 0.2s ease-out;
  display: block !important;
  min-height: 50px;
  transform: translateY(0);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.client-suggestions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--background-secondary, #f8f9fa);
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary, #333);
}

.suggestions-title {
  color: var(--text-primary, #333);
}

.close-suggestions {
  background: none;
  border: none;
  color: var(--text-secondary, #666);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.close-suggestions:hover {
  background: var(--hover-background, #f0f0f0);
  color: var(--text-primary, #333);
}

.client-suggestions-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.client-suggestion-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light, #f5f5f5);
  transition: all 0.2s ease;
  position: relative;
}

.client-suggestion-item:last-child {
  border-bottom: none;
}

.client-suggestion-item:hover {
  background: var(--hover-background, #f8f9fa);
}

.client-suggestion-item.selected {
  background: var(--primary-color-light, #e3f2fd);
  border-left: 3px solid var(--primary-color, #007ec7);
}

.client-suggestion-info {
  flex: 1;
  min-width: 0;
}

.client-suggestion-name {
  font-weight: 600;
  color: var(--text-primary, #333);
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.client-suggestion-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary, #666);
}

.client-suggestion-detail {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.client-suggestion-detail i {
  width: 12px;
  text-align: center;
  color: var(--text-muted, #999);
}

.client-suggestion-code {
  background: var(--primary-color-light, #e3f2fd);
  color: var(--primary-color, #007ec7);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Modo escuro para as sugestões de clientes */
[data-theme="dark"] .client-suggestions {
  background: var(--card-background, #23262f) !important;
  border-color: var(--border-color, #2a2d3a) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .client-suggestions-header {
  background: var(--background-secondary, #181a20) !important;
  border-bottom-color: var(--border-color, #2a2d3a) !important;
}

[data-theme="dark"] .suggestions-title {
  color: var(--text-primary, #e0e0e0) !important;
}

[data-theme="dark"] .close-suggestions {
  color: var(--text-secondary, #888) !important;
}

[data-theme="dark"] .close-suggestions:hover {
  background: var(--hover-background, #32353f) !important;
  color: var(--text-primary, #e0e0e0) !important;
}

[data-theme="dark"] .client-suggestion-item {
  border-bottom-color: var(--border-light, #2a2d3a) !important;
}

[data-theme="dark"] .client-suggestion-item:hover {
  background: var(--hover-background, #32353f) !important;
}

[data-theme="dark"] .client-suggestion-item.selected {
  background: var(--primary-color-light, #1e3a8a) !important;
  border-left-color: var(--primary-color, #60a5fa) !important;
}

[data-theme="dark"] .client-suggestion-name {
  color: var(--text-primary, #e0e0e0) !important;
}

[data-theme="dark"] .client-suggestion-details {
  color: var(--text-secondary, #888) !important;
}

[data-theme="dark"] .client-suggestion-detail i {
  color: var(--text-muted, #666) !important;
}

[data-theme="dark"] .client-suggestion-code {
  background: var(--primary-color-light, #1e3a8a) !important;
  color: var(--primary-color, #60a5fa) !important;
}

/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
  .client-suggestions {
    max-height: 300px;
    margin-top: 0.25rem;
  }

  .client-suggestions-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .client-suggestion-item {
    padding: 0.5rem 0.75rem;
  }

  .client-suggestion-name {
    font-size: 0.9rem;
  }

  .client-suggestion-details {
    font-size: 0.75rem;
    gap: 0.5rem;
  }

  .client-suggestion-detail {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
  }
}

/* Enhanced form help text */
.form-help-text {
  color: var(--text-secondary, #666);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  line-height: 1.4;
  opacity: 0.8;
}

/* Enhanced item action buttons */
.item-action-buttons {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.item-action-buttons .btn {
  padding: 0.875rem 1.5rem;
  font-size: 0.9rem;
  min-height: 48px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.item-action-buttons .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Enhanced items pagination */
.items-pagination {
  background: var(--background-color, #f8f9fa);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color, #e0e0e0);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pagination-info {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-secondary, #666);
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pagination-controls .pagination-btn {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  background: var(--card-background, #ffffff);
  color: var(--text-primary, #333);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-controls .pagination-btn:hover:not(:disabled) {
  border-color: var(--primary-color, #007ec7);
  background: rgba(0, 126, 199, 0.05);
  transform: translateY(-1px);
}

.pagination-controls .pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.items-limit-info {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-light, #999);
  font-style: italic;
  opacity: 0.7;
}

/* Enhanced focus states and accessibility */
.modal:focus-within {
  outline: none;
}

.modal-content:focus-within {
  outline: 2px solid var(--primary-color, #007ec7);
  outline-offset: 2px;
}

/* Enhanced button states and interactions */
.btn:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

/* Improved mobile touch targets */
@media (max-width: 768px) {
  .step-indicator {
    font-size: 0.8rem;
    padding: 1rem 0.5rem;
    min-height: 48px;
  }

  .modal-stepper {
    margin-bottom: 1.5rem;
    border-radius: 12px;
  }

  .step {
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: 12px;
  }

  .step-content-wrapper {
    gap: 1.5rem;
  }

  .form-group input:not([type="checkbox"]):not([type="radio"]),
  .form-group select,
  .form-group textarea {
    min-height: 48px;
    padding: 0.875rem;
  }

  .preview-btn {
    width: 100%;
    max-width: 300px;
    padding: 1rem 2rem;
    font-size: 1rem;
    min-height: 56px;
  }

  .review-section-wrapper {
    padding: 1.25rem;
  }

  .preview-action-section {
    padding: 1.5rem;
  }

  .invoice-totals {
    padding: 1.5rem;
    margin: 1.5rem 0;
  }

  .items-table-container {
    padding: 1rem;
    margin: 1rem 0;
  }

  .item-action-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .item-action-buttons .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .modal {
    padding: 0.25rem;
  }

  .modal-content {
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .modal-header {
    border-radius: 0;
    padding: 1rem;
  }

  .modal-footer {
    border-radius: 0;
    padding: 1rem;
  }

  .step {
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 8px;
  }

  .step-footer {
    padding: 1rem;
    margin: 1rem -1rem -1rem -1rem;
    border-radius: 0 0 8px 8px;
  }

  .step-indicator {
    font-size: 0.75rem;
    padding: 0.75rem 0.25rem;
    min-height: 44px;
  }

  .modal-stepper {
    margin-bottom: 1rem;
    border-radius: 8px;
  }

  .step-content-wrapper {
    gap: 1rem;
  }

  .form-row {
    gap: 0.75rem;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  .preview-btn {
    padding: 0.875rem 1.75rem;
    font-size: 0.95rem;
    min-height: 52px;
    max-width: none;
  }

  .review-section-wrapper {
    padding: 1rem;
  }

  .preview-action-section {
    padding: 1rem;
  }

  .invoice-totals {
    padding: 1rem;
    margin: 1rem 0;
  }

  .items-table-container {
    padding: 0.75rem;
    margin: 0.75rem 0;
  }

  .items-pagination {
    padding: 1rem;
    margin: 1rem 0;
  }
}

/* Enhanced dark mode for mobile */
@media (max-width: 768px) {
  [data-theme="dark"] .step {
    background: #23262f;
    border-color: #2a2d3a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  }

  [data-theme="dark"] .modal-stepper {
    background: #181a20;
    border-color: #2a2d3a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }

  [data-theme="dark"] .step-indicator {
    background: #181a20;
    color: #a0a0a0;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .step-indicator.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  }

  [data-theme="dark"] .step-indicator.completed {
    background: #059669;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.4);
  }

  [data-theme="dark"] .step-indicator:hover:not(.active):not(.completed) {
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
  }
}

/* Enhanced animations and transitions */
.step,
.step-footer,
.items-table-container,
.invoice-totals,
.review-section,
.review-section-wrapper,
.preview-action-section {
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Enhanced hover effects for interactive elements */
.form-group input:not([type="checkbox"]):not([type="radio"]):hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: var(--primary-color, #007ec7);
  box-shadow: 0 2px 8px rgba(0, 126, 199, 0.1);
}

.items-table input:hover,
.items-table select:hover {
  border-color: var(--primary-color, #007ec7);
  box-shadow: 0 2px 8px rgba(0, 126, 199, 0.1);
}

/* Enhanced focus indicators for better accessibility */
.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus,
.form-group textarea:focus,
.items-table input:focus,
.items-table select:focus {
  outline: none;
  border-color: var(--primary-color, #007ec7);
  box-shadow: 0 0 0 4px rgba(0, 126, 199, 0.15);
}

/* Enhanced button focus states */
.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 126, 199, 0.3);
}

/* Enhanced stepper focus states */
.step-indicator:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 126, 199, 0.3);
}

/* Enhanced mobile scrollbar styling */
@media (max-width: 768px) {
  .modal-body::-webkit-scrollbar {
    width: 4px;
  }

  .modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-color, #007ec7);
    border-radius: 2px;
  }

  .modal-body::-webkit-scrollbar-track {
    background: var(--background-color, #f8f9fa);
    border-radius: 2px;
  }
}

/* Enhanced loading states */
.step.loading {
  opacity: 0.7;
  pointer-events: none;
}

.step.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid var(--border-color, #e0e0e0);
  border-top: 2px solid var(--primary-color, #007ec7);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 10;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Enhanced error states */
.step.error {
  border-color: var(--danger-color, #ef4444);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
}

.step.error::before {
  background: linear-gradient(
    90deg,
    var(--danger-color, #ef4444) 0%,
    #f87171 100%
  );
}

/* Enhanced success states */
.step.success {
  border-color: var(--success-color, #10b981);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

.step.success::before {
  background: linear-gradient(
    90deg,
    var(--success-color, #10b981) 0%,
    #34d399 100%
  );
}

/* Additional mobile optimizations for very small screens */
@media (max-width: 480px) {
  .settings-nav {
    padding: 0.75rem !important;
    margin-bottom: 1rem !important;
    width: 100rem !important;
  }

  .settings-tabs li a {
    min-width: 45px !important;
    /*        height: 45px !important;  */
    padding: 0.6rem !important;
  }

  .settings-tabs li a i {
    font-size: 1.1rem !important;
  }

  .settings-tabs li a span {
    display: none !important;
  }

  .settings-section {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .section-header {
    margin-bottom: 1rem !important;
    padding-bottom: 0.75rem !important;
  }

  .section-header h2 {
    font-size: 1rem !important;
  }

  .section-header p {
    font-size: 0.8rem !important;
  }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  .settings-nav {
    top: calc(var(--topbar-height) + 0.5rem) !important;
    padding: 0.75rem !important;
    margin-bottom: 1rem !important;
  }

  .settings-tabs li a {
    height: 45px !important;
    padding: 0.6rem !important;
  }

  .settings-tabs li a i {
    font-size: 1.1rem !important;
  }

  .settings-tabs li a span {
    display: none !important;
  }

  .settings-section {
    padding: 1.25rem !important;
    margin-bottom: 1.25rem !important;
  }
}

/* Improve touch targets */

/* Additional mobile UX improvements for settings page */
@media (max-width: 768px) {
  @keyframes tabActivate {
    0% {
      transform: translateY(-2px) scale(0.95) !important;
      opacity: 0.8 !important;
    }
    100% {
      transform: translateY(-2px) scale(1) !important;
      opacity: 1 !important;
    }
  }

  @keyframes sectionFadeIn {
    from {
      opacity: 0 !important;
      transform: translateY(10px) !important;
    }
    to {
      opacity: 1 !important;
      transform: translateY(0) !important;
    }
  }

  /* Prevent horizontal scroll on settings page */
  .settings-container {
    overflow-x: hidden !important;
    width: 100% !important;
  }

  /* Better spacing for mobile forms */
  .form-group {
    margin-bottom: 1.5rem !important;
  }

  .form-row {
    gap: 1rem !important;
    margin-bottom: 1.5rem !important;
  }

  .form-control {
    margin-bottom: 1rem !important;
  }

  /* Mobile-optimized buttons */
  .form-actions .btn {
    width: 100% !important;
    margin-bottom: 0.75rem !important;
    padding: 0.875rem 1.5rem !important;
    font-size: 1rem !important;
    min-height: 48px !important;
  }

  .form-actions .btn:last-child {
    margin-bottom: 0 !important;
  }

  /* Better mobile spacing for settings header */
  .settings-header {
    position: fixed !important;
    margin-bottom: 1.5rem !important;
    padding: 1rem 0 !important;
  }

  .settings-header h1 {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem !important;
    line-height: 1.3 !important;
  }

  .settings-header p {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    color: var(--text-secondary) !important;
  }
}

@media (max-width: 768px) {
  /* Ensure tabs never wrap and fit in one horizontal row */
  .settings-tabs {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }
  .settings-tabs li {
    margin: 0 !important;
    flex: 0 0 auto !important;
  }

  /* Lift the page up to reduce wasted space */
  .main-content {
    margin-top: 0.15rem !important;
  }
  .settings-header {
    margin: 0.25rem 0 0.5rem 0 !important;
    padding: 0 !important;
  }
  .settings-header h1 {
    font-size: 1.3rem !important;
    margin: 0.25rem 0 0.25rem 0 !important;
  }
  .settings-header p {
    font-size: 0.8rem !important;
    margin: 0 0 0.25rem 0 !important;
  }

  /* Move the icons bar higher and make it tighter */
  .settings-nav {
    top: 9rem !important;
    padding: 0.5rem !important;
    /*	margin-bottom: 0.75rem !important; */
    border-radius: 6px !important;
    width: 100rem !important;
    position: fixed !important;
    z-index: 1000 !important;
    left: 1rem !important;
    right: 1rem !important;
    width: calc(100% - 2rem) !important;
  }
}

@media (max-width: 480px) {
  /* Extra small phones: even smaller buttons */
  .settings-tabs li a {
    min-width: 38px !important;
    height: 38px !important;
    padding: 0.45rem !important;
  }
  .settings-tabs li a i {
    font-size: 1rem !important;
  }
  .settings-header h1 {
    font-size: 1.2rem !important;
  }
}

/* Prevent content from shifting horizontally */
.settings-container {
  overflow-x: hidden !important;
  width: 100% !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Fixed positioning for settings content below the fixed nav - MOBILE ONLY */
@media (max-width: 768px) {
  .settings-content {
    position: fixed !important;
    top: calc(
      var(--topbar-height, 60px) + 100px
    ) !important; /* Below topbar + settings-nav */
    left: 0.5rem !important;
    right: 0.5rem !important;
    bottom: 0.5rem !important;
    overflow-y: auto !important;
    background: var(--card-background, #ffffff) !important;
    border-radius: 12px !important;
    padding: 1rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    z-index: 50 !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Dark mode for fixed settings content */
  [data-theme="dark"] .settings-content {
    background: #23262f !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }
}

/* Extra small screen adjustments */
@media (max-width: 480px) {
  .settings-content {
    top: calc(
      var(--topbar-height, 60px) + 90px
    ) !important; /* Even closer on small screens */
    left: 0.25rem !important;
    right: 0.25rem !important;
    bottom: 0.25rem !important;
    padding: 0.75rem !important;
    border-radius: 8px !important;
  }
}

/* Ensure the tabs container doesn't cause page shift */
.settings-tabs {
  flex-wrap: nowrap !important;
  gap: 1.2rem !important;

  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.settings-tabs::-webkit-scrollbar {
  display: none !important;
}

.search-filter {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
}

.search-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-input-group input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-background);
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
  min-height: 36px;
  box-sizing: border-box;
}

.search-input-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
  outline: none;
}

.clear-filters-btn {
  padding: 0.6rem 0.75rem;
  background-color: #f0f0f0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.clear-filters-btn:hover {
  background-color: #e0e0e0;
}

/* Mobile-optimized clients page */
@media (max-width: 768px) {
  /* Client management layout */
  .client-management {
    gap: 1rem;
    margin: 0;
    padding: 0;
  }

  /* Page header mobile optimization */
  .page-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 1rem;
  }

  .page-header h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0;
  }

  .page-header .primary-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1rem;
    min-height: 48px;
  }

  /* Sticky form header for better mobile UX */
  .frame-left h2 {
    position: sticky;
    top: 0;
    background: var(--card-background);
    padding: 0.75rem 0;
    margin: 0 0 1rem 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 1.25rem;
    text-align: center;
  }

  /* Frame mobile optimization - FIXED OVERLAP ISSUE */
  .frame {
    margin-bottom: 1.5rem; /* Increased separation between frames */
    border-radius: 12px;
    position: relative;
    z-index: 1;
  }

  .frame-left {
    order: 2;
    padding: 1rem;
    position: relative;
    z-index: 1;
    margin-top: 1.5rem; /* Increased separation between list and form */
  }

  .frame-right {
    order: 1;
    padding: 0.75rem;
    position: relative;
    z-index: 2;
  }

  /* Search bar mobile optimization - FIXED OVERLAP */
  .search-bar-frame {
    padding: 0.5rem;
    position: relative !important; /* Force relative positioning */
    z-index: 1 !important; /* Lower z-index to prevent overlap */
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    top: auto !important; /* Remove any sticky positioning */
  }

  .search-input-wrapper {
    margin-bottom: 0.5rem;
  }

  .search-input-wrapper input {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 0.75rem 0.75rem 0.75rem 2.25rem;
    min-height: 44px;
  }

  .search-input-wrapper i {
    left: 10px;
    font-size: 0.9rem;
  }

  .filter-options {
    flex-direction: row; /* Keep horizontal for better space usage */
    gap: 0.375rem;
  }

  .filter-options select {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 0.75rem;
    min-height: 44px;
    font-size: 0.9rem;
  }

  /* Client list header mobile optimization */
  .client-list-header {
    padding: 0.5rem;
    flex-direction: row; /* Keep horizontal for better space usage */
    gap: 0.5rem;
    align-items: center;
    position: relative;
    z-index: 1;
  }

  .client-list-header h3 {
    text-align: left; /* Align left instead of center */
    font-size: 1rem;
    margin: 0;
    flex: 1; /* Take available space */
  }

  .view-options {
    justify-content: flex-end; /* Align to the right */
    gap: 0.25rem;
  }

  .view-btn {
    padding: 0.5rem;
    min-width: 36px;
    min-height: 36px;
    font-size: 0.85rem;
  }

  /* Client list mobile optimization */
  .client-list {
    min-height: auto !important;
    max-height: none !important;
    padding: 0.75rem !important;
    -webkit-overflow-scrolling: touch !important;
    position: relative !important;
    z-index: 1 !important;
    overflow: visible !important;
  }

  .client-list-content {
    min-height: auto !important;
    position: relative !important;
    z-index: 1 !important;
  }

  /* Client cards mobile optimization */
  .client-card {
    padding: 0.9rem !important;
    margin-bottom: 0.6rem !important;
    border-radius: 10px !important;
    position: relative !important;
    z-index: 1 !important;
  }

  .client-header {
    flex-direction: row; /* Keep horizontal for better space usage */
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
  }

  .client-name {
    font-size: 1.05rem !important;
    margin-bottom: 0.25rem !important;
    flex: 1 !important; /* Take available space */
  }

  .client-badges {
    justify-content: flex-end; /* Align to the right */
    gap: 0.25rem;
    flex-shrink: 0; /* Don't shrink badges */
  }

  .client-badge {
    padding: 0.125rem 0.375rem;
    font-size: 0.65rem;
  }

  .client-details {
    gap: 0.25rem;
    margin-bottom: 0.5rem;
  }

  .client-detail {
    font-size: 0.95rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
  }

  .client-detail i {
    font-size: 0.75rem;
    width: 12px;
    text-align: center;
  }

  .client-actions {
    justify-content: space-between;
    gap: 0.375rem;
  }

  .client-actions button {
    flex: 1;
    padding: 0.5rem;
    min-width: 36px;
    min-height: 36px;
    font-size: 0.8rem;
  }

  .status-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    min-width: 36px;
    min-height: 36px;
  }

  /* Pagination mobile optimization */
  .pagination-controls {
    flex-direction: row !important;
    gap: 0.75rem !important;
    padding: 0.75rem !important;
    position: relative !important;
    z-index: 1 !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
  }

  .pagination-btn {
    padding: 0.7rem 1rem !important;
    font-size: 1rem !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }

  #page-info {
    font-size: 0.95rem !important;
    order: 0 !important;
    text-align: center !important;
    width: 100% !important;
    margin-bottom: 0.25rem !important;
  }

  /* Form mobile optimization */
  .form-group {
    margin-bottom: 1rem;
  }

  .form-group label {
    font-size: 1rem !important;
    margin-bottom: 0.5rem !important;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px !important; /* Prevent zoom on iOS */
    padding: 0.9rem !important;
    min-height: 48px !important;
  }

  .form-footer {
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }

  .form-footer .btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1rem;
    min-height: 48px;
  }

  /* Radio group mobile optimization */
  .radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
  }

  .radio-label {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--input-radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .radio-label:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
  }

  .radio-label input[type="radio"]:checked + span {
    color: var(--primary-color);
    font-weight: 600;
  }

  .radio-label input[type="radio"] {
    display: none;
  }
}

/* Extra small mobile optimizations */
@media (max-width: 480px) {
  .client-management {
    gap: 0.75rem;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  /* Sticky form header adjustments for very small screens */
  .frame-left h2 {
    font-size: 1.1rem;
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
  }

  /* Frame separation adjustments for very small screens */
  .frame {
    margin-bottom: 1.25rem;
  }

  .frame-left {
    margin-top: 1.25rem;
  }

  .frame-left,
  .frame-right {
    padding: 0.75rem;
  }

  .search-bar-frame {
    padding: 0.5rem;
  }

  .client-list {
    min-height: 250px;
    max-height: 350px;
    padding: 0.5rem;
  }

  .client-list-content {
    min-height: 150px;
  }

  .client-card {
    padding: 0.875rem;
    margin-bottom: 0.5rem;
  }

  .client-name {
    font-size: 0.95rem;
  }

  .client-detail {
    font-size: 0.8rem;
  }

  .client-actions {
    flex-direction: column;
    gap: 0.375rem;
  }

  .client-actions button {
    width: 100%;
    justify-content: center;
  }

  .pagination-controls {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .pagination-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    min-width: 36px;
    min-height: 36px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.75rem;
    min-height: 44px;
  }

  .radio-label {
    padding: 0.625rem;
    min-height: 44px;
    font-size: 0.9rem;
  }
}

/* Dark mode mobile optimizations for clients page */
@media (max-width: 768px) {
  [data-theme="dark"] .client-card {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .client-card:hover {
    background: #2a2d3a;
    border-color: #60a5fa;
  }

  [data-theme="dark"] .search-bar-frame {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .client-list-header {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .pagination-controls {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .radio-label {
    background: #23262f;
    border-color: #2a2d3a;
    color: #e5e7eb;
  }

  [data-theme="dark"] .radio-label:hover {
    background: #2a2d3a;
    border-color: #60a5fa;
  }
}

/* Fix user dropdown menu text contrast on mobile */
@media (max-width: 768px) {
  /* ===== PRODUCTS PAGE MOBILE OPTIMIZATIONS ===== */

  /* Fix products page main container */
  .product-management {
    min-height: auto !important;
    height: auto !important;
    padding: 0.5rem !important;
    gap: 0.75rem !important;
  }

  .product-list-container {
    min-height: auto !important;
    max-height: none !important;
    padding: 0.75rem !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  }

  /* Page header improvements */
  .page-header {
    margin-bottom: 1rem !important;
    gap: 0.75rem !important;
  }

  .page-header h1 {
    font-size: 1.35rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
  }

  .page-description {
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
    margin-top: 0.25rem !important;
  }

  /* Header actions - better spacing */
  .header-actions {
    gap: 0.5rem !important;
    width: 100% !important;
  }

  #add-new-product-btn {
    flex: 1 !important;
    min-height: 44px !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 4px rgba(0, 126, 199, 0.2) !important;
  }

  #add-new-product-btn:active {
    transform: scale(0.98) !important;
    box-shadow: 0 1px 2px rgba(0, 126, 199, 0.2) !important;
  }

  .view-toggle {
    background: var(--bg-secondary, #f3f4f6) !important;
    padding: 0.2rem !important;
    border-radius: 8px !important;
  }

  .view-toggle-btn {
    min-height: 40px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.85rem !important;
    border-radius: 6px !important;
  }

  .view-toggle-btn:active {
    transform: scale(0.95) !important;
  }

  /* Product list header - better layout */
  .product-list-header {
    gap: 0.75rem !important;
    margin-bottom: 1rem !important;
  }

  /* Product search mobile - improved */
  .product-search-container {
    position: relative !important;
    width: 100% !important;
  }

  .product-search-container i {
    left: 0.875rem !important;
    color: var(--text-secondary, #6b7280) !important;
    font-size: 0.9rem !important;
  }

  .product-search {
    width: 100% !important;
    padding: 0.7rem 0.875rem 0.7rem 2.5rem !important;
    font-size: 0.9rem !important;
    border-radius: 10px !important;
    border: 1.5px solid var(--border-color, #d1d5db) !important;
    background: var(--bg-primary, #fff) !important;
    transition: all 0.2s ease !important;
  }

  .product-search:focus {
    border-color: var(--primary-color, #007ec7) !important;
    box-shadow: 0 0 0 3px rgba(0, 126, 199, 0.1) !important;
    outline: none !important;
  }

  /* Filter dropdowns mobile - improved */
  .product-filters {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .filter-dropdown {
    min-width: 0 !important;
  }

  .filter-dropdown .form-control {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.5rem center !important;
    background-size: 10px !important;
    padding: 0.65rem 1.5rem 0.65rem 0.75rem !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
    border: 1.5px solid var(--border-color, #d1d5db) !important;
    background-color: var(--bg-primary, #fff) !important;
    color: var(--text-primary, #333) !important;
    transition: all 0.2s ease !important;
    min-height: 44px !important;
  }

  .filter-dropdown .form-control:focus {
    border-color: var(--primary-color, #007ec7) !important;
    box-shadow: 0 0 0 3px rgba(0, 126, 199, 0.1) !important;
    outline: none !important;
  }

  [data-theme="dark"] .filter-dropdown .form-control {
    background-color: var(--bg-secondary, #23262f) !important;
    border-color: var(--border-color, #374151) !important;
    color: var(--text-primary, #e5e7eb) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e5e7eb' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
  }

  /* CRITICAL: Ensure parent containers allow horizontal overflow */
  .product-list-container {
    overflow-x: visible !important;
    overflow-y: visible !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .product-list {
    overflow-x: visible !important;
    overflow-y: visible !important;
    width: 100% !important;
  }

  /* Optimize product table for mobile scrolling */
  .product-table-wrapper {
    position: relative !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color, #e5e7eb) !important;
    background: var(--bg-primary, #fff) !important;
    /* Force scrollbar to be visible on mobile */
    scrollbar-width: thin !important;
    scrollbar-color: var(--primary-color, #007ec7) rgba(0, 0, 0, 0.1) !important;
  }

  /* Webkit scrollbar styling */
  .product-table-wrapper::-webkit-scrollbar {
    height: 8px !important;
  }

  .product-table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-secondary, #f3f4f6) !important;
    border-radius: 10px !important;
  }

  .product-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color, #007ec7) !important;
    border-radius: 10px !important;
  }

  .product-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark, #0066a3) !important;
  }

  /* Scroll indicator gradient - right side */
  .product-table-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(
      to left,
      rgba(255, 255, 255, 0.98),
      transparent
    );
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .product-table-wrapper.scrollable:not(.show-scroll-hint)::after {
    opacity: 1;
  }

  /* Left gradient when scrolled */
  .product-table-wrapper::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(
      to right,
      rgba(255, 255, 255, 0.98),
      transparent
    );
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .product-table-wrapper.scrolled-left::before {
    opacity: 1;
  }

  /* Scroll hint badge - separate element */
  .product-table-wrapper .scroll-hint-badge {
    display: none;
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color, #007ec7);
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 15;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 126, 199, 0.3);
    animation: scrollHintPulse 2s ease-in-out infinite;
  }

  .product-table-wrapper.show-scroll-hint .scroll-hint-badge {
    display: block;
  }

  [data-theme="dark"] .product-table-wrapper {
    background: var(--bg-secondary, #23262f) !important;
    border-color: var(--border-color, #374151) !important;
  }

  [data-theme="dark"] .product-table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-primary, #1a1d24) !important;
  }

  [data-theme="dark"] .product-table-wrapper::after {
    background: linear-gradient(to left, rgba(35, 38, 47, 0.98), transparent);
  }

  [data-theme="dark"] .product-table-wrapper::before {
    background: linear-gradient(to right, rgba(35, 38, 47, 0.98), transparent);
  }

  /* Table styling - ensure it's wider than viewport */
  .product-table {
    min-width: 800px !important;
    width: auto !important;
    font-size: 0.8rem !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    table-layout: auto !important;
  }

  .product-table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
  }

  .product-table thead th {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
    background: var(--bg-secondary, #f9fafb) !important;
    border-bottom: 2px solid var(--border-color, #e5e7eb) !important;
  }

  .product-table tbody td {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.8rem !important;
    border-bottom: 1px solid var(--border-color, #f3f4f6) !important;
    vertical-align: middle !important;
  }

  .product-table tbody tr:last-child td {
    border-bottom: none !important;
  }

  /* Product cards mobile optimization - improved */
  .product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    border-radius: 12px !important;
    overflow: hidden !important;
  }

  .product-card:active {
    transform: scale(0.98) !important;
  }

  .product-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  }

  /* Product pagination mobile - improved */
  .product-pagination {
    background: var(--card-background) !important;
    border-top: 1px solid var(--border-color) !important;
    padding: 1rem 0.75rem !important;
    margin: 0 -0.75rem !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    align-items: center !important;
  }

  .pagination-info {
    font-size: 0.85rem !important;
    color: var(--text-secondary, #6b7280) !important;
    text-align: center !important;
  }

  .pagination-controls {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
  }

  .page-btn,
  .page-number {
    min-width: 40px !important;
    min-height: 40px !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
  }

  .page-btn:active,
  .page-number:active {
    transform: scale(0.95) !important;
  }

  .page-number.active {
    background: var(--primary-color, #007ec7) !important;
    color: #fff !important;
    font-weight: 600 !important;
  }

  /* Loading spinner mobile */
  .loading-spinner {
    padding: 2rem 1rem !important;
  }

  .spinner {
    width: 32px !important;
    height: 32px !important;
  }

  /* Product modal category creation mobile */
  #category-create-modal .modal-content {
    width: 95% !important;
    max-width: 400px !important;
  }

  #category-create-modal .modal-header,
  #category-create-modal .modal-body,
  #category-create-modal .modal-footer {
    padding: 12px !important;
  }

  #category-create-modal input {
    font-size: 0.9rem !important;
    padding: 8px 10px !important;
  }

  /* Delete modal mobile */
  #delete-modal .modal-content {
    width: 95% !important;
    max-width: 400px !important;
  }

  #delete-modal .modal-header,
  #delete-modal .modal-body,
  #delete-modal .modal-footer {
    padding: 12px !important;
  }

  #delete-modal .delete-message {
    font-size: 0.9rem !important;
  }

  #delete-modal .product-name {
    font-size: 1rem !important;
  }

  /* Toast notification mobile */
  #toast {
    top: 10px !important;
    right: 10px !important;
    left: 10px !important;
    min-width: auto !important;
    max-width: none !important;
  }

  .toast-message {
    font-size: 0.85rem !important;
  }

  /* Touch-friendly action buttons - improved */
  .cell-actions {
    gap: 0.5rem !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
  }

  .cell-actions .action-btn,
  .product-actions .action-btn {
    min-width: 40px !important;
    min-height: 40px !important;
    width: 40px !important;
    height: 40px !important;
    touch-action: manipulation !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.9rem !important;
  }

  .cell-actions .action-btn:active,
  .product-actions .action-btn:active {
    transform: scale(0.9) !important;
  }

  .action-btn.edit-btn {
    background-color: var(--warning-color, #f59e0b) !important;
    color: #fff !important;
  }

  .action-btn.edit-btn:active {
    background-color: #d97706 !important;
  }

  .action-btn.delete-btn {
    background-color: var(--danger-color, #ef4444) !important;
    color: #fff !important;
  }

  .action-btn.delete-btn:active {
    background-color: #dc2626 !important;
  }

  /* Touch feedback for interactive elements */
  .product-table tbody tr {
    transition: background-color 0.15s ease !important;
    cursor: pointer !important;
  }

  .product-table tbody tr:active {
    background: rgba(0, 126, 199, 0.08) !important;
  }

  [data-theme="dark"] .product-table tbody tr:active {
    background: rgba(96, 165, 250, 0.15) !important;
  }

  /* View toggle mobile */
  .view-toggle {
    border-radius: 8px !important;
    padding: 0.2rem !important;
  }

  .view-toggle-btn {
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
  }

  .view-toggle-btn:active {
    transform: scale(0.95) !important;
  }

  /* Product code display mobile */
  .product-code {
    display: inline-block !important;
    max-width: 100px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Status badge mobile */
  .status-badge {
    white-space: nowrap !important;
  }

  /* Price cell mobile */
  .price-cell {
    white-space: nowrap !important;
  }

  /* Stock quantity mobile */
  .stock-quantity {
    white-space: nowrap !important;
  }

  /* Empty state mobile */
  .empty-state {
    min-height: 200px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Prevent text selection on buttons for better mobile UX */
  .primary-btn,
  .secondary-btn,
  .action-btn,
  .view-toggle-btn,
  .page-btn,
  .page-number {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  /* Improve button tap targets */
  .header-actions button,
  .product-actions button,
  .cell-actions button {
    position: relative !important;
  }

  .header-actions button::before,
  .product-actions button::before,
  .cell-actions button::before {
    content: "" !important;
    position: absolute !important;
    top: -4px !important;
    left: -4px !important;
    right: -4px !important;
    bottom: -4px !important;
    z-index: -1 !important;
  }

  /* Smooth scroll for product list */
  .product-list-container {
    scroll-behavior: smooth !important;
  }

  /* Search clear button mobile */
  .search-clear-btn {
    position: absolute !important;
    right: 0.5rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary, #6b7280) !important;
    font-size: 0.85rem !important;
    padding: 0.25rem !important;
    cursor: pointer !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important;
  }

  .search-clear-btn:active {
    background: rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-50%) scale(0.9) !important;
  }

  [data-theme="dark"] .search-clear-btn {
    color: var(--text-secondary, #9ca3af) !important;
  }

  [data-theme="dark"] .search-clear-btn:active {
    background: rgba(255, 255, 255, 0.1) !important;
  }

  /* Grid view improvements for mobile */
  .product-grid-container {
    gap: 0.75rem !important;
    padding: 0.25rem 0 !important;
  }

  .product-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  }

  .product-card:active {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12) !important;
  }

  /* Empty state improvements */
  .empty-state {
    padding: 2.5rem 1rem !important;
  }

  .empty-state i {
    font-size: 3.5rem !important;
    margin-bottom: 1rem !important;
    opacity: 0.5 !important;
  }

  .empty-state h3 {
    font-size: 1.1rem !important;
    margin-bottom: 0.5rem !important;
    font-weight: 600 !important;
  }

  .empty-state p {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    margin-bottom: 1.5rem !important;
    max-width: 280px !important;
  }

  #add-first-product {
    min-height: 44px !important;
    padding: 0.75rem 1.5rem !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
  }

  @keyframes scrollHintPulse {
    0%,
    100% {
      opacity: 0.9;
      transform: translateX(-50%) translateY(0);
    }
    50% {
      opacity: 1;
      transform: translateX(-50%) translateY(-2px);
    }
  }

  [data-theme="dark"] .product-table-wrapper .scroll-hint-badge {
    background: var(--primary-color, #2563eb) !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4) !important;
  }
}

@media (max-width: 480px) {
  /* ===== EXTRA SMALL DEVICES - PRODUCTS ===== */

  /* Further compact product table */
  .product-table {
    font-size: 0.7rem !important;
    min-width: 650px !important;
  }

  .product-table thead th {
    padding: 0.5rem 0.4rem !important;
    font-size: 0.65rem !important;
  }

  .product-table tbody td {
    padding: 0.5rem 0.4rem !important;
    font-size: 0.7rem !important;
  }

  /* Compact product code */
  .product-code {
    font-size: 0.65rem !important;
    padding: 0.15rem 0.3rem !important;
    max-width: 80px !important;
  }

  /* Compact status badges */
  .status-badge {
    padding: 0.15rem 0.4rem !important;
    font-size: 0.6rem !important;
  }

  /* Compact action buttons */
  .action-btn {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.7rem !important;
  }

  /* Product modal on very small screens */
  #product-form-modal .modal-content,
  #product-form-modal-component .modal-content {
    border-radius: 0 !important;
  }

  /* Compact toast */
  #toast {
    top: 5px !important;
    right: 5px !important;
    left: 5px !important;
    padding: 10px !important;
  }

  .toast-content {
    gap: 8px !important;
  }

  .toast-content i {
    font-size: 16px !important;
  }

  .toast-message {
    font-size: 0.8rem !important;
  }
}

@media (max-width: 768px) {
  /* Light mode - ensure dark text on light background */
  .top-bar .dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  }

  .top-bar .dropdown-menu a {
    color: #1f2937 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
  }

  .top-bar .dropdown-menu a span {
    color: #1f2937 !important;
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .top-bar .dropdown-menu a i {
    color: #4b5563 !important;
  }

  .top-bar .dropdown-menu a:hover {
    background-color: #f3f4f6 !important;
    color: #111827 !important;
  }

  .top-bar .dropdown-menu a:hover span {
    color: #111827 !important;
  }

  /* Dark mode - ensure light text on dark background */
  [data-theme="dark"] .top-bar .dropdown-menu {
    background: #23262f !important;
    border: 1px solid #2a2d3a !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
  }

  [data-theme="dark"] .top-bar .dropdown-menu a {
    color: #f9fafb !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
  }

  [data-theme="dark"] .top-bar .dropdown-menu a span {
    color: #f9fafb !important;
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  [data-theme="dark"] .top-bar .dropdown-menu a i {
    color: #d1d5db !important;
  }

  [data-theme="dark"] .top-bar .dropdown-menu a:hover {
    background-color: #1f2937 !important;
    color: #ffffff !important;
  }

  [data-theme="dark"] .top-bar .dropdown-menu a:hover span {
    color: #ffffff !important;
  }
}
