/* assets/css/app.css — Marketing Engine UI */
:root {
  --c-bg:       #f8f7f4;
  --c-surface:  #ffffff;
  --c-border:   #e8e6e1;
  --c-text:     #1a1a18;
  --c-muted:    #6b6b65;
  --c-primary:  #5B3FD4;
  --c-primary-h:#4832b8;
  --c-success:  #1a8a5a;
  --c-danger:   #c93535;
  --c-warning:  #b87a0a;
  --c-accent:   #f0edff;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 8px rgba(0,0,0,.04);
  --font:       'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--c-text);
  background: var(--c-bg);
  direction: rtl;
  min-height: 100vh;
}

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

.sidebar {
  width: 230px;
  background: var(--c-surface);
  border-left: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--c-primary);
  border-bottom: 1px solid var(--c-border);
  letter-spacing: -.3px;
}

.sidebar-logo span { color: var(--c-muted); font-weight: 400; }

.sidebar-nav { padding: 10px 0; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--c-muted);
  text-decoration: none;
  font-size: 14px;
  border-radius: 0;
  transition: background .15s, color .15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
}
.nav-item:hover { background: var(--c-bg); color: var(--c-text); }
.nav-item.active { color: var(--c-primary); background: var(--c-accent); font-weight: 500; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--c-border);
  font-size: 12px;
  color: var(--c-muted);
}

.main { flex: 1; overflow-x: hidden; }

.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 15px; font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--c-muted); }

.page { padding: 28px; max-width: 1100px; }

/* ── Cards ── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--c-text);
}

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-value { font-size: 28px; font-weight: 600; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--c-muted); }
.stat-card.purple .stat-value { color: var(--c-primary); }
.stat-card.green  .stat-value { color: var(--c-success); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: 7px;
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color .15s;
  font-family: var(--font);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(91,63,212,.1);
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-hint { font-size: 12px; color: var(--c-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-h); }
.btn-success  { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #157a4f; }
.btn-outline  { background: transparent; border: 1px solid var(--c-border); color: var(--c-text); }
.btn-outline:hover { background: var(--c-bg); }
.btn-danger   { background: var(--c-danger); color: #fff; }
.btn-sm       { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Keyword chips ── */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.chip {
  padding: 5px 12px;
  background: var(--c-accent);
  color: var(--c-primary);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color .15s;
}
.chip:hover { border-color: var(--c-primary); }

/* ── Article preview ── */
.preview-box {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 28px 32px;
  background: var(--c-surface);
  line-height: 1.75;
  direction: rtl;
}
.preview-box h1 { font-size: 24px; margin-bottom: 12px; }
.preview-box h2 { font-size: 18px; margin: 22px 0 8px; }
.preview-box h3 { font-size: 15px; margin: 16px 0 6px; }
.preview-box p  { margin-bottom: 12px; color: #2a2a28; }
.preview-box ul, .preview-box ol { margin: 8px 0 12px 0; padding-right: 20px; }
.preview-box li { margin-bottom: 4px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: right;
  padding: 10px 14px;
  border-bottom: 2px solid var(--c-border);
  font-weight: 500;
  color: var(--c-muted);
  font-size: 13px;
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--c-bg); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-green   { background: #e4f5ec; color: #157a4f; }
.badge-gray    { background: #f0efeb; color: #5f5e5a; }
.badge-red     { background: #fceaea; color: #a32d2d; }
.badge-purple  { background: var(--c-accent); color: var(--c-primary); }

/* ── Alert ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-error   { background: #fceaea; color: #a32d2d; border: 1px solid #f7c1c1; }
.alert-success { background: #e4f5ec; color: #157a4f; border: 1px solid #b0dfc3; }
.alert-info    { background: #e6f1fb; color: #185fa5; border: 1px solid #b5d4f4; }

/* ── Loading spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid #ddd;
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Usage bar ── */
.usage-bar { background: var(--c-border); border-radius: 4px; height: 6px; overflow: hidden; }
.usage-fill { height: 100%; border-radius: 4px; background: var(--c-primary); transition: width .4s; }
.usage-fill.warn { background: var(--c-warning); }
.usage-fill.danger { background: var(--c-danger); }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--c-border); margin-bottom: 22px; }
.tab {
  padding: 10px 18px;
  font-size: 14px;
  color: var(--c-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
  transition: color .15s;
}
.tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 500; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .page { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Login page ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
  padding: 20px;
}
.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.auth-logo {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: 6px;
}
.auth-sub {
  text-align: center;
  font-size: 13px;
  color: var(--c-muted);
  margin-bottom: 28px;
}
