/* style.css — All styles for the DFY Marketing Client Portal */

/* ── FONTS ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── DESIGN TOKENS ──────────────────────────────────── */
:root {
  --bg:        #0f0f11;
  --surface:   #18181c;
  --surface2:  #222228;
  --border:    #2e2e38;
  --text:      #f0eff4;
  --text-muted:#8a8998;
  --accent:    #c8a96e;       /* warm gold */
  --accent-dim:#7a6540;
  --green:     #4caf7d;
  --red:       #e05c5c;
  --amber:     #e8a838;
  --blue:      #5b8dee;

  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

/* ── RESET ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── BRAND MARK ─────────────────────────────────────── */
.brand-mark {
  font-family: 'DM Serif Display', serif;
  font-size: 2.4rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.brand-mark.small {
  font-size: 1.4rem;
}

.brand-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
  letter-spacing: 0.04em;
}

/* ── HEADER ─────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.welcome-name {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-badge {
  background: var(--accent);
  color: #0f0f11;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── LOGIN PAGE ─────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(200,169,110,0.06) 0%, transparent 70%);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-brand {
  text-align: center;
  margin-bottom: 40px;
}

.login-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}

.login-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.8rem;
  font-weight: 400;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

/* ── FORM FIELDS ────────────────────────────────────── */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  padding: 10px 14px;
  transition: border-color 0.2s;
  outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
}

.field textarea {
  resize: vertical;
  line-height: 1.5;
}

.field select option {
  background: var(--surface2);
}

/* ── BUTTONS ────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0f0f11;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover { background: var(--border); }

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-logout:hover { border-color: var(--text-muted); color: var(--text); }

.btn-approve {
  background: rgba(76, 175, 125, 0.15);
  color: var(--green);
  border: 1px solid rgba(76, 175, 125, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-approve:hover { background: rgba(76, 175, 125, 0.25); }

.btn-changes {
  background: rgba(232, 168, 56, 0.12);
  color: var(--amber);
  border: 1px solid rgba(232, 168, 56, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-changes:hover { background: rgba(232, 168, 56, 0.22); }

.btn-edit {
  background: rgba(91, 141, 238, 0.12);
  color: var(--blue);
  border: 1px solid rgba(91, 141, 238, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-edit:hover { background: rgba(91, 141, 238, 0.22); }

.btn-delete {
  background: rgba(224, 92, 92, 0.1);
  color: var(--red);
  border: 1px solid rgba(224, 92, 92, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-delete:hover { background: rgba(224, 92, 92, 0.2); }

/* ── ERROR MESSAGE ───────────────────────────────────── */
.error-msg {
  color: var(--red);
  font-size: 0.875rem;
  margin-bottom: 12px;
  min-height: 20px;
}

/* ── MAIN CONTENT ────────────────────────────────────── */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── SUMMARY BAR ─────────────────────────────────────── */
.summary-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.summary-item {
  flex: 1;
  min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
}

.summary-number {
  display: block;
  font-size: 2rem;
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
  color: var(--text);
}

.summary-number.pending { color: var(--amber); }
.summary-number.approved { color: var(--green); }
.summary-number.changes { color: var(--red); }

.summary-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── POST CARDS ──────────────────────────────────────── */
.posts-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s;
}

.post-card.status-changes_requested {
  border-color: rgba(232, 168, 56, 0.35);
}

.post-card.status-approved {
  border-color: rgba(76, 175, 125, 0.25);
  opacity: 0.75;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.post-platform {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.post-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.post-caption {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.post-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.approved-note {
  font-size: 0.875rem;
  color: var(--green);
  font-weight: 500;
}

.change-notes-display {
  background: rgba(232, 168, 56, 0.08);
  border: 1px solid rgba(232, 168, 56, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--amber);
  margin-bottom: 14px;
}

/* ── STATUS BADGES ───────────────────────────────────── */
.post-status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge-pending {
  background: rgba(232, 168, 56, 0.15);
  color: var(--amber);
}

.status-badge-approved {
  background: rgba(76, 175, 125, 0.15);
  color: var(--green);
}

.status-badge-changes_requested {
  background: rgba(224, 92, 92, 0.12);
  color: var(--red);
}

/* ── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
}

.modal h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.modal textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  padding: 12px 14px;
  resize: vertical;
  margin-bottom: 20px;
  outline: none;
}

.modal textarea:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-actions .btn-primary { width: auto; }

/* ── ADMIN LAYOUT ────────────────────────────────────── */
.admin-main {
  max-width: 1200px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding-top: 32px;
}

.client-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  height: fit-content;
  position: sticky;
  top: 76px;
}

.client-sidebar h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  font-weight: 400;
  margin-bottom: 16px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.client-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
}

.client-item:hover { background: var(--surface2); }
.client-item.active { background: rgba(200, 169, 110, 0.1); border: 1px solid rgba(200,169,110,0.2); }

.client-name {
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.client-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
}

.stat.pending { background: rgba(232,168,56,0.12); color: var(--amber); }
.stat.changes { background: rgba(224,92,92,0.1); color: var(--red); }
.stat.approved { background: rgba(76,175,125,0.12); color: var(--green); }

.client-posts-section {
  min-width: 0; /* prevents overflow */
}

.client-posts-header {
  margin-bottom: 20px;
}

.client-posts-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  font-weight: 400;
}

.select-prompt {
  color: var(--text-muted);
  font-style: italic;
}

.add-post-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.add-post-form h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.add-post-form .btn-primary { width: auto; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.hidden { display: none !important; }

/* ── STATES ──────────────────────────────────────────── */
.loading, .empty-state {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 32px;
  text-align: center;
}

.error {
  color: var(--red);
  font-size: 0.9rem;
  padding: 20px;
  text-align: center;
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-main {
    grid-template-columns: 1fr;
  }

  .client-sidebar {
    position: static;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .summary-bar {
    grid-template-columns: 1fr 1fr;
  }
}
