/* ============================================================================
   ur-contact.css — «تواصل معنا» كمحادثة (أم رهام)
   شاشة واحدة على سطح المكتب: لوحة هادئة (حالة الدوام، القنوات، الساعات)
   + نافذة محادثة ترتّب الرسالة ثم تفتحها في واتساب.
   ========================================================================= */

.ur-contact {
  --c-lime: #c9f07a;
  --c-deep: #07261a;
  --c-me: #0c3a28;
  --c-wa: #1faa59;
  --c-red: var(--colors-red-600, #dc2626);
  --c-h: clamp(540px, calc(100svh - 170px), 740px);
  background: var(--pf-body);
}
[data-theme~="dark"] .ur-contact { --c-me: #1b8354; }
.ur-pf-js:not(.ur-pf-static):not(.ur-pf-failsafe) [data-c-in] { opacity: 0; }

/* NDS يضيف أيقونة «رابط خارجي» لكل target=_blank */
.ur-contact a[target="_blank"]::after { content: none !important; display: none !important; }

.c-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.c-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  grid-template-rows: minmax(var(--c-h), auto);
  gap: clamp(12px, 1.4vw, 20px);
  padding-block: clamp(1rem, 2.2vw, 1.6rem);
}

/* ---------------------------------------------------------------------------
   اللوحة — عنوان وحالة في الأعلى، القنوات والساعات في الأسفل، وبينهما فراغ مقصود
--------------------------------------------------------------------------- */
.c-panel {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: clamp(1.4rem, 2.6vw, 2.2rem);
  overflow: hidden;
  border-radius: 26px;
  background: var(--c-deep);
  color: #eef6f1;
}
.c-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(32rem 24rem at 0% 100%, rgba(27, 131, 84, 0.35), transparent 70%);
}
[data-theme~="dark"] .c-panel { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }

.c-crumb { display: flex; gap: 0.5rem; font-size: 0.82rem; color: rgba(238, 246, 241, 0.55); }
.ur-contact .c-crumb a { color: inherit; text-decoration: none; }
.ur-contact .c-crumb a:hover { color: var(--c-lime); }

.ur-contact .c-title { margin: 0; font-size: clamp(1.8rem, 1.1rem + 1.7vw, 2.6rem); font-weight: 800; line-height: 1.3; color: #fff; }
.c-title em { position: relative; display: inline-block; font-style: normal; font-weight: 300; color: var(--c-lime); }
.c-title__scribble { position: absolute; inset-inline: 0; bottom: -0.3em; width: 100%; height: 0.4em; overflow: visible; }
.c-title__scribble path { fill: none; stroke: var(--c-lime); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 240; stroke-dashoffset: 240; animation: cDraw 1.2s var(--pf-ease) 0.8s forwards; }

/* الحالة: سطر واحد */
.c-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; margin: 0.3rem 0 0; font-size: 0.9rem; }
.c-status b { font-weight: 700; color: #fff; }
.c-status__note { color: rgba(238, 246, 241, 0.6); }
.c-status__note::before { content: "·"; margin-inline-end: 0.5rem; }
.c-status__dot { position: relative; flex: none; width: 9px; height: 9px; border-radius: 50%; background: #9aa3a0; }
.c-status__dot.is-open { background: #4ade80; }
.c-status__dot.is-soon { background: #fbbf24; }
.c-status__dot.is-open::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: cPing 1.8s ease-out infinite; }
@keyframes cPing { to { transform: scale(2.8); opacity: 0; } }

.c-reach { display: grid; gap: 1rem; margin-top: auto; }

/* واتساب: الإجراء الرئيسي الوحيد */
.ur-contact .c-wa-main {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem;
  padding-inline-end: 1.1rem;
  border-radius: 18px;
  background: var(--c-lime);
  color: #10240f;
  text-decoration: none;
  transition: background 0.3s, transform 0.5s var(--pf-ease);
}
.ur-contact .c-wa-main:hover { background: #fff; color: #10240f; transform: translateY(-2px); }
.c-wa-main__icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: #10240f; color: var(--c-lime); font-size: 1.35rem; }
.c-wa-main__text { display: grid; line-height: 1.35; }
.c-wa-main b { font-size: 1rem; font-weight: 800; }
.c-wa-main small { font-size: 0.82rem; text-align: right; color: rgba(16, 36, 15, 0.65); }
.c-wa-main__arrow { font-size: 1.2rem; transition: transform 0.4s var(--pf-ease); }
.c-wa-main:hover .c-wa-main__arrow { transform: translateX(-4px); }

/* القنوات الأخرى: صفوف هادئة بخط فاصل رفيع */
.c-list { margin: 0; padding: 0; list-style: none; }
.c-list li { display: flex; align-items: center; gap: 0.25rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.c-list li:not(:has(.c-copy))::after { content: ""; flex: none; width: 36px; } /* يحاذي القيم مع الصفوف التي فيها زر نسخ */
.ur-contact .c-row {
  display: grid;
  flex: 1;
  grid-template-columns: 20px auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.8rem 0.1rem;
  color: #eef6f1;
  text-decoration: none;
}
.c-row i { font-size: 1.1rem; color: rgba(238, 246, 241, 0.5); transition: color 0.3s; }
.c-row span { font-size: 0.85rem; color: rgba(238, 246, 241, 0.6); }
.c-row b { overflow: hidden; font-size: 0.92rem; font-weight: 600; text-align: left; text-overflow: ellipsis; white-space: nowrap; color: #fff; transition: color 0.3s; }
.ur-contact .c-row:hover b, .ur-contact .c-row:hover i { color: var(--c-lime); }
.c-copy { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: rgba(238, 246, 241, 0.62); cursor: pointer; transition: background 0.3s, color 0.3s, opacity 0.3s; }
.c-copy:hover, .c-copy.is-done { background: var(--c-lime); color: #10240f; }
.c-copy:focus-visible { outline: 2px solid var(--c-lime); outline-offset: 2px; }
@media (hover: hover) {
  .c-copy { opacity: 0; }
  .c-list li:hover .c-copy, .c-list li:focus-within .c-copy, .c-copy:focus, .c-copy.is-done { opacity: 1; }
}

/* ساعات العمل */
.c-hours { display: grid; gap: 0.1rem; margin: 0; padding: 0; list-style: none; font-size: 0.82rem; }
.c-hours li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.25rem 0; color: rgba(238, 246, 241, 0.5); }
.c-hours b { font-weight: 500; color: rgba(238, 246, 241, 0.8); }
.c-hours li.is-closed b { color: rgba(238, 246, 241, 0.55); }
.c-hours li.is-today span, .c-hours li.is-today b { color: var(--c-lime); }

/* ---------------------------------------------------------------------------
   نافذة المحادثة
--------------------------------------------------------------------------- */
.c-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--pf-line); border-radius: 26px; background: var(--pf-card); box-shadow: 0 30px 60px -40px rgba(4, 22, 15, 0.35); }

.c-chat__head { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--pf-line); }
.c-avatar { position: relative; display: grid; flex: none; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: color-mix(in srgb, var(--pf-green) 12%, var(--pf-card)); }
.c-avatar img { width: 30px; height: 30px; }
.c-avatar__dot { position: absolute; bottom: 1px; left: 1px; width: 13px; height: 13px; border: 2px solid var(--pf-card); border-radius: 50%; background: #9aa3a0; }
.c-avatar__dot.is-open { background: #22c55e; }
.c-avatar__dot.is-soon { background: #fbbf24; }
.ur-contact .c-chat__who { display: grid; flex: 1; min-width: 0; margin: 0; line-height: 1.35; }
.c-chat__who b { font-size: 1rem; font-weight: 800; color: var(--pf-ink); }
.c-chat__who small { font-size: 0.78rem; color: var(--pf-mute); transition: color 0.3s; }
.c-chat__who small.is-typing { color: var(--pf-green); }
.c-icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--pf-line); border-radius: 12px; background: transparent; color: var(--pf-mute); font-size: 1.1rem; cursor: pointer; transition: color 0.3s, border-color 0.3s; }
.c-icon-btn i { transition: transform 0.6s var(--pf-ease); }
.c-icon-btn:hover { border-color: var(--pf-ink); color: var(--pf-ink); }
.c-icon-btn:hover i { transform: rotate(-180deg); }

/* السجل — مطلق داخل .c-body كي لا يكبّر الرسائلُ النافذة */
.c-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background-color: color-mix(in srgb, var(--pf-green) 4%, var(--pf-body));
  background-image: radial-gradient(color-mix(in srgb, var(--pf-green) 13%, transparent) 1px, transparent 1.4px);
  background-size: 18px 18px;
}
.c-log { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem clamp(0.8rem, 2vw, 1.4rem) 1.2rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

.c-day { align-self: center; margin: 0 0 0.4rem; }
.c-day span { display: inline-block; padding: 0.2rem 0.75rem; border: 1px solid var(--pf-line); border-radius: 999px; background: var(--pf-card); font-size: 0.72rem; color: var(--pf-mute); }

.c-msg { position: relative; flex: none; max-width: min(82%, 430px); padding: 0.55rem 0.8rem 0.3rem; border-radius: 18px; animation: cPop 0.45s var(--pf-ease) both; }
.c-msg p { margin: 0; font-size: 0.95rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.c-msg__meta { display: flex; align-items: center; justify-content: flex-end; gap: 0.25rem; margin-top: 0.05rem; font-size: 0.66rem; font-variant-numeric: tabular-nums; color: var(--pf-mute); }
.c-msg--bot { align-self: flex-start; margin-top: 0.35rem; border: 1px solid var(--pf-line); border-start-start-radius: 6px; background: var(--pf-card); color: var(--pf-ink); transform-origin: top right; }
.c-msg--bot + .c-msg--bot { margin-top: 0; border-start-start-radius: 18px; }
.c-msg--me { align-self: flex-end; margin-top: 0.35rem; border-start-end-radius: 6px; background: var(--c-me); color: #fff; transform-origin: top left; }
.c-msg--me .c-msg__meta { color: rgba(255, 255, 255, 0.65); }
.c-msg--me .c-msg__meta i { font-size: 0.85rem; color: var(--c-lime); }
@keyframes cPop { from { opacity: 0; transform: translateY(8px) scale(0.94); } }

.c-typing { display: flex; gap: 4px; padding: 0.85rem 0.95rem; }
.c-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--pf-mute); animation: cDot 1.1s ease-in-out infinite; }
.c-typing i:nth-child(2) { animation-delay: 0.15s; }
.c-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes cDot { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* خيارات الرد السريع */
.c-opts { display: flex; flex: none; flex-wrap: wrap; align-self: flex-start; gap: 0.4rem; max-width: 94%; margin-top: 0.35rem; }
.c-opt {
  padding: 0.5rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--pf-green) 35%, var(--pf-line));
  border-radius: 999px;
  background: var(--pf-card);
  color: var(--pf-green);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  animation: cPop 0.45s var(--pf-ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s;
}
.c-opt:hover:not(:disabled) { border-color: var(--c-me); background: var(--c-me); color: var(--c-lime); transform: translateY(-2px); }
.c-opt:focus-visible { outline: 3px solid color-mix(in srgb, var(--pf-green) 45%, transparent); outline-offset: 2px; }
.c-opt:disabled { border-color: var(--pf-line); color: var(--pf-mute); text-decoration: line-through; opacity: 0.5; cursor: not-allowed; }

/* الملخص */
.c-sum { flex: none; align-self: flex-start; width: min(100%, 390px); margin-top: 0.35rem; overflow: hidden; border: 1px solid var(--pf-line); border-radius: 18px; border-start-start-radius: 6px; background: var(--pf-card); animation: cPop 0.5s var(--pf-ease) both; }
.c-sum__head { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 0.55rem 0.9rem; background: var(--c-deep); color: var(--c-lime); font-size: 0.78rem; font-weight: 700; }
.c-sum__head i { font-size: 1rem; }
.c-sum__row { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) 30px; align-items: start; gap: 0.5rem; padding: 0.5rem 0.9rem; border-bottom: 1px dashed var(--pf-line); }
.c-sum__row > span { padding-top: 0.15rem; font-size: 0.78rem; color: var(--pf-mute); }
.c-sum__row b { font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; color: var(--pf-ink); }
.c-sum__row b[dir="ltr"] { text-align: right; }
.c-sum__row--msg b { display: -webkit-box; overflow: hidden; font-weight: 400; line-height: 1.6; white-space: pre-wrap; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.c-sum__edit { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: var(--pf-mute); cursor: pointer; transition: background 0.25s, color 0.25s; }
.c-sum__edit:hover { background: color-mix(in srgb, var(--pf-green) 12%, transparent); color: var(--pf-green); }
.c-wa { display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: calc(100% - 1.4rem); min-height: 48px; margin: 0.7rem; border: 0; border-radius: 13px; background: var(--c-wa); color: #fff; font: inherit; font-weight: 700; cursor: pointer; transition: background 0.3s, transform 0.2s; }
.c-wa:hover { background: #178f4a; }
.c-wa:active { transform: scale(0.98); }
.c-wa i { font-size: 1.25rem; }
.c-sum.is-sent { opacity: 0.75; }
.c-sum.is-sent .c-sum__edit { visibility: hidden; }
.c-sum.is-sent .c-wa { background: var(--pf-line); color: var(--pf-mute); cursor: default; }

/* بعد الإرسال */
.c-done { display: grid; flex: none; justify-items: center; align-self: center; gap: 0.45rem; width: min(100%, 360px); margin-top: 0.6rem; padding: 1rem; border: 1px solid var(--pf-line); border-radius: 18px; background: var(--pf-card); text-align: center; animation: cPop 0.5s var(--pf-ease) both; }
.c-done__tick { width: 60px; height: 60px; }
.c-done__tick circle { fill: none; stroke: var(--pf-green); stroke-width: 3; stroke-dasharray: 227; stroke-dashoffset: 227; transform: rotate(-90deg); transform-origin: center; animation: cDraw 0.8s var(--pf-ease) 0.2s forwards; }
.c-done__tick path { fill: none; stroke: var(--pf-green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: cDraw 0.55s var(--pf-ease) 0.75s forwards; }
@keyframes cDraw { to { stroke-dashoffset: 0; } }
.c-done p { margin: 0; font-size: 0.88rem; color: var(--pf-mute); }
.c-done p b { font-family: ui-monospace, Consolas, monospace; color: var(--pf-ink); }
.c-done__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 0.2rem; }
.ur-contact .c-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 42px; padding: 0 1.1rem; border: 0; border-radius: 12px; font: inherit; font-size: 0.88rem; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background 0.3s; }
.ur-contact .c-btn--wa { background: var(--c-wa); color: #fff; }
.ur-contact .c-btn--wa:hover { background: #178f4a; color: #fff; }
.c-link { padding: 0.4rem 0.6rem; border: 0; background: none; color: var(--pf-mute); font: inherit; font-size: 0.88rem; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.c-link:hover { color: var(--pf-ink); }

/* شريط الكتابة */
.c-composer { position: relative; display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.7rem 0.8rem; border-top: 1px solid var(--pf-line); background: var(--pf-card); }
.c-composer textarea { flex: 1; min-width: 0; min-height: 46px; max-height: 128px; padding: 0.7rem 1rem; border: 1px solid var(--pf-line); border-radius: 23px; background: var(--pf-body); color: var(--pf-ink); font: inherit; line-height: 1.45; resize: none; transition: border-color 0.3s, box-shadow 0.3s; }
.c-composer textarea[dir="ltr"] { text-align: right; }
.c-composer textarea::placeholder { color: var(--pf-mute); }
.c-composer textarea:focus { outline: 0; border-color: var(--pf-green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pf-green) 14%, transparent); }
.c-composer textarea:disabled { opacity: 0.75; cursor: not-allowed; }
.c-composer.is-bad textarea { border-color: var(--c-red); }
.c-composer.is-shake { animation: cShake 0.45s; }
@keyframes cShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.c-send { display: grid; flex: none; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--c-me); color: var(--c-lime); font-size: 1.25rem; cursor: pointer; transition: background 0.3s, color 0.3s, transform 0.35s var(--pf-ease); }
.c-send:hover:not(:disabled) { transform: scale(1.07); }
.c-send:disabled { background: var(--pf-line); color: var(--pf-mute); cursor: not-allowed; }
.c-hint { position: absolute; bottom: 100%; right: 1rem; max-width: calc(100% - 2rem); margin: 0 0 0.45rem; padding: 0.3rem 0.7rem; border-radius: 10px; background: var(--c-red); color: #fff; font-size: 0.8rem; }
.c-hint:empty { display: none; }

/* ---------------------------------------------------------------------------
   الاستجابة
--------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .c-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
  .c-reach { margin-top: 0.6rem; }
  .c-chat { height: min(640px, 80svh); }
}
@media (max-width: 520px) {
  .c-row b { font-size: 0.85rem; }
  .c-chat { height: 78svh; border-radius: 22px; }
  .c-msg { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) {
  .c-status__dot::after, .c-typing i { animation: none; }
  .c-msg, .c-opt, .c-sum, .c-done, .c-composer.is-shake { animation: none; }
  .c-title__scribble path, .c-done__tick circle, .c-done__tick path { animation: none; stroke-dashoffset: 0; }
}
