/* Mobile Responsive Styles for Portfolio Tracker */

/* Mobile-specific improvements */
@media (max-width: 767px) {
  /* Hide desktop elements */
  .hidden-mobile {
    display: none !important;
  }
  /* Header adjustments */
  .max-w-screen-2xl {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  /* Make buttons stack vertically on mobile */
  .flex.items-center.space-x-4 {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  
  /* Full-width buttons on mobile */
  button {
    width: 100%;
    justify-content: center;
  }
  
  /* Responsive tables */
  .overflow-x-auto {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  /* Stack grid columns on mobile */
  .grid.grid-cols-1.md\\:grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  /* Better spacing for mobile */
  .p-6 {
    padding: 1rem;
  }
  
  /* Responsive text sizes */
  .text-2xl {
    font-size: 1.5rem;
  }
  
  .text-xl {
    font-size: 1.25rem;
  }
  
  /* Touch-friendly tap targets */
  a, button, select, input {
    min-height: 44px;
  }
  
  /* Modal adjustments */
  .fixed.inset-0 > div {
    margin: 0;
    max-height: 100vh;
    width: 100%;
    border-radius: 0;
  }
  
  /* Account selector full width */
  select {
    width: 100%;
  }
  
  /* Stack header elements */
  .flex.justify-between.items-center {
    flex-direction: column;
    gap: 1rem;
  }
  
  /* Hide less important info on mobile */
  .text-sm.text-gray-500 {
    display: none;
  }
  
  /* Responsive card layouts */
  .bg-white.rounded-lg.shadow {
    margin-bottom: 1rem;
  }
}

/* Improved table scrolling */
@media (max-width: 767px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Sticky first column */
  td:first-child,
  th:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
  }
}

/* Bottom padding for mobile to avoid content being hidden */
@media (max-width: 767px) {
  body {
    padding-bottom: 60px;
  }
}

/* Simple mobile navigation */
@media (max-width: 767px) {
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    z-index: 50;
  }
  
  .mobile-nav button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    min-height: auto;
  }
  
  .mobile-nav button.active {
    color: #3b82f6;
  }
  
  /* Floating Action Button for Add Transaction */
  .fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #10b981;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    font-size: 24px;
    z-index: 30;
    transition: transform 0.2s;
  }
  
  .fab:active {
    transform: scale(0.95);
  }
  
  /* Better mobile header spacing */
  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 40;
  }
  
  /* Price freshness indicator */
  .price-fresh {
    color: #10b981;
  }
  
  .price-stale {
    color: #f59e0b;
  }
  
  .price-old {
    color: #ef4444;
  }
  
  /* Safe area padding for bottom buttons */
  .pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 20px);
  }
  
  /* Better mobile form inputs */
  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  
  input[type="number"] {
    -moz-appearance: textfield;
  }
  
  /* Active states for mobile */
  .active\:bg-gray-200:active {
    background-color: #e5e7eb;
  }
  
  .active\:bg-blue-800:active {
    background-color: #1e40af;
  }
}

/* === Dark Mode === */
@media (max-width: 767px) {
  /* Sticky first column dark background */
  .dark td:first-child,
  .dark th:first-child {
    background: #1f2937;
  }

  /* Mobile navigation */
  .dark .mobile-nav {
    background: #1f2937;
    border-top-color: #374151;
  }

  .dark .mobile-nav button {
    color: #9ca3af;
  }

  .dark .mobile-nav button.active {
    color: #60a5fa;
  }

  /* Price freshness dark */
  .dark .price-fresh {
    color: #34d399;
  }

  .dark .price-stale {
    color: #fbbf24;
  }

  .dark .price-old {
    color: #f87171;
  }

  /* Active states dark */
  .dark .active\:bg-gray-200:active {
    background-color: #374151;
  }
}