/* ========== MOBILE FIRST OPTIMIZATIONS ========== */

/* Touch-friendly sizes */
.touch-target {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile-safe spacing */
@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  /* Prevent zoom on input focus */
  input,
  textarea,
  select {
    font-size: 16px;
  }

  .container,
  .container-wide {
    padding: 1rem;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .hero-title {
    font-size: 2rem;
    font-weight: 800;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  /* Full width buttons on mobile */
  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    width: 100%;
  }

  /* Improve card spacing on mobile */
  .cards-grid {
    gap: 1rem;
  }

  .property-card,
  .product-card,
  .food-card {
    margin-bottom: 1rem;
  }

  /* Improve form inputs on mobile */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
  }

  /* Hamburger menu improvements */
  .hamburger-btn {
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile search */
  .global-search-header {
    max-width: 100%;
    min-width: auto;
  }

  /* Better mobile navigation */
  .mobile-nav {
    max-height: calc(100vh - 64px);
  }

  /* Dashboard grid on mobile */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  /* Property list on mobile */
  .property-list-item {
    grid-template-columns: 80px 1fr;
    gap: 1rem;
  }

  .property-list-image {
    width: 80px;
    height: 80px;
  }

  .property-list-actions {
    grid-column: 1 / -1;
    margin-top: 1rem;
  }
}

/* Tablet adjustments */
@media (min-width: 641px) and (max-width: 1023px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-title {
    font-size: 2.25rem;
  }

  .hero-title {
    font-size: 3rem;
  }
}

/* Desktop improvements */
@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-title {
    font-size: 4rem;
  }

  .hero-subtitle {
    font-size: 1.25rem;
  }

  /* Smooth transitions on desktop */
  * {
    transition: all 0.2s ease;
  }

  /* Better hover states on desktop */
  .card:hover {
    transform: translateY(-4px);
  }

  .btn:hover {
    transform: translateY(-2px);
  }
}

/* ========== ACCESSIBILITY IMPROVEMENTS ========== */

/* Focus visible states */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  :root {
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  .card,
  .btn {
    border: 2px solid currentColor;
  }

  .text-muted {
    color: var(--gray-700);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .transition {
    transition: none;
  }

  .animate-fade-in {
    animation: none;
  }

  .animate-slide-down {
    animation: none;
  }
}

/* Dark mode support (if user has dark mode preference) */
@media (prefers-color-scheme: dark) {
  /* This is prepared for potential future dark mode support */
  /* Currently, the app uses light mode by default */
  /* Uncomment and adjust as needed for dark mode */
  
  /*
  body {
    background: #1a1a1a;
    color: #e5e7eb;
  }

  .card {
    background: #2a2a2a;
    border-color: #404040;
  }

  .btn-secondary {
    background: #404040;
    color: #e5e7eb;
  }
  */
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--green);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-to-main:focus {
  top: 0;
}

/* ========== PRINT STYLES ========== */
@media print {
  .site-header,
  .site-footer,
  .hamburger-btn,
  .cart-btn,
  .btn-outline,
  .mobile-nav {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  a {
    text-decoration: underline;
  }

  .receipt {
    max-width: 100%;
  }
}

/* ========== LOADING & EMPTY STATES ========== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-600);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.empty-state-message {
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ========== FORM IMPROVEMENTS ========== */
.form-validation-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid #fca5a5;
  border-radius: 0.375rem;
  color: #7f1d1d;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.form-validation-success {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid #86efac;
  border-radius: 0.375rem;
  color: #15803d;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.form-input-error {
  border-color: #dc2626 !important;
}

.form-input-success {
  border-color: #16a34a !important;
}

/* ========== SMOOTH SCROLLING ========== */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ========== TOOLTIP STYLES ========== */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background: var(--gray-900);
  color: white;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
  z-index: 1000;
}

.tooltip:hover::after {
  opacity: 1;
}

/* ========== ANIMATION UTILITIES ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease;
}

.animate-slide-up {
  animation: slideUp 0.3s ease;
}

.animate-slide-down {
  animation: slideDown 0.3s ease;
}
