/* =========================================================================
   الو شبکه — موبایل‌فرست و رفع مشکلات لمس
   ========================================================================= */

/* ===== ۱. جلوگیری از zoom خودکار iOS در input ===== */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  input[type="tel"],
  input[type="search"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ===== ۲. لمس هدف بزرگ‌تر روی موبایل ===== */
@media (hover: none) and (pointer: coarse) {
  .btn, .btn-sm, .menu-item, .nt-action, .nt-tool-btn, .nt-mode-btn,
  .team-action-btn, .team-tab-btn, .team-tool-btn, .team-member-action,
  .qa-item, .quick-tile {
    min-height: 44px;
  }
  .nt-action, .team-member-action {
    min-width: 40px;
    min-height: 40px;
  }
}

/* ===== ۳. اسکرول نرم روی iOS ===== */
@supports (-webkit-overflow-scrolling: touch) {
  .table-wrap,
  .nt-container,
  .team-tree-wrap,
  .sidebar {
    -webkit-overflow-scrolling: touch;
  }
}

/* ===== ۴. Safe area برای iPhone با Notch ===== */
body {
  padding-top: env(safe-area-inset-top, 0px);
}

/* ===== ۵. بهبود نمایش در Landscape موبایل ===== */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .topbar { min-height: 50px; padding: 8px 14px; }
  .main { padding: 10px 14px; }
  .chart-bars { height: 110px; }
  .sidebar { width: min(240px, 70vw); }
}

/* ===== ۶. رفع مشکل جدول‌های بلند در موبایل ===== */
@media (max-width: 640px) {
  .table-wrap {
    position: relative;
  }
  .table-wrap::after {
    content: '← برای دیدن همه ستون‌ها بکشید →';
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-size: 10px;
    color: var(--muted);
    opacity: .6;
    pointer-events: none;
  }
}

/* ===== ۷. بهبود نمایش در صفحه‌ی تیکت ===== */
@media (max-width: 640px) {
  .ticket-msg { max-width: 100% !important; }
  .ticket-conv { gap: 12px; }
}

/* ===== ۸. رفع مشکل overlay در موبایل ===== */
@media (max-width: 1024px) {
  .sidebar {
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* ===== ۹. بهبود toast در موبایل ===== */
@media (max-width: 640px) {
  .toast {
    min-width: 0;
    width: calc(100vw - 32px);
    left: 16px;
    transform: none;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  @keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  @keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(20px) scale(.95); }
  }
}

/* ===== ۱۰. بهبود login در موبایل کوچک ===== */
@media (max-width: 360px) {
  .login-card { padding: 24px 18px 20px; border-radius: 20px; }
  .login-logo { width: 60px; height: 60px; font-size: 26px; }
  .login-title { font-size: 18px; }
  .login-submit { min-height: 48px; font-size: 14px; }
}