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

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e2e4e9;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --text: #1a1d23;
  --muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Nav */
nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
}
nav .brand { font-weight: 700; font-size: 1rem; color: var(--text); }
nav .spacer { flex: 1; }
nav a { color: var(--muted); font-size: 0.9rem; }
nav a:hover { color: var(--text); text-decoration: none; }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 32px 20px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header p { color: var(--muted); margin-top: 4px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* Grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Client card */
.client-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.client-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border-color: var(--primary);
  text-decoration: none;
}
.client-card h2 { font-size: 1.1rem; font-weight: 600; }
.client-card p { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* Post list */
.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}
.post-item .platform-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge-blog { background: #ede9fe; color: #5b21b6; }
.badge-instagram { background: #fce7f3; color: #9d174d; }
.badge-facebook { background: #dbeafe; color: #1d4ed8; }
.badge-linkedin { background: #d1fae5; color: #065f46; }

.post-item .post-title { flex: 1; font-weight: 500; }
.post-item .post-date { color: var(--muted); font-size: 0.82rem; }
.post-item .post-status { font-size: 0.78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.status-draft { background: #f3f4f6; color: #374151; }
.status-ready { background: #fef9c3; color: #92400e; }
.status-approved { background: #dcfce7; color: #166534; }
.status-changes_requested { background: #fee2e2; color: #991b1b; }

/* Forms */
.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 500; font-size: 0.88rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date],
select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 120px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }

/* Alert */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

/* Preview modal backdrop */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 12px; max-width: 540px; width: 95%; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 24px; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); }

/* ===== Platform Previews ===== */

/* Blog */
.preview-blog {
  font-family: Georgia, 'Times New Roman', serif;
  max-width: 680px;
  margin: 0 auto;
  padding: 32px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.preview-blog h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 16px; }
.preview-blog .meta { color: #9ca3af; font-size: 0.85rem; margin-bottom: 24px; font-family: sans-serif; }
.preview-blog .body { font-size: 1.05rem; line-height: 1.8; color: #374151; white-space: pre-wrap; }
.preview-blog img { max-width: 100%; border-radius: 6px; margin-bottom: 20px; }

/* Instagram */
.preview-instagram {
  max-width: 400px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #dbdbdb;
  border-radius: 3px;
  font-family: -apple-system, sans-serif;
}
.preview-instagram .ig-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  border-bottom: 1px solid #efefef;
}
.preview-instagram .ig-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}
.preview-instagram .ig-username { font-weight: 600; font-size: 0.88rem; }
.preview-instagram .ig-image { width: 100%; aspect-ratio: 1; object-fit: cover; background: #efefef; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 0.85rem; }
.preview-instagram .ig-image img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.preview-instagram .ig-actions { padding: 12px; display: flex; gap: 16px; font-size: 1.3rem; }
.preview-instagram .ig-caption { padding: 0 12px 12px; font-size: 0.88rem; line-height: 1.5; white-space: pre-wrap; }
.preview-instagram .ig-caption strong { font-weight: 700; }

/* Facebook */
.preview-facebook {
  max-width: 500px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.preview-facebook .fb-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.preview-facebook .fb-avatar { width: 40px; height: 40px; border-radius: 50%; background: #1877f2; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.1rem; }
.preview-facebook .fb-meta strong { display: block; font-size: 0.92rem; }
.preview-facebook .fb-meta span { font-size: 0.78rem; color: #65676b; }
.preview-facebook .fb-body { padding: 0 16px 12px; font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap; }
.preview-facebook .fb-image { width: 100%; max-height: 280px; object-fit: cover; }
.preview-facebook .fb-image img { width: 100%; max-height: 280px; object-fit: cover; }
.preview-facebook .fb-reactions { padding: 8px 16px; color: #65676b; font-size: 0.82rem; border-top: 1px solid #e4e6ea; display: flex; gap: 16px; }

/* LinkedIn */
.preview-linkedin {
  max-width: 540px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}
.preview-linkedin .li-header { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; }
.preview-linkedin .li-avatar { width: 48px; height: 48px; border-radius: 50%; background: #0a66c2; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.2rem; flex-shrink: 0; }
.preview-linkedin .li-meta strong { display: block; font-size: 0.92rem; }
.preview-linkedin .li-meta span { font-size: 0.78rem; color: #666; }
.preview-linkedin .li-body { padding: 0 16px 12px; font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; color: rgba(0,0,0,0.9); }
.preview-linkedin .li-image { width: 100%; max-height: 280px; object-fit: cover; }
.preview-linkedin .li-image img { width: 100%; max-height: 280px; object-fit: cover; }
.preview-linkedin .li-reactions { padding: 8px 16px; font-size: 0.8rem; color: #666; border-top: 1px solid #e0e0e0; display: flex; gap: 16px; }

/* Share link box */
.share-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; padding: 12px 16px; margin-top: 16px; }
.share-box input { font-size: 0.82rem; background: #fff; }

/* Utilities */
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.85rem; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
