/* Blastifi — style.css v3 — WhatsApp Light Theme */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* WhatsApp Colors */
  --green:      #25D366;
  --green-d:    #128C7E;
  --green-dk:   #075E54;
  --green-l:    #DCF8C6;
  --green-ll:   #f0fdf4;

  /* Light backgrounds */
  --bg:         #f0f2f5;
  --bg2:        #ffffff;
  --bg3:        #f7f8fa;
  --bg4:        #ececec;
  --sidebar-bg: #ffffff;
  --topbar-bg:  #ffffff;

  /* Borders */
  --border:     #e0e0e0;
  --border2:    #ebebeb;

  /* Text */
  --text:       #111b21;
  --text2:      #54656f;
  --text3:      #8696a0;

  /* Status */
  --danger:     #dc3545;
  --warn:       #f0a500;
  --info:       #0084ff;

  /* UI */
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 1px 3px rgba(0,0,0,.1), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm:  0 1px 2px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: 'IBM Plex Sans Arabic', sans-serif; font-size: 15px; }
body { background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 0; gap: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  flex-shrink: 0;
}

.sidebar .logo {
  font-size: 1.2rem; font-weight: 800; color: var(--green-dk);
  padding: 1.25rem 1.25rem 1rem;
  display: flex; align-items: center; gap: .6rem;
  border-bottom: 1px solid var(--border2);
}

.nav-section { padding: .5rem .75rem .25rem; }
.nav-section-label { font-size: .68rem; font-weight: 700; color: var(--text3); letter-spacing: .08em; text-transform: uppercase; padding: .5rem .5rem .25rem; }

.nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem; border-radius: var(--radius-sm);
  color: var(--text2); text-decoration: none;
  font-size: .875rem; font-weight: 500;
  transition: all .15s;
}
.nav-link:hover { background: var(--bg3); color: var(--text); }
.nav-link.active { background: var(--green-ll); color: var(--green-dk); font-weight: 600; }
.nav-link .icon { font-size: 1rem; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-divider { height: 1px; background: var(--border2); margin: .4rem .75rem; }

.plan-badge {
  margin-top: auto;
  border-top: 1px solid var(--border2);
  padding: 1rem 1.25rem; font-size: .8rem;
}
.plan-badge strong { color: var(--green-dk); font-size: .82rem; display: block; }
.plan-badge .user-name { color: var(--text2); margin-top: .2rem; font-size: .8rem; }

/* ── Main ── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── Topbar ── */
.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 1rem; font-weight: 700; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }

.content { padding: 1.5rem; flex: 1; }

/* ── Cards ── */
.card {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 1.25rem 1.1rem;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--green);
}
.stat-val {
  font-size: 2rem; font-weight: 700; color: var(--green-dk);
  font-family: 'IBM Plex Mono', monospace; line-height: 1;
}
.stat-label { color: var(--text2); font-size: .78rem; margin-top: .3rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; cursor: pointer;
  border: none; transition: all .15s; font-family: inherit;
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: #1dbe59; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg4); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(220,53,69,.3); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.4rem; font-size: 1rem; }
.btn-icon { padding: .35rem .45rem; background: transparent; border: none; color: var(--text3); cursor: pointer; border-radius: 6px; font-size: 1rem; transition: all .15s; }
.btn-icon:hover { background: var(--bg3); color: var(--text); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.form-group label { font-size: .8rem; color: var(--text2); font-weight: 600; }
.form-control {
  background: var(--bg2); border: 1.5px solid var(--border);
  color: var(--text); padding: .55rem .85rem;
  border-radius: var(--radius-sm); font-size: .9rem;
  font-family: inherit; transition: all .15s; width: 100%;
}
.form-control:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(37,211,102,.12); }
.form-control::placeholder { color: var(--text3); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; background-color: var(--bg2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead { background: var(--bg3); }
th { text-align: start; padding: .7rem 1rem; color: var(--text2); font-weight: 600; font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: .8rem 1rem; border-bottom: 1px solid var(--border2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--bg3); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: .2rem .6rem; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-green  { background: #e8f5e9; color: #1b7a3e; }
.badge-gray   { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.badge-warn   { background: #fff8e1; color: #a16800; }
.badge-danger { background: #fdecea; color: var(--danger); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; width: 100%; max-width: 500px;
  padding: 1.5rem; box-shadow: 0 8px 32px rgba(0,0,0,.15);
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(12px); opacity:0 } to { transform: none; opacity:1 } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; padding-bottom: .85rem; border-bottom: 1px solid var(--border2); }
.modal-header h2 { font-size: 1rem; font-weight: 700; }

/* ── Send screen ── */
.send-list { display: flex; flex-direction: column; gap: .6rem; }
.send-item {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  display: flex; flex-direction: row; align-items: center; gap: .75rem;
  box-shadow: var(--shadow-sm); transition: all .2s;
  direction: ltr; /* ثابت — نتحكم يدوياً بالنص */
}
.send-item:hover { border-color: var(--green); }
.send-item.done { opacity: .45; }
.contact-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--green-ll); border: 2px solid var(--green-l);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--green-dk); font-size: .85rem; flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name {
  font-weight: 600; color: var(--text);
  white-space: normal; word-break: break-word;
  direction: rtl; text-align: right;
}
.contact-phone {
  font-size: .78rem; color: var(--text2);
  font-family: 'IBM Plex Mono', monospace;
  direction: ltr; text-align: left;
}
.msg-preview {
  font-size: .75rem; color: var(--text3); margin-top: .2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  direction: rtl; text-align: right;
}
.send-item .actions { display: flex; flex-direction: column; gap: .4rem; flex-shrink: 0; align-items: center; }

.wa-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--green); color: #fff;
  padding: .45rem .9rem; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  text-decoration: none; transition: all .15s;
}
.wa-btn:hover { background: #1dbe59; }

.mark-btn {
  background: var(--bg3); border: 1.5px solid var(--border);
  color: var(--text2); padding: .45rem .9rem;
  border-radius: var(--radius-sm); font-size: .82rem;
  cursor: pointer; font-family: inherit; font-weight: 500; transition: all .15s;
}
.mark-btn:hover { border-color: var(--green); color: var(--green-dk); background: var(--green-ll); }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 1.5rem; inset-inline-end: 1.5rem;
  background: var(--text); color: #fff;
  padding: .7rem 1.2rem; border-radius: var(--radius-sm);
  font-size: .875rem; box-shadow: var(--shadow); z-index: 200;
  transform: translateY(60px) scale(.95); opacity: 0;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  max-width: 300px;
}
#toast.show { transform: translateY(0) scale(1); opacity: 1; }
#toast.success { background: var(--green-dk); }
#toast.error   { background: var(--danger); }

/* ── Auth ── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 1rem;
  background: linear-gradient(135deg, var(--green-dk) 0%, var(--green-d) 50%, #1a9e6e 100%);
}
.auth-card {
  background: var(--bg2); border-radius: 18px;
  padding: 2rem 1.75rem; width: 100%; max-width: 400px;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
  animation: slideUp .3s ease;
}
.auth-logo { text-align: center; margin-bottom: 1.75rem; }
.auth-logo .logo-icon { font-size: 2.5rem; display: block; margin-bottom: .4rem; }
.auth-logo h1 { font-size: 1.75rem; font-weight: 800; color: var(--green-dk); }
.auth-logo p { color: var(--text2); font-size: .875rem; margin-top: .25rem; }
.auth-footer { text-align: center; margin-top: 1.1rem; font-size: .875rem; color: var(--text2); }
.auth-footer a { color: var(--green-d); text-decoration: none; font-weight: 600; }

/* ── Alert ── */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 1rem; }
.alert-danger  { background: #fdecea; border: 1px solid #f5c6cb; color: var(--danger); }
.alert-success { background: #e8f5e9; border: 1px solid #c3e6cb; color: #1b7a3e; }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }

/* ── Empty ── */
.empty-state { text-align: center; padding: 3.5rem 2rem; color: var(--text3); }
.empty-state .empty-icon { font-size: 2.75rem; margin-bottom: .75rem; opacity: .5; }

/* ── Progress ── */
.progress-bar { height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 99px; transition: width .6s ease; background: linear-gradient(90deg, var(--green-d), var(--green)); }

/* ── Plans ── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.1rem; margin-bottom: 1.5rem; }
.plan-card {
  background: var(--bg2); border: 2px solid var(--border);
  border-radius: 14px; padding: 1.5rem; cursor: pointer;
  transition: all .2s; box-shadow: var(--shadow-sm);
}
.plan-card:hover { border-color: var(--green); transform: translateY(-2px); box-shadow: var(--shadow); }
.plan-card.selected { border-color: var(--green); background: var(--green-ll); }
.plan-card.current { border-color: var(--green-d); }
.plan-price { font-size: 2rem; font-weight: 800; color: var(--green-dk); font-family: 'IBM Plex Mono', monospace; margin: .4rem 0; }
.plan-price span { font-size: .85rem; color: var(--text2); font-weight: 400; }
.plan-features { margin-top: .85rem; display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; color: var(--text2); }
.plan-features li { list-style: none; display: flex; align-items: center; gap: .4rem; }
.plan-features li::before { content: '✓'; color: var(--green); font-weight: 700; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Back / Lang buttons ── */
.back-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); padding: .35rem .75rem;
  border-radius: 7px; font-size: .82rem; cursor: pointer;
  text-decoration: none; transition: all .15s; font-family: inherit;
}
.back-btn:hover { background: var(--bg4); color: var(--text); }
.lang-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); padding: .35rem .75rem;
  border-radius: 7px; font-size: .82rem;
  text-decoration: none; transition: all .15s;
}
.lang-btn:hover { background: var(--bg4); color: var(--text); }

/* ── Logout button ── */
.logout-btn {
  display: flex; align-items: center; gap: .5rem;
  margin-top: .75rem; padding: .45rem .6rem;
  background: #fdecea; border: 1px solid #f5c6cb;
  border-radius: 7px; color: var(--danger);
  text-decoration: none; font-size: .82rem; font-weight: 600; transition: all .15s;
}
.logout-btn:hover { background: var(--danger); color: #fff; }

/* ── Mobile topnav ── */
.mobile-topnav {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: 56px;
  background: var(--green-dk);
  align-items: center; justify-content: space-between;
  padding: 0 1rem;
}
.hamburger { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; gap: 5px; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; transition: all .25s; }
body.drawer-open .hamburger span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
body.drawer-open .hamburger span:nth-child(2) { opacity: 0; }
body.drawer-open .hamburger span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }
.mobile-logo { font-size: 1.1rem; font-weight: 800; color: #fff; }
.mobile-logout { font-size: 1.1rem; text-decoration: none; color: rgba(255,255,255,.8); width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }

/* ── Drawer ── */
.drawer-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; }
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed; top: 0; z-index: 70;
  width: 270px; height: 100vh;
  background: var(--bg2); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
[dir="rtl"] .drawer { left: auto; right: 0; border-inline-end: none; border-inline-start: 1px solid var(--border); transform: translateX(100%); }
.drawer.open { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border-bottom: 1px solid var(--border2); background: var(--green-dk); }
.drawer-user { display: flex; align-items: center; gap: .75rem; }
.drawer-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.drawer-name { font-weight: 700; font-size: .9rem; color: #fff; }
.drawer-plan { font-size: .72rem; color: rgba(255,255,255,.75); margin-top: .1rem; }
.drawer-close { background: rgba(255,255,255,.15); border: none; color: #fff; width: 30px; height: 30px; border-radius: 7px; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.drawer-links { flex: 1; padding: .6rem .6rem 0; display: flex; flex-direction: column; gap: .1rem; }
.drawer-footer { padding: .6rem; border-top: 1px solid var(--border2); display: flex; flex-direction: column; gap: .1rem; }
.drawer-link { display: flex; align-items: center; gap: .7rem; padding: .65rem .85rem; border-radius: 9px; color: var(--text2); text-decoration: none; font-size: .88rem; font-weight: 500; transition: all .12s; }
.drawer-link span { font-size: 1rem; width: 22px; text-align: center; }
.drawer-link:hover { background: var(--bg3); color: var(--text); }
.drawer-link.active { background: var(--green-ll); color: var(--green-dk); font-weight: 600; }
.drawer-link.logout { color: var(--danger); }
.drawer-link.logout:hover { background: #fdecea; }

/* ── Bottom nav ── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--bg2); border-top: 1px solid var(--border);
  height: 60px; align-items: center; justify-content: space-around; padding: 0 .5rem;
}
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: .2rem; text-decoration: none; color: var(--text3); flex: 1; padding: .35rem .2rem; border-radius: 10px; transition: all .15s; }
.bottom-nav-item.active { color: var(--green-dk); }
.bottom-icon { font-size: 1.2rem; transition: transform .15s; }
.bottom-label { font-size: .6rem; font-weight: 600; }
.send-fab { width: 42px; height: 42px; border-radius: 12px; background: var(--green); display: flex; align-items: center; justify-content: center; font-size: 1.15rem; margin-bottom: 4px; }
.bottom-nav-item:has(.send-fab).active .send-fab { background: var(--green-d); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .mobile-topnav { display: flex; }
  .bottom-nav { display: flex; }
  .main { padding-top: 56px; padding-bottom: 60px; }
  .content { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .send-item { flex-wrap: nowrap; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { display: none; }
}
@media (min-width: 769px) {
  .mobile-topnav { display: none; }
  .bottom-nav { display: none; }
  .drawer { display: none; }
  .drawer-overlay { display: none !important; }
}
