/* Base & Font Settings */
* {
  font-family: 'IRANSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-sizing: border-box;
}

body {
  background-color: #f8fafc;
  color: #1e293b;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  direction: rtl;
}

/* Tablet & Touch Optimization */
@media (min-width: 768px) and (max-width: 1280px) {
  .tablet-container {
    max-width: 95% !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
  
  .tablet-grid-2 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1.25rem !important;
  }

  .tablet-grid-3 {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 1rem !important;
  }
}

/* Interactive elements styling */
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="password"],
select,
textarea {
  border-radius: 0.75rem;
  transition: all 0.2s ease-in-out;
}

/* Prevent auto-zoom only on mobile phone screens (<640px) */
@media (max-width: 639px) {
  #salesForm input[type="text"],
  #salesForm input[type="number"],
  #salesForm input[type="tel"],
  #salesForm textarea {
    font-size: 16px;
    min-height: 48px;
  }
}

button {
  user-select: none;
}

/* Form primary action buttons touch height */
#btnSubmit,
.tablet-sticky-submit button {
  min-height: 48px;
}

/* Dashboard Filter Dropdowns & Toolbar (Exact 12px Font Size) */
#filterActivity,
#filterPurchase,
#searchInput,
#filterActivity option,
#filterPurchase option,
#btnExportExcel,
#btnExportCsv {
  font-size: 12px !important;
}

#filterActivity,
#filterPurchase,
#searchInput,
#btnExportExcel,
#btnExportCsv {
  min-height: 38px !important;
  height: 38px !important;
}

/* Apply tablet font-size to desktop as well */
@media (min-width: 768px) {
  #tabContentTable table,
  #tabContentUsers table {
    font-size: 12px !important;
  }
  
  #tabContentTable table th,
  #tabContentTable table td,
  #tabContentUsers table th,
  #tabContentUsers table td {
    font-size: 12px !important;
  }
}

/* Custom interactive selection cards (2-line uniform cards) */
.touch-card-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.65rem 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.85rem;
  background-color: #ffffff;
  cursor: pointer;
  min-height: 68px; /* Uniform height for all 2-line cards */
  height: 100%;
  transition: all 0.2s ease;
  user-select: none;
}

.touch-card-option:hover {
  border-color: #cbd5e1;
  background-color: #f8fafc;
}

input[type="radio"]:checked + .touch-card-option,
input[type="checkbox"]:checked + .touch-card-option {
  border-color: #92400e; /* Coffee Amber/Brown */
  background-color: #fef3c7;
  color: #78350f;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.18);
}

/* Map styling */
#map, .detail-map, #admin-overview-map {
  width: 100%;
  height: 340px;
  border-radius: 0.75rem;
  z-index: 10;
}

@media (min-width: 768px) {
  #map {
    height: 380px;
  }
  #admin-overview-map {
    height: 520px;
  }
}

.leaflet-popup-content-wrapper {
  direction: rtl;
  text-align: right;
  font-family: 'IRANSans', sans-serif !important;
  border-radius: 0.75rem;
}

.leaflet-popup-content {
  margin: 12px 14px;
  line-height: 1.6;
}

/* Floating / Sticky action bar for tablets */
.tablet-sticky-submit {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
  z-index: 40;
}

/* Custom file upload zone */
.dropzone-box {
  border: 2px dashed #cbd5e1;
  border-radius: 1rem;
  background-color: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone-box:hover {
  border-color: #92400e;
  background-color: #fffbeb;
}

/* Number badge styling for items 1..13 */
.item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background-color: #78350f;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
