/* =========================================================
   Fallahi Exchange — Panel styles (login / dashboard / admin)
   White & gold luxury theme
   ========================================================= */

@font-face {
  font-family: 'Myriad Pro';
  src: url('../fonts/myriad-pro-light.woff') format('woff');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Myriad Pro';
  src: url('../fonts/myriad-pro-regular.woff') format('woff');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Myriad Pro';
  src: url('../fonts/myriad-pro-semibold.woff') format('woff');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Myriad Pro';
  src: url('../fonts/myriad-pro-bold.woff') format('woff');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'YekanBakh';
  src: url('../fonts/yekan-bakh-light.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'YekanBakh';
  src: url('../fonts/yekan-bakh-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'YekanBakh';
  src: url('../fonts/yekan-bakh-semibold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'YekanBakh';
  src: url('../fonts/yekan-bakh-bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --gold: #eab308;
  --gold-light: #fbbf24;
  --gold-dark: #ca8a04;
  --gold-grad: linear-gradient(135deg, #fbbf24 0%, #eab308 50%, #ca8a04 100%);
  --bg: #ffffff;
  --cream: #faf8f5;
  --cream-2: #f2f0eb;
  --ink: #1c1a17;
  --ink-soft: #6b6660;
  --white: #ffffff;
  --shadow-sm: 0 2px 16px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --font-head: 'Myriad Pro', 'YekanBakh', sans-serif;
  --font-body: 'Myriad Pro', 'YekanBakh', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { transition: opacity 0.22s ease; }
html.lang-switching { opacity: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
html[lang="fa"] body { font-family: 'YekanBakh', 'Myriad Pro', sans-serif; }
html[lang="fa"] h1, html[lang="fa"] h2, html[lang="fa"] h3 { font-family: 'YekanBakh', 'Myriad Pro', sans-serif; }
html[lang="fa"] {
  --font-head: 'YekanBakh', 'Myriad Pro', sans-serif;
  --font-body: 'YekanBakh', 'Myriad Pro', sans-serif;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; color: var(--ink); }
a { text-decoration: none; color: inherit; }

/* ---------- Header ---------- */
.panel-header {
  position: sticky;
  top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  padding: 14px 0;
}
.panel-header-inner {
  width: min(1180px, 92%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; color: var(--ink); }
.brand-logo { height: 56px; width: auto; display: block; }
.panel-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.plink { font-size: 0.92rem; font-weight: 500; color: var(--ink-soft); padding: 8px 4px; transition: color 0.2s; }
.plink:hover { color: var(--ink); }

.lang-toggle {
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold-dark);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 9px 18px;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.3s;
}
.lang-toggle:hover { background: var(--gold-grad); color: #fff; border-color: transparent; }

/* ---------- Buttons ---------- */
.btn-gold {
  display: inline-block;
  width: 100%;
  padding: 14px 28px;
  border-radius: 60px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
  color: #fff;
  background: var(--gold-grad);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 22px 60px rgba(133, 100, 4, 0.26); }

.btn-outline {
  padding: 9px 18px;
  border-radius: 40px;
  border: 1.5px solid var(--gold);
  background: transparent;
  color: var(--gold-dark);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-outline:hover { background: var(--gold-grad); color: #fff; border-color: transparent; }

.btn-sm {
  padding: 7px 16px;
  border-radius: 30px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  border: none;
  transition: all 0.25s;
  white-space: nowrap;
}
.btn-accept { background: #2e7d32; color: #fff; }
.btn-accept:hover { background: #256428; }
.btn-reject { background: #c62828; color: #fff; }
.btn-reject:hover { background: #a81f1f; }
.btn-quote { background: var(--gold-grad); color: #fff; }
.btn-quote:hover { filter: brightness(1.05); }

/* ---------- Auth page ---------- */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  min-height: calc(100vh - 80px);
}
.auth-card {
  width: min(440px, 100%);
  background: var(--white);
  border: 1px solid var(--gold-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px;
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 28px; background: var(--cream-2); padding: 6px; border-radius: 40px; }
.tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 40px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.3s;
}
.tab.active { background: var(--gold-grad); color: #fff; box-shadow: var(--shadow-sm); }
.auth-card h1 { font-size: 1.7rem; margin-bottom: 6px; }
.auth-sub { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #e6ddcb;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--cream-2);
  outline: none;
  transition: border 0.25s, box-shadow 0.25s;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.14); }

/* Captcha */
.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-img {
  height: 46px;
  flex: 0 0 auto;
  cursor: pointer;
  border: 1px solid #e6ddcb;
  border-radius: 8px;
  background: var(--cream-2);
}
.captcha-refresh {
  width: 40px; height: 46px; flex-shrink: 0;
  border: 1px solid var(--gold-light);
  background: transparent;
  color: var(--gold-dark);
  font-family: var(--font-body);
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s;
}
.captcha-refresh:hover { background: var(--gold-grad); color: #fff; border-color: transparent; }
.captcha-input {
  flex: 1; min-width: 60px;
  padding: 12px;
  border: 1px solid #e6ddcb;
  border-radius: 8px;
  font-size: 1.05rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream-2);
  outline: none;
  text-align: center;
}
.captcha-input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.14); }
.form-msg { min-height: 1.4em; margin-top: 12px; font-size: 0.88rem; color: #c62828; text-align: center; }
.form-msg.success { color: #2e7d32; }
.switch-link { text-align: center; margin-top: 18px; }
.switch-link a { color: var(--gold-dark); font-weight: 600; cursor: pointer; }
.switch-link a:hover { text-decoration: underline; }

/* ---------- Panel layout ---------- */
.panel-wrap { width: min(1180px, 92%); margin: 0 auto; padding: 46px 0 80px; }
.panel-layout { display: flex; gap: 30px; }
.sidebar { flex: 0 0 220px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 100px; }
.sidebar-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 18px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s;
}
.sidebar-link:hover { color: var(--ink); background: var(--cream-2); }
.sidebar-link.active { color: var(--gold-dark); background: var(--cream-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
html[dir="rtl"] .sidebar-link { text-align: right; }
html[dir="rtl"] .sidebar-link.active { box-shadow: inset -3px 0 0 var(--gold); }
.panel-content { flex: 1; min-width: 0; }
.tab-section { width: 100%; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 26px; }
.stat-card {
  background: var(--white);
  border: 1px solid var(--gold-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-label { font-size: 0.82rem; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--gold-dark); }
.panel-head { margin-bottom: 34px; }
.panel-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 6px; }
.panel-head p { color: var(--ink-soft); }
.welcome { margin-top: 6px; font-weight: 600; color: var(--gold-dark); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 26px; }
.panel-card {
  background: var(--white);
  border: 1px solid var(--gold-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 30px;
}
.panel-card h2 { font-size: 1.35rem; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.card-head h2 { margin-bottom: 0; }
.card-actions { display: flex; align-items: center; gap: 10px; }
.table-search {
  padding: 9px 14px;
  border: 1px solid #e6ddcb;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--ink);
  background: var(--cream-2);
  outline: none;
  width: 200px;
  transition: border 0.25s, box-shadow 0.25s;
}
.table-search:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.12); }
.table-search::placeholder { color: var(--ink-soft); opacity: 0.6; }

.field-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.field-row .field { flex: 1; min-width: 180px; }
.field-row input, .field-row .btn-gold { margin-bottom: 0; }
.estimate { font-size: 0.95rem; color: var(--ink-soft); margin: 12px 0; min-height: 1.4em; }
.estimate strong { color: var(--gold-dark); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th, .data-table td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid #efe7d6;
  font-size: 0.92rem;
}
html[dir="rtl"] .data-table th, html[dir="rtl"] .data-table td { text-align: right; }
.data-table th { color: var(--gold-dark); font-weight: 600; text-transform: uppercase; font-size: 0.76rem; letter-spacing: 0.06em; }
.data-table tbody tr:hover { background: var(--cream-2); }
.empty { text-align: center; color: var(--ink-soft); padding: 30px 0; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rate-input {
  width: 130px;
  padding: 8px 12px;
  border: 1px solid #e6ddcb;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  background: var(--cream-2);
  outline: none;
}
.rate-input:focus { border-color: var(--gold); }

/* ---------- Status badges ---------- */
.badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 30px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending { background: #fff8e1; color: #f9a825; }
.badge-quoted { background: #e3f2fd; color: #1565c0; }
.badge-accepted { background: #e8f5e9; color: #2e7d32; }
.badge-rejected { background: #fdecea; color: #c62828; }
.badge-completed { background: #ede7f6; color: #512da8; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-card {
  background: var(--white);
  border: 1px solid var(--gold-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: min(560px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  padding: 30px;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.modal-head h2 { margin-bottom: 0; font-size: 1.3rem; }
.detail-grid { display: flex; flex-direction: column; gap: 0; }
.detail-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  font-size: 0.82rem; font-weight: 600; color: var(--gold-dark);
  text-transform: uppercase; letter-spacing: 0.06em;
  flex: 0 0 140px;
}
.detail-value { color: var(--ink); font-size: 0.95rem; text-align: right; }
html[dir="rtl"] .detail-value { text-align: left; }
.btn-view { background: var(--cream-2); color: var(--ink); border: 1px solid var(--gold-light); }
.btn-view:hover { background: var(--gold-light); color: var(--ink); }
.btn-reset-pw { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.btn-reset-pw:hover { background: #ffe0b2; }
.btn-view-kyc { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.btn-view-kyc:hover { background: #bbdefb; }

/* ---------- KYC Status Card ---------- */
.kyc-status-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}
.kyc-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700;
  background: var(--cream-2);
  color: var(--ink-soft);
  margin-bottom: 18px;
  border: 3px solid var(--gold-light);
}
.kyc-icon.approved { background: #e8f5e9; color: #2e7d32; border-color: #2e7d32; }
.kyc-icon.declined { background: #fdecea; color: #c62828; border-color: #c62828; }
.kyc-icon.in_review { background: #e3f2fd; color: #1565c0; border-color: #1565c0; }
.kyc-icon.in_progress { background: #fff8e1; color: #f9a825; border-color: #f9a825; }
.kyc-status-card h3 { font-size: 1.3rem; margin-bottom: 8px; }
.kyc-status-card p { color: var(--ink-soft); max-width: 400px; }

/* ---------- KYC Gate ---------- */
.kyc-gate {
  background: var(--cream-2);
  border: 1px solid var(--gold-light);
  border-radius: var(--radius);
  padding: 36px 24px;
  margin-bottom: 26px;
  text-align: center;
}
.kyc-gate h3 { color: var(--ink); margin-bottom: 8px; }
.kyc-gate p { color: var(--ink-soft); margin-bottom: 4px; }
.kyc-gate-inner { display: flex; flex-direction: column; align-items: center; }

/* ---------- Admin tabs + user management ---------- */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-tab {
  padding: 10px 22px;
  border: 1px solid var(--gold-light);
  background: var(--white);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 40px;
  transition: all 0.25s;
}
.admin-tab.active { background: var(--gold-grad); color: #fff; border-color: transparent; }

.user-form {
  background: var(--cream-2);
  border: 1px solid var(--gold-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.user-form select {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #e6ddcb;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--cream-2);
  outline: none;
}
.btn-suspend { background: #b26a00; color: #fff; }
.btn-suspend:hover { background: #965800; }
.btn-activate { background: #2e7d32; color: #fff; }
.btn-activate:hover { background: #256428; }
.btn-delete { background: #c62828; color: #fff; }
.btn-delete:hover { background: #a81f1f; }

/* ---------- Admin chat ---------- */
.chat-admin { display: grid; grid-template-columns: 300px 1fr; gap: 16px; height: 560px; }
.chat-convs { border: 1px solid var(--gold-light); border-radius: var(--radius); overflow-y: auto; background: var(--white); }
.chat-conv { padding: 12px 14px; border-bottom: 1px solid #efe7d6; cursor: pointer; }
.chat-conv:hover { background: var(--cream-2); }
.chat-conv.active { background: var(--cream-2); box-shadow: inset 3px 0 0 var(--gold); }
.chat-conv .cc-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.chat-conv .cc-name { font-weight: 600; font-size: 0.92rem; }
.chat-conv .cc-badge { background: var(--gold); color: #fff; border-radius: 12px; padding: 1px 8px; font-size: 0.72rem; font-weight: 600; }
.chat-conv .cc-contact { font-size: 0.78rem; color: var(--ink-soft); margin-top: 2px; }
.chat-conv .cc-last { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-empty { padding: 20px; text-align: center; color: var(--ink-soft); font-size: 0.9rem; }

.chat-thread { display: flex; flex-direction: column; border: 1px solid var(--gold-light); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.chat-thread-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); font-size: 0.92rem; }
.chat-thread-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--cream); }
.chat-thread-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--gold-light); background: var(--white); }
.chat-thread-input input { flex: 1; min-width: 0; padding: 11px 13px; border: 1px solid #e6ddcb; border-radius: 10px; font-family: var(--font-body); font-size: 0.92rem; color: var(--ink); outline: none; }
.chat-thread-input input:focus { border-color: var(--gold); }

.chat-bubble { max-width: 80%; padding: 9px 13px; border-radius: 12px; font-size: 0.9rem; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.chat-bubble.visitor { align-self: flex-end; background: var(--gold-grad); color: #fff; border-bottom-right-radius: 3px; }
.chat-bubble.support { align-self: flex-start; background: #fff; border: 1px solid rgba(0,0,0,0.08); color: var(--ink); border-bottom-left-radius: 3px; }

@media (max-width: 860px) {
  .chat-admin { grid-template-columns: 1fr; height: auto; }
  .chat-convs { max-height: 240px; }
  .chat-thread { height: 420px; }
  .panel-layout { flex-direction: column; }
  .sidebar { flex: none; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; position: static; gap: 6px; }
  .sidebar-link { white-space: nowrap; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .auth-card { padding: 28px 22px; }
  .panel-card { padding: 22px 18px; }
  .panel-header-inner { flex-wrap: wrap; }
  .grid-3 { grid-template-columns: 1fr; }
}
