:root{
  --bg: #0B0F17;
  --bg-raised: #131926;
  --bg-raised-2: #1B2332;
  --line: rgba(255,255,255,0.08);
  --text: #F3F1EA;
  --text-dim: #9AA3B5;
  --red: #FF3B4E;
  --amber: #FFB020;
  --teal: #2FD1C4;
  --violet: #8B6BFF;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Barlow', sans-serif;
  --radius: 14px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
*{box-sizing:border-box;}
html{scroll-padding-top: var(--safe-t);}
html,body{height:100%;}
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
  -webkit-font-smoothing: antialiased;
}
a{ color: inherit; }

.topbar{
  position: sticky; top: var(--safe-t); z-index: 20;
  display:flex; align-items:center; justify-content: space-between;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(11,15,23,0.97), rgba(11,15,23,0.86));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand{display:flex; align-items:center; gap:10px; text-decoration:none;}
.logo-mark{ height:40px; width:auto; display:block; }
.brand-name{
  font-family: var(--font-display); font-weight: 800; font-size: 24px;
  letter-spacing: 0.3px; line-height:1; color: var(--text);
}
.topbar-actions{ display:flex; align-items:center; gap:10px; }
.menu-btn, .icon-btn{
  width: 42px; height: 42px;
  display:flex; align-items:center; justify-content:center;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: 10px; cursor:pointer; padding:0; color: var(--text);
  text-decoration:none; font-size: 18px;
}
.menu-btn:hover, .icon-btn:hover{ border-color: rgba(255,255,255,0.2); }

main{ max-width: 720px; margin: 0 auto; padding: 24px 18px 60px; }

h1.page-title{
  font-family: var(--font-display); font-weight:800; font-size: 30px;
  margin: 0 0 6px 0;
}
p.page-sub{ color: var(--text-dim); margin: 0 0 24px 0; font-size: 14px; }

.card{
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.field{ margin-bottom: 16px; }
.field label{ display:block; font-size:13px; color: var(--text-dim); margin-bottom:6px; font-weight:600; }
.field input, .field textarea, .field select{
  width:100%; background: var(--bg-raised-2); border: 1px solid var(--line);
  color: var(--text); padding: 12px 14px; border-radius: 10px;
  font-family: var(--font-body); font-size: 15px;
}
.field textarea{ min-height: 100px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus{
  outline: none; border-color: var(--teal);
}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background: var(--red); color:#fff; border:none;
  padding: 12px 20px; border-radius:999px; font-weight:700; cursor:pointer;
  font-family: var(--font-body); font-size: 15px; text-decoration:none;
}
.btn:hover{ filter: brightness(1.08); }
.btn.secondary{ background: var(--bg-raised-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost{ background: transparent; color: var(--text-dim); border: 1px solid var(--line); }
.btn[disabled]{ opacity:.5; cursor:not-allowed; }

.msg{ padding: 12px 14px; border-radius: 10px; font-size:14px; margin-bottom:16px; display:none; }
.msg.error{ background: rgba(255,59,78,0.12); color:#ffb0b8; border:1px solid rgba(255,59,78,0.3); }
.msg.ok{ background: rgba(47,209,196,0.12); color: var(--teal); border:1px solid rgba(47,209,196,0.3); }

.muted-link{ color: var(--text-dim); font-size: 14px; text-decoration:none; }
.muted-link:hover{ color: var(--text); }

.spinner{
  width:16px; height:16px; border-radius:50%;
  border:2px solid rgba(255,255,255,0.3); border-top-color:#fff;
  animation: spin .7s linear infinite; display:inline-block;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* Drawer */
.scrim{
  position: fixed; inset:0; background: rgba(5,7,11,0.6);
  opacity:0; pointer-events:none; transition: opacity .25s ease; z-index: 30;
}
.scrim.open{ opacity:1; pointer-events:auto; }
.drawer{
  position: fixed; top:0; right:0; height:100%; width: min(340px, 86vw);
  background: var(--bg-raised); border-left: 1px solid var(--line);
  z-index: 40; transform: translateX(100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  padding: calc(18px + var(--safe-t)) 20px calc(20px + var(--safe-b));
  display:flex; flex-direction:column; overflow-y:auto;
}
.drawer.open{ transform: translateX(0); }
.drawer-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 22px; }
.drawer-top .brand{ display:flex; align-items:center; }
.drawer-close{
  width:36px; height:36px; border-radius:10px;
  background: var(--bg-raised-2); border:1px solid var(--line); color:var(--text);
  font-size:16px; cursor:pointer;
}
.drawer h3{
  font-family: var(--font-display); font-weight:700; font-size: 13px;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-dim);
  margin: 0 0 10px 0;
}
.drawer-section{ margin-bottom: 26px; }
#linksList{ display:flex; flex-direction:column; gap:8px; }
#contactLinkBox{ display:flex; flex-direction:column; gap:8px; margin-bottom:8px; padding-bottom:8px; border-bottom: 1px solid var(--line); }
.link-item{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background: var(--bg-raised-2); border: 1px solid var(--line);
  padding: 13px 14px; border-radius: 12px; text-decoration:none;
  color: var(--text); font-weight:600; font-size: 15px;
}
.link-item .arrow{ color: var(--text-dim); font-size:16px; }
.drawer-logout{ margin-top:auto; padding-top: 16px; border-top: 1px solid var(--line); }
.drawer-logout .link-item{ width:100%; border:1px solid var(--line); cursor:pointer; font-family:inherit; justify-content:center; }
.drawer-footer{
  padding-top: 14px;
  color: var(--text-dim); font-size: 12.5px; text-align:center;
}

.page-title + .page-sub{ margin-bottom: 8px; }
.section-title{
  font-family: var(--font-display); font-weight:700; font-size: 20px; margin: 34px 0 14px;
}

/* Comments */
.comment-item{
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.comment-item:last-child{ border-bottom:none; }
.comment-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:4px; }
.comment-author{ font-weight:700; font-size:14px; }
.comment-time{ font-size:12px; color: var(--text-dim); }
.comment-body{ font-size:14px; color: var(--text); line-height:1.5; }
.comment-pending{ font-size:11px; color: var(--amber); font-weight:700; letter-spacing:.5px; margin-left:8px; }

/* Repons (tankou Facebook) */
.comment-actions{ margin-top:6px; }
.reply-btn{
  background:transparent; border:none; color: var(--text-dim); font-size:12.5px; font-weight:700;
  cursor:pointer; padding:0; font-family: var(--font-body);
}
.reply-btn:hover{ color: var(--teal); }
.reply-to{ color: var(--teal); font-weight:700; }
.reply-list{ margin-left: 18px; padding-left: 14px; border-left: 2px solid var(--line); }
.comment-reply{ padding: 10px 0; }
.reply-form{ display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
.reply-input{
  flex:1; min-width:160px; background: var(--bg-raised-2); border: 1px solid var(--line);
  color: var(--text); padding: 9px 12px; border-radius: 10px; font-family: var(--font-body); font-size: 14px;
}
.reply-input:focus{ outline:none; border-color: var(--teal); }
.reply-actions{ display:flex; gap:8px; align-items:center; }
.reply-actions .reply-send{ padding: 9px 16px; font-size:13px; }
.reply-cancel{
  background:transparent; border:1px solid var(--line); color: var(--text-dim);
  padding: 9px 12px; border-radius: 999px; font-size:13px; cursor:pointer; font-family: var(--font-body);
}

table.admin-table{ width:100%; border-collapse: collapse; font-size: 14px; }
table.admin-table th{ text-align:left; color: var(--text-dim); font-size:12px; text-transform:uppercase; letter-spacing:.5px; padding: 8px; border-bottom: 1px solid var(--line); }
table.admin-table td{ padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.badge{ display:inline-block; padding:3px 9px; border-radius:999px; font-size:11px; font-weight:700; }
.badge.ok{ background: rgba(47,209,196,0.15); color: var(--teal); }
.badge.warn{ background: rgba(255,176,32,0.15); color: var(--amber); }
.row-actions{ display:flex; gap:6px; flex-wrap:wrap; }
.row-actions button{
  background: var(--bg-raised-2); border:1px solid var(--line); color: var(--text);
  padding: 6px 10px; border-radius:8px; font-size:12px; cursor:pointer;
}
.row-actions button.danger{ color:#ff8a94; border-color: rgba(255,59,78,0.4); }

/* ---------- Repons an liy pou ansyen mesaj fòm kontak (san kont) ---------- */
.contact-reply-existing{
  margin-top:8px; padding:8px 10px; background: var(--bg-raised-2); border: 1px solid var(--line);
  border-radius:8px; font-size:12.5px; line-height:1.4;
}
.contact-reply-existing .lbl{ font-weight:700; color: var(--teal); display:block; margin-bottom:3px; font-size:11px; text-transform:uppercase; letter-spacing:.4px; }
.contact-reply-box{ margin-top:8px; display:flex; flex-direction:column; gap:6px; }
.contact-reply-box textarea{
  width:100%; min-height:60px; resize:vertical; background: var(--bg-raised-2); border: 1px solid var(--line);
  color: var(--text); padding: 8px 10px; border-radius: 8px; font-family: var(--font-body); font-size: 13px;
}
.contact-reply-box .row-actions{ justify-content:flex-end; }

.admin-nav{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom: 22px; }
.admin-nav a{
  padding: 8px 14px; border-radius: 999px; background: var(--bg-raised);
  border: 1px solid var(--line); color: var(--text-dim); text-decoration:none; font-size:13px; font-weight:600;
}
.admin-nav a.active{ background: var(--bg-raised-2); color: var(--text); border-color: rgba(255,255,255,0.2); }

/* ---------- Klòch notifikasyon ---------- */
.notif-dropdown{ position: relative; }
.notif-btn{ position: relative; }
.notif-btn svg{ width:20px; height:20px; }
.notif-badge{
  position:absolute; top:3px; right:3px; min-width:16px; height:16px; padding:0 4px;
  background: var(--red); color:#fff; border-radius:999px; font-size:10px; font-weight:800;
  display:flex; align-items:center; justify-content:center; line-height:1; border: 2px solid var(--bg-raised);
}
.notif-menu{
  position:absolute; right:0; top: calc(100% + 8px); width: min(340px, 88vw); z-index: 50;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.45); overflow:hidden;
}
.notif-menu[hidden]{ display:none; }
.notif-menu-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-family: var(--font-display); font-weight:700; font-size:13px; letter-spacing:.5px; text-transform:uppercase; color: var(--text-dim);
}
.notif-mark-all{
  background:transparent; border:none; color: var(--teal); font-size:12px; font-weight:700;
  cursor:pointer; text-transform:none; letter-spacing:0; font-family: var(--font-body); padding:0;
}
.notif-list{ max-height: 360px; overflow-y:auto; }
.notif-empty{ padding: 24px 14px; text-align:center; color: var(--text-dim); font-size:13.5px; }
.notif-item{
  display:block; width:100%; text-align:left; background:transparent; border:none;
  border-bottom: 1px solid var(--line); padding: 12px 14px; cursor:pointer; font-family: var(--font-body);
}
.notif-item:last-child{ border-bottom:none; }
.notif-item:hover{ background: var(--bg-raised-2); }
.notif-item.unread{ background: rgba(47,209,196,0.06); }
.notif-item.unread .notif-item-title{ position:relative; padding-left:14px; }
.notif-item.unread .notif-item-title::before{
  content:''; position:absolute; left:0; top:6px; width:7px; height:7px; border-radius:50%; background: var(--teal);
}
.notif-item-title{ font-size:14px; font-weight:600; color: var(--text); }
.notif-item-body{ font-size:12.5px; color: var(--text-dim); margin-top:3px; }
.notif-item-time{ font-size:11px; color: var(--text-dim); margin-top:5px; }

[hidden]{ display:none !important; }

/* ---------- Mesajri (overlay + app rezoutilizab) ---------- */
.msgs-scrim{
  position: fixed; inset:0; background: rgba(5,7,11,0.65); z-index: 80;
  display:flex; align-items:center; justify-content:center; padding: 16px;
  opacity:0; pointer-events:none; transition: opacity .2s ease;
}
.msgs-scrim.open{ opacity:1; pointer-events:auto; }
.msgs-overlay-panel{
  width: min(480px, 100%); height: min(640px, 88vh); height: min(640px, 88dvh);
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0,0,0,.5); display:flex; flex-direction:column; overflow:hidden;
}
.msgs-overlay-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--font-display); font-weight:700; font-size:16px;
}
.msgs-overlay-close{
  width:32px; height:32px; border-radius:8px; background: var(--bg-raised-2);
  border:1px solid var(--line); color: var(--text); cursor:pointer; font-size:14px;
}
.msgs-overlay-body{ flex:1; min-height:0; display:flex; flex-direction:column; }
.msgs-app{ flex:1; min-height:0; display:flex; flex-direction:column; height:100%; }
.msgs-loading, .msgs-empty{ padding: 30px 16px; text-align:center; color: var(--text-dim); font-size:14px; margin:auto; }

.msgs-layout{ flex:1; min-height:0; display:flex; height:100%; }
.msgs-list-pane{ width: 240px; flex-shrink:0; border-right: 1px solid var(--line); display:flex; flex-direction:column; min-height:0; }
.msgs-list-head{ padding: 12px 14px; font-weight:700; font-size:13px; text-transform:uppercase; letter-spacing:.5px; color: var(--text-dim); border-bottom:1px solid var(--line); }
.msgs-conv-list{ flex:1; overflow-y:auto; }
.msgs-conv{
  display:block; width:100%; text-align:left; background:transparent; border:none;
  border-bottom: 1px solid var(--line); padding: 10px 14px; cursor:pointer; font-family: var(--font-body); color: var(--text);
}
.msgs-conv:hover{ background: var(--bg-raised-2); }
.msgs-conv.active{ background: var(--bg-raised-2); }
.msgs-conv.unread .msgs-conv-name{ position:relative; padding-left:14px; font-weight:800; }
.msgs-conv.unread .msgs-conv-name::before{ content:''; position:absolute; left:0; top:5px; width:7px; height:7px; border-radius:50%; background: var(--teal); }
.msgs-conv-name{ font-size:14px; font-weight:600; }
.msgs-conv-last{ font-size:12px; color: var(--text-dim); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.msgs-conv-time{ font-size:10.5px; color: var(--text-dim); margin-top:3px; }

.msgs-thread-pane{ flex:1; min-height:0; display:flex; flex-direction:column; }
.msgs-thread-head{ display:flex; align-items:center; gap:10px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight:700; font-size:14px; }
.msgs-thread-head-name{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.msgs-back-btn{ display:none; background:transparent; border:none; color: var(--text); font-size:18px; cursor:pointer; padding:0; }
.msgs-del-conv-btn{
  background:transparent; border:none; color: var(--text-dim); font-size:15px; cursor:pointer;
  padding:4px; border-radius:6px; flex-shrink:0; line-height:1;
}
.msgs-del-conv-btn:hover{ color:#ff8a94; background: rgba(255,59,78,0.1); }
.msgs-bubbles{ flex:1; overflow-y:auto; padding: 14px; display:flex; flex-direction:column; gap:8px; }
.msgs-bubble{ position:relative; max-width: 78%; padding: 9px 12px; border-radius: 14px; font-size:14px; line-height:1.4; }
.msgs-bubble.theirs{ align-self:flex-start; background: var(--bg-raised-2); border: 1px solid var(--line); border-bottom-left-radius:4px; }
.msgs-bubble.mine{ align-self:flex-end; background: var(--teal); color:#06231f; border-bottom-right-radius:4px; }
.msgs-bubble-text{ white-space:pre-wrap; word-break:break-word; }
.msgs-bubble-meta{ display:flex; align-items:center; justify-content:flex-end; gap:6px; font-size:10.5px; opacity:.65; margin-top:4px; text-align:right; }
.msgs-seen{ white-space:nowrap; }
.msgs-seen.is-seen{ opacity:1; font-weight:700; color: #0a4a3f; }
.msgs-bubble.theirs .msgs-seen.is-seen{ color: var(--teal); }
.msgs-bubble-del{
  position:absolute; top:-8px; right:-8px; width:20px; height:20px; border-radius:50%;
  background: var(--bg-raised); border: 1px solid var(--line); color: var(--text-dim);
  font-size:10px; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center;
  opacity:0; transition: opacity .15s ease;
}
.msgs-bubble:hover .msgs-bubble-del{ opacity:1; }
.msgs-bubble-del:hover{ color:#ff8a94; border-color: rgba(255,59,78,0.4); }
@media (hover:none){ .msgs-bubble-del{ opacity:1; } }
.msgs-compose{ display:flex; gap:8px; padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); align-items:flex-end; flex-shrink:0; }
.msgs-input{
  flex:1; resize:none; max-height:140px; background: var(--bg-raised-2); border: 1px solid var(--line);
  color: var(--text); padding: 10px 12px; border-radius: 12px; font-family: var(--font-body); font-size: 14px;
}
.msgs-input:focus{ outline:none; border-color: var(--teal); }
.msgs-send{
  background: var(--red); color:#fff; border:none; padding: 10px 16px; border-radius:999px;
  font-weight:700; cursor:pointer; font-family: var(--font-body); font-size:13.5px; flex-shrink:0;
}
.msgs-send:hover{ filter: brightness(1.08); }

/* Paj admin: mesajri anndan paj la (pa nan yon overlay) */
.msgs-page-frame{ height: min(640px, 74vh); height: min(640px, 74dvh); border: 1px solid var(--line); border-radius: var(--radius); overflow:hidden; background: var(--bg-raised); }

@media (max-width: 640px){
  .msgs-list-pane{ width:100%; border-right:none; }
  .msgs-layout{ position:relative; }
  .msgs-list-pane, .msgs-thread-pane{ width:100%; flex-shrink:0; }
  .msgs-layout .msgs-thread-pane{ display:none; }
  .msgs-layout.msgs-mobile-thread .msgs-thread-pane{ display:flex; }
  .msgs-layout.msgs-mobile-thread .msgs-list-pane{ display:none; }
  .msgs-back-btn{ display:inline-block; }
  .msgs-scrim{ padding: 0; align-items:flex-end; }
  .msgs-overlay-panel{ width:100%; height:92vh; height:92dvh; border-radius: 16px 16px 0 0; }
  .msgs-input{ font-size:16px; }
}

/* ---------- Bouton lang (meni deroulan) ---------- */
.lang-dropdown{ position: relative; }
.lang-toggle{
  height: 42px; display:flex; align-items:center; gap:6px; padding: 0 12px;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); cursor:pointer; font-family: var(--font-body); font-weight:700; font-size:13px;
}
.lang-toggle:hover, .lang-toggle[aria-expanded="true"]{ border-color: rgba(255,255,255,0.2); }
.lang-toggle svg{ width:18px; height:18px; fill:none; stroke: currentColor; stroke-width:1.8; }
.lang-toggle .caret{ font-size:10px; color: var(--text-dim); }
.lang-menu{
  position:absolute; right:0; top: calc(100% + 8px); min-width: 190px; z-index: 50;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.45);
}
.lang-menu[hidden]{ display:none; }
.lang-opt{
  display:flex; width:100%; align-items:center; gap:10px; background:transparent; border:none;
  color: var(--text); padding: 10px 12px; border-radius: 8px; cursor:pointer;
  font-family: var(--font-body); font-size:14px; font-weight:600; text-align:left;
}
.lang-opt:hover{ background: var(--bg-raised-2); }
.lang-opt .code{ width:24px; color: var(--text-dim); font-size:11px; font-weight:700; }
.lang-opt .name{ flex:1; }
.lang-opt .tick{ visibility:hidden; color: var(--teal); }
.lang-opt.active .tick{ visibility:visible; }

/* ---------- Kat itilizatè nan meni an ---------- */
.user-card{
  display:flex; align-items:center; gap:12px; padding: 12px 14px; margin-bottom: 8px;
  background: var(--bg-raised-2); border: 1px solid var(--line); border-radius: 12px;
}
.user-avatar{
  width:42px; height:42px; border-radius:50%; background: var(--teal); color:#06231f;
  display:flex; align-items:center; justify-content:center; font-weight:800; font-size:18px;
  flex-shrink:0; overflow:hidden;
}
.user-avatar img{ width:100%; height:100%; object-fit:cover; }
.user-meta{ min-width:0; }
.user-name{ font-weight:700; font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-email{ font-size:12px; color: var(--text-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-status{ font-size:11px; color: var(--teal); font-weight:700; letter-spacing:.4px; text-transform:uppercase; }
