/* ============================================
   v2/css/base.css
   استایل پایه — مشترک همه صفحات
   سایت اخبار استقلال — نسخه ۲
   نسخه: 2.10 — اصلاح ارتفاع bottom-nav به 90px
   ============================================ */

/* ============================================
   0) Local Font — Vazirmatn Variable
   ============================================ */
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/uploads/fonts/vazirmatn/Vazirmatn-Variable.woff2') format('woff2-variations');
}

/* ============================================
   1) CSS Variables
   ============================================ */
:root {
  --primary: #1560bd;
  --primary-dark: #0d3f80;
  --gold: #f5c842;
  --gold-dark: #e0b02e;
  --bg: #f0f2f5;
  --bg-light: #f8fafc;
  --border: #e8ecf0;
  --border-light: #e2e8f0;

  --text: #1a2332;
  --text-secondary: #2a3a4a;
  --text-muted: #7a8a9a;
  --text-light: #aab8c8;
  --text-white: #ffffff;

  --danger: #e74c3c;
  --success: #2ecc71;
  --warning: #f39c12;
  --info: #3498db;

  --grad-primary: linear-gradient(145deg, var(--primary), var(--primary-dark));
  --grad-gold: linear-gradient(145deg, var(--gold), var(--gold-dark));

  --shadow-sm: 0 2px 6px rgba(0,0,0,.05);
  --shadow-md: 0 4px 20px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.2);
  --shadow-primary: 0 4px 14px rgba(21,96,189,.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.45s cubic-bezier(.25,.46,.45,.94);

  --container-width: 480px;

  /* 🎯 ارتفاع واقعی bottom-nav */
  --bottom-nav-height: 90px;

  --z-header: 9000;
  --z-bottom-nav: 1000;
  --z-floating: 1500;
  --z-overlay: 9999;
  --z-drawer: 10000;
  --z-popup: 10500;
}

/* ============================================
   2) Reset
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  padding-bottom: 80px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

button {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  outline: none;
}

ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.4; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(21,96,189,.3); border-radius: 3px; }

/* ============================================
   3) Container
   ============================================ */
.app-container {
  max-width: var(--container-width);
  margin: 0 auto;
  background: #fff;
  min-height: 100vh;
  box-shadow: 0 0 30px rgba(0,0,0,.06);
  position: relative;
}

/* ============================================
   4) Header
   ============================================ */
.app-header {
  background: var(--grad-primary);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.header-left { display: flex; align-items: center; gap: 10px; }

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.header-logo img {
  display: block;
  height: 16px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  transition: opacity var(--transition-fast);
}

.header-logo:active img {
  opacity: 0.8;
}

.header-right { display: flex; align-items: center; gap: 8px; }

.header-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: .8rem;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-xl);
  transition: background var(--transition-base), color var(--transition-base);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.header-btn i { font-size: 1rem; pointer-events: none; }
.header-btn:active { background: rgba(245,200,66,.25); color: var(--gold); }

/* ============================================
   5) Drawer
   ============================================ */
.drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100%;
  background: var(--primary);
  color: #fff;
  padding: 24px 18px;
  transition: right 0.4s cubic-bezier(.4,0,.2,1);
  z-index: var(--z-drawer);
  box-shadow: -4px 0 30px rgba(0,0,0,.4);
  overflow-y: auto;
}
.drawer.open { right: 0; }

.drawer .user-section {
  text-align: center;
  padding: 16px 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
  margin-top: 8px;
}

.drawer .user-section .avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--gold);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  color: var(--primary);
  font-weight: 700;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,.3);
  position: relative;
}
.drawer .user-section .avatar img { width: 100%; height: 100%; object-fit: cover; }

/* 🎯 قاب VIP برای آواتار */
.drawer .user-section .avatar.vip-avatar {
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 2px rgba(245,200,66,.3), 0 4px 16px rgba(245,200,66,.4);
}

.drawer .user-section .user-greeting {
  font-size: .92rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 10px;
  min-height: 18px;
}

.drawer .user-section .user-greeting .vip-icon {
  color: var(--gold);
  font-size: .85rem;
  margin-right: 4px;
  filter: drop-shadow(0 0 4px rgba(245,200,66,.6));
}

/* 🎯 ردیف سطح + دکمه پروفایل */
.drawer-user-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.drawer .user-section .user-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245,200,66,.2);
  color: var(--gold);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  border: 1px solid rgba(245,200,66,.3);
  line-height: 1;
}

.drawer .user-section .user-level-badge i {
  font-size: .75rem;
}

.drawer .user-section .user-level-badge span {
  display: inline-block;
}

/* 🎯 دکمه پروفایل من (کوچیک‌شده) */
.drawer-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--gold);
  color: var(--primary);
  border: none;
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .72rem;
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--transition-base), transform var(--transition-fast);
  touch-action: manipulation;
  line-height: 1;
}

.drawer-profile-btn i {
  font-size: .75rem;
}

.drawer-profile-btn:active {
  opacity: 0.85;
  transform: scale(.96);
}

/* دکمه ورود/ثبت‌نام (برای مهمان) */
.drawer .user-section .login-btn {
  background: var(--gold);
  color: var(--primary);
  border: none;
  padding: 8px 30px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity var(--transition-base);
  touch-action: manipulation;
  text-decoration: none;
}
.drawer .user-section .login-btn:active { opacity: 0.8; }
.drawer .user-section .login-btn.profile-mode { background: #fff; color: var(--primary); }

.drawer .menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 8px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  color: #d0d8e8;
  font-size: .93rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-base), color var(--transition-base);
}
.drawer .menu-item:active,
.drawer .menu-item.active {
  background: rgba(245,200,66,.15);
  color: var(--gold);
}
.drawer .menu-item i {
  width: 24px;
  text-align: center;
  color: var(--gold);
  font-size: 1rem;
  pointer-events: none;
}
.drawer .menu-item .badge {
  background: var(--gold);
  color: var(--primary);
  padding: 1px 10px;
  border-radius: var(--radius-xl);
  font-size: .7rem;
  font-weight: 700;
  margin-right: auto;
  pointer-events: none;
}
.drawer .menu-item span { pointer-events: none; }

/* 🎯 آیتم کلاب - استایل ویژه */
.drawer .menu-item.club-item {
  background: linear-gradient(145deg, rgba(245,200,66,.15), rgba(245,200,66,.05));
  border: 1px solid rgba(245,200,66,.2);
  margin: 6px 0;
  border-radius: var(--radius-md);
}

.drawer .menu-item.club-item i {
  color: var(--gold);
  font-size: 1.1rem;
}

.drawer .menu-item.club-item.active {
  background: linear-gradient(145deg, var(--gold), var(--gold-dark));
  color: var(--primary);
}

.drawer .menu-item.club-item.active i {
  color: var(--primary);
}

/* ============================================
   6) Overlay
   ============================================ */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.5);
  z-index: var(--z-overlay);
  display: none;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.overlay.show { display: block; opacity: 1; }

/* ============================================
   7) Bottom Nav
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: var(--container-width);
  margin: 0 auto;
  background: var(--grad-primary);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 8px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  z-index: var(--z-bottom-nav);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: .68rem;
  color: #fff;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 6px;
  flex: 1;
  transition: color var(--transition-base);
  opacity: .85;
  text-decoration: none;
  touch-action: manipulation;
}
.nav-item i {
  font-size: 1.15rem;
  pointer-events: none;
  color: #fff;
  transition: color var(--transition-base), transform var(--transition-base);
  line-height: 1;
}
.nav-item span {
  pointer-events: none;
  color: #fff;
  transition: color var(--transition-base);
  line-height: 1;
}
.nav-item.active { color: var(--gold); font-weight: 700; opacity: 1; }
.nav-item.active i { color: var(--gold); transform: scale(1.15); }
.nav-item.active span { color: var(--gold); }

/* ============================================
   8) Floating Chat Button — دکمه قرصی «گپ»
   ============================================ */
.floating-chat-btn {
  position: fixed;
  bottom: 100px;
  left: 16px;
  height: 46px;
  padding: 0 18px 0 14px;
  border-radius: 30px;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .92rem;
  font-weight: 700;
  font-family: inherit;
  box-shadow: 0 6px 20px rgba(21,96,189,.4);
  z-index: var(--z-floating);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.floating-chat-btn .fcb-label {
  color: #fff;
  line-height: 1;
  pointer-events: none;
}

.floating-chat-btn i {
  font-size: 1rem;
  color: var(--gold);
  pointer-events: none;
  line-height: 1;
}

.floating-chat-btn:hover { transform: scale(1.05); }
.floating-chat-btn:active { transform: scale(0.97); }

/* ============================================
   9) Popups
   ============================================ */
.match-popup,
.auth-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: var(--z-popup);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.match-popup.open,
.auth-popup.open {
  display: flex;
  animation: matchOverlay .3s ease;
}

@keyframes matchOverlay {
  from { background: rgba(0,0,0,0); }
  to { background: rgba(0,0,0,.6); }
}

.match-card,
.auth-card {
  background: #fff;
  width: 100%;
  max-width: var(--container-width);
  border-radius: 24px 24px 0 0;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,.3);
  position: relative;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.45s cubic-bezier(.25,.46,.45,.94);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.match-card { height: 50vh; max-height: 50vh; }
.auth-card { min-height: 70vh; max-height: 95vh; }

.popup,
.profile-popup,
.chat-popup,
.transfer-full-popup,
.report-modal {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: var(--z-popup);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.popup.open,
.profile-popup.open,
.chat-popup.open,
.transfer-full-popup.open,
.report-modal.open {
  display: flex;
  animation: fadeIn .3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.popup-content,
.profile-card,
.chat-card,
.transfer-card,
.report-modal-content {
  background: #fff;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 100%;
  border-radius: 0;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  margin: 0;
}

@media (min-width: 500px) {
  .popup-content,
  .profile-card,
  .chat-card,
  .transfer-card,
  .report-modal-content {
    max-width: var(--container-width);
    margin: 0 auto;
  }
}

.close-popup,
.close-profile,
.close-chat,
.close-transfer {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(21, 96, 189, .1);
  color: var(--primary);
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: background .2s, transform .2s;
  touch-action: manipulation;
}

.close-popup:active,
.close-profile:active,
.close-chat:active,
.close-transfer:active {
  background: rgba(21, 96, 189, .2);
  transform: scale(.95);
}

.profile-card .close-profile,
.chat-card .close-chat,
.transfer-card .close-transfer {
  background: rgba(255, 255, 255, .25);
  color: #fff;
}

.profile-card .close-profile:active,
.chat-card .close-chat:active,
.transfer-card .close-transfer:active {
  background: rgba(255, 255, 255, .4);
}

/* ============================================
   10) Search Overlay
   ============================================ */
#searchOverlay {
  padding: 0;
  align-items: flex-start;
}

#searchOverlay .popup-content {
  padding: 70px 16px 20px;
  max-width: 100%;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
}

#searchOverlay .close-popup {
  top: 14px;
  left: 14px;
}

#searchOverlay #searchInput {
  width: 100%;
  padding: 14px 20px;
  border-radius: 30px;
  border: 2px solid var(--border-light);
  font-size: 1rem;
  margin-bottom: 20px;
  outline: none;
  background: var(--bg-light);
  transition: border-color .3s;
}

#searchOverlay #searchInput:focus {
  border-color: var(--gold);
  background: #fff;
}

#searchOverlay #searchResults {
  flex: 1;
  overflow-y: auto;
}

/* ============================================
   11) Toast
   ============================================ */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-150%);
  background: var(--primary);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: .88rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  z-index: 10001;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
  max-width: 90%;
  width: max-content;
  text-align: center;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.gold { background: var(--gold); color: var(--primary); }

/* ============================================
   12) Loading / Empty
   ============================================ */
.loading-more {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: .82rem;
}
.loading-more i {
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-left: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.no-more {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
  font-size: .78rem;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; display: block; }

/* ============================================
   13) Buttons
   ============================================ */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  cursor: pointer;
  border: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--gold); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: var(--bg); color: var(--primary); }

/* ============================================
   14) VIP Global
   ============================================ */
.vip-author {
  color: var(--gold) !important;
  font-weight: 700;
}

.vip-icon {
  color: var(--gold);
  filter: drop-shadow(0 0 3px rgba(245,200,66,.6));
  font-size: .75rem;
}

.vip-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(145deg, var(--gold), var(--gold-dark));
  color: var(--primary);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: .6rem;
  font-weight: 700;
}

/* ============================================
   15) Media
   ============================================ */
@media (max-width: 380px) {
  .app-header { padding: 10px 10px; }
  .header-logo img { height: 14px; }
  .header-btn { padding: 6px 10px; }
  .drawer { width: 290px; right: -310px; }
  .drawer .user-section .avatar { width: 68px; height: 68px; font-size: 1.7rem; }
  .drawer .user-section .user-greeting { font-size: .85rem; }
  .drawer .user-section .user-level-badge { font-size: .68rem; padding: 3px 10px; }
  .drawer-profile-btn { font-size: .68rem; padding: 4px 12px; }
}

/* ============================================
   16) FIX: pointer-events
   ============================================ */
.app-header button,
.app-header a,
.bottom-nav a,
.bottom-nav button,
.floating-chat-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

.overlay { pointer-events: none; }
.overlay.show { pointer-events: auto; }

.match-popup:not(.open),
.auth-popup:not(.open),
.popup:not(.open),
.profile-popup:not(.open),
.chat-popup:not(.open),
.transfer-full-popup:not(.open),
.report-modal:not(.open) {
  pointer-events: none;
  visibility: hidden;
}

.match-popup.open,
.auth-popup.open,
.popup.open,
.profile-popup.open,
.chat-popup.open,
.transfer-full-popup.open,
.report-modal.open {
  pointer-events: auto;
  visibility: visible;
}