/* PostNimble App — single stylesheet */

:root {
  /* Brand — maps to existing variable names so no template changes needed */
  --green:       #7C3AED;   /* primary purple  */
  --green-light: #EDE9FE;   /* light purple    */
  --green-mid:   #6D28D9;   /* deep purple     */
  --emerald:     #10B981;   /* accent emerald  */
  --emerald-lt:  #D1FAE5;

  /* Surface */
  --bg:          #F5F3FF;   /* soft lavender page background */
  --white:       #ffffff;
  --text:        #111827;
  --muted:       #6B7280;
  --border:      #DDD6FE;   /* purple-tinted border */

  /* Status / functional */
  --red:         #DC2626;
  --amber:       #D97706;
  --blue:        #2563EB;

  --radius:      8px;
  --shadow:      0 1px 4px rgba(124,58,237,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Nav ──────────────────────────────────────────────────────────────────── */
nav {
  background: #0C0A1A;
  color: white;
  padding: 0 16px;
  display: flex;
  align-items: center;
  min-height: 56px;
  gap: 16px;
  border-bottom: 1px solid rgba(124,58,237,0.2);
  flex-wrap: wrap;
}
nav a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 14px; }
nav a:hover { color: white; }
nav .spacer { flex: 1; min-width: 8px; }

/* Mobile nav — stack on narrow screens */
@media (max-width: 600px) {
  nav { gap: 10px; padding: 8px 12px; }
  nav .logo-wordmark { max-width: 120px; font-size: 14px; }
  nav > a { font-size: 13px; }
}

/* ── Logo / client switcher ── */
.logo-switcher { position: relative; }

.logo-btn {
  background: rgba(124,58,237,0.12);
  border: 1px solid rgba(124,58,237,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.logo-btn:hover, .logo-switcher.open .logo-btn { background: rgba(124,58,237,0.22); }

.logo-wordmark {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.2px;
  color: #fff;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logo-sub {
  color: rgba(255,255,255,0.45);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1;
  align-self: flex-end;
  margin-bottom: 1px;
}
.logo-caret {
  color: rgba(255,255,255,0.4);
  font-size: 10px;
}

.logo-dropdown {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(124,58,237,0.15);
  min-width: 220px;
  z-index: 999;
  overflow: hidden;
}
.logo-switcher.open .logo-dropdown { display: block; }

.logo-dd-item {
  width: 100%;
  text-align: left;
  padding: 10px 14px 10px 10px;
  font-size: 13px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.1s;
}
.logo-dd-item:hover { background: var(--green-light); }
.logo-dd-active { background: var(--green-light) !important; font-weight: 600; }
.logo-dd-check { width: 14px; font-size: 12px; color: var(--green); flex-shrink: 0; }
.logo-dd-section { border-top: 1px solid var(--border); }

/* ── Page layout ──────────────────────────────────────────────────────────── */
.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }

/* ── Flash messages ───────────────────────────────────────────────────────── */
.flash { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 16px;
         font-size: 14px; border: 1px solid transparent; }
.flash.success { background: var(--green-light); border-color: #C4B5FD; color: var(--green-mid); }
.flash.error   { background: #FEE2E2; border-color: #FCA5A5; color: var(--red); }
.flash.info    { background: #DBEAFE; border-color: #93C5FD; color: var(--blue); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--green); }
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--muted);
           text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
input[type="text"], input[type="url"], input[type="datetime-local"],
textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
textarea { resize: vertical; }

.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, background 0.15s, transform 0.1s;
}
.btn:hover { opacity: 0.88; }
.btn-primary  { background: var(--green); color: white; box-shadow: 0 2px 8px rgba(124,58,237,0.3); }
.btn-primary:hover { opacity: 1; background: var(--green-mid); transform: translateY(-1px); }
.btn-outline  { background: white; color: var(--green); border: 1px solid var(--green); }
.btn-danger   { background: var(--red); color: white; }
.btn-amber    { background: var(--amber); color: white; }
.btn-sm { padding: 6px 13px; font-size: 13px; }

/* ── Status badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-running         { background: #FEF3C7; color: #92400E; }
.badge-awaiting_review { background: #FFEDD5; color: #9A3412; }
.badge-completed       { background: var(--emerald-lt); color: #065F46; }
.badge-failed          { background: #FEE2E2; color: var(--red); }

/* ── Run table ────────────────────────────────────────────────────────────── */
.run-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.run-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid var(--border);
}
.run-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.run-table tr:last-child td { border-bottom: none; }
.run-table tr:hover td { background: var(--green-light); }
.run-table a { color: var(--green); text-decoration: none; font-weight: 500; }
.run-table a:hover { text-decoration: underline; }
.brief-snippet { color: var(--muted); font-size: 13px; max-width: 380px;
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Timeline ─────────────────────────────────────────────────────────────── */
.timeline { list-style: none; position: relative; padding-left: 0; }
.timeline::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline li {
  position: relative;
  padding: 6px 0 6px 44px;
  font-size: 14px;
}
.timeline .dot {
  position: absolute;
  left: 8px;
  top: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
}
.timeline .dot.done    { background: var(--emerald);  border-color: var(--emerald); }
.timeline .dot.active  { background: var(--green);    border-color: var(--green);
                         box-shadow: 0 0 0 3px rgba(124,58,237,0.2); }
.timeline .dot.failed  { background: var(--red);      border-color: var(--red); }
.timeline .dot.review  { background: #F97316;         border-color: #F97316; }
.stage-label { font-weight: 500; }
.stage-sub   { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ── Run detail layout ────────────────────────────────────────────────────── */
.run-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
@media (max-width: 720px) { .run-layout { grid-template-columns: 1fr; } }

/* ── Review layout ────────────────────────────────────────────────────────── */
.review-layout { display: grid; grid-template-columns: 2fr 3fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .review-layout { grid-template-columns: 1fr; } }

.issue-list { list-style: none; font-size: 13px; }
.issue-list li {
  padding: 6px 10px;
  border-radius: 5px;
  margin-bottom: 5px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.issue-blocking   { background: #FEE2E2; }
.issue-warning    { background: #FEF3C7; }
.issue-suggestion { background: var(--green-light); }
.issue-icon { flex-shrink: 0; margin-top: 1px; }

.qa-score-ring {
  font-size: 42px;
  font-weight: 700;
  text-align: center;
  padding: 16px 0 8px;
}
.qa-score-ring.pass { color: var(--emerald); }
.qa-score-ring.fail { color: var(--red); }

/* ── Schedule / platform cards ────────────────────────────────────────────── */
.platform-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .platform-grid { grid-template-columns: 1fr; } }

.platform-card { border: 1px solid var(--border); border-radius: var(--radius);
                 background: white; overflow: hidden; }
.platform-card .platform-header {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.platform-card .platform-body { padding: 14px 16px; }
.platform-header.facebook  { background: #E7F0FD; color: #1877F2; }
.platform-header.instagram { background: #FDF0F8; color: #C13584; }
.platform-header.linkedin  { background: #E8F4FB; color: #0A66C2; }

.platform-image-preview {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--border);
}
.platform-image-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }

/* ── Misc helpers ─────────────────────────────────────────────────────────── */
.page-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 20px; }
.section-header { display: flex; align-items: center; justify-content: space-between;
                  margin-bottom: 16px; }
.text-muted  { color: var(--muted); font-size: 13px; }
.text-green  { color: var(--green); }
.mt-16 { margin-top: 16px; }
.mt-8  { margin-top: 8px; }
.gap-8 { display: flex; gap: 8px; flex-wrap: wrap; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(124,58,237,0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

details summary { cursor: pointer; font-weight: 600; font-size: 14px;
                  color: var(--green); padding: 6px 0; user-select: none; }
details summary:hover { opacity: 0.8; }
details[open] summary { margin-bottom: 14px; }

.url-fields { display: flex; flex-direction: column; gap: 8px; }

/* ── Mobile responsiveness ────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page         { padding: 16px 12px 48px; }
  .card         { padding: 16px; }
  .page-title   { font-size: 18px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .run-layout   { grid-template-columns: 1fr; }
  .platform-grid { grid-template-columns: 1fr; }
  .form-grid    { grid-template-columns: 1fr; }
  .btn          { font-size: 13px; padding: 8px 14px; }
  .run-table    { font-size: 13px; }
  .run-table th, .run-table td { padding: 8px 6px; }
  /* Hide less important columns on small screens */
  .run-table .col-hide-mobile { display: none; }
}
