/* ═══════════════════════════════════════════════════════════════════
   تحسينات UI/UX - v163x
   ═══════════════════════════════════════════════════════════════════ */

/* ── تحسين Buttons disabled ── */
button:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* ── انتقالات سلسة ── */
button, .btn, [role="button"] {
  transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
}

button:not(:disabled):active, .btn:not(:disabled):active {
  transform: scale(0.97);
}

/* ── Focus states محسنة ── */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #C8B882 !important;
  outline-offset: 2px;
}

/* ── Scrollbar أنيق ── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #C8B882;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b09e6c;
}

/* ── تحسينات الجوال ── */
@media (max-width: 768px) {
  /* جعل الأزرار أسهل للنقر */
  button, .btn {
    min-height: 40px;
  }
  
  /* بطاقات أصغر */
  .card {
    padding: 12px !important;
  }
  
  /* خط أكبر للنصوص الصغيرة */
  body {
    -webkit-text-size-adjust: 100%;
  }
  
  /* جداول قابلة للسحب أفقياً */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  /* Modal أكبر على الجوال */
  .modal {
    max-width: 95vw !important;
    width: 95vw !important;
    max-height: 90vh;
  }
  
  /* قوائم منسدلة أكبر */
  select, input[type="text"], input[type="number"], input[type="date"] {
    font-size: 16px !important; /* يمنع zoom على iOS */
  }
}

@media (max-width: 480px) {
  .card {
    margin-bottom: 10px !important;
  }
  
  /* تقليل الـ padding */
  body {
    padding: 8px !important;
  }
}

/* ── Pull-to-refresh feedback (iOS PWA) ── */
body {
  overscroll-behavior-y: contain;
}

/* ── تحسين ال inputs ── */
input[type="text"], input[type="number"], input[type="date"], 
input[type="email"], input[type="tel"], select, textarea {
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
}

/* ── Cards hover effect ── */
.card-hoverable {
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}
.card-hoverable:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

/* ── Skeleton loading shimmer ── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

/* ── منع text-selection على الأزرار ── */
button, .btn {
  user-select: none;
  -webkit-user-select: none;
}

/* ── Print styles ── */
@media print {
  .mob-nav, .drawer, .topbar, button:not(.print-keep) {
    display: none !important;
  }
  body { padding: 0 !important; }
  .card { break-inside: avoid; }
}

/* ── Reduce motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── تحسين safe area للـ iPhone X+ ── */
@supports (padding: max(0px)) {
  body {
    padding-bottom: max(60px, env(safe-area-inset-bottom)) !important;
  }
}

/* ── تحسين الـ active state للأزرار في الجوال ── */
@media (hover: none) {
  button:active, .btn:active {
    background-color: rgba(200, 184, 130, 0.1);
  }
}
