/* Prime Axis Buildcon — Dashboard Styles */
:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #333;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #d4a843;
  --accent-hover: #e0b84f;
  --success: #4caf82;
  --warning: #f0a04a;
  --error: #e05050;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

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

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

header h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

nav { display: flex; align-items: center; gap: 16px; }
nav a { color: var(--text-muted); text-decoration: none; font-size: 13px; }
nav a:hover { color: var(--text); }

/* ── Buttons ─────────────────────────────────────────────────────── */
button, .btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  transition: opacity 0.15s;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--error); color: #fff; }

/* ── Main layout ─────────────────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.week-header h2 { font-size: 20px; font-weight: 600; }
.week-actions { display: flex; gap: 10px; }

/* ── Posts grid ──────────────────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s;
}

.post-card:hover { border-color: var(--accent); }

.post-card.status-approved { border-left: 3px solid var(--success); }
.post-card.status-ready { border-left: 3px solid var(--accent); }
.post-card.status-failed { border-left: 3px solid var(--error); }
.post-card.status-pending { border-left: 3px solid var(--border); }

.post-date { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.post-day { font-weight: 700; font-size: 13px; }
.post-pillar {
  display: inline-block;
  background: var(--surface2);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.post-topic { font-size: 13px; font-weight: 500; line-height: 1.4; }
.post-format { font-size: 11px; color: var(--text-muted); }

.post-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
  width: fit-content;
}
.post-status.ready { background: rgba(212,168,67,0.15); color: var(--accent); }
.post-status.approved { background: rgba(76,175,130,0.15); color: var(--success); }
.post-status.failed { background: rgba(224,80,80,0.15); color: var(--error); }
.post-status.pending { background: var(--surface2); color: var(--text-muted); }
.post-status.published { background: rgba(76,175,130,0.1); color: var(--success); }

.post-warnings {
  font-size: 12px;
  color: var(--warning);
  background: rgba(240,160,74,0.1);
  border-radius: 4px;
  padding: 6px 10px;
}

.post-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.post-actions button { font-size: 12px; padding: 6px 12px; }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 900px;
  width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
}

.modal-small { max-width: 380px; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface2);
  border: none;
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Preview views ───────────────────────────────────────────────── */
.preview-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  overflow-x: auto;
}

.preview-tab {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid transparent;
  white-space: nowrap;
}

.preview-tab.active {
  background: var(--accent);
  color: #000;
  font-weight: 600;
}

.preview-frame {
  background: var(--surface2);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Instagram square frame */
.frame-instagram { width: 360px; height: 360px; margin: 0 auto; }
/* Stories 9:16 frame */
.frame-stories { width: 202px; height: 360px; margin: 0 auto; }
/* Facebook wider frame */
.frame-facebook { width: 100%; max-width: 520px; height: auto; margin: 0 auto; }

/* ── Slide cards in preview ──────────────────────────────────────── */
.slide-strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.slide-mini {
  min-width: 120px;
  height: 120px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.slide-mini.active { border-color: var(--accent); }
.slide-mini .slide-num { color: var(--text-muted); font-size: 10px; }
.slide-mini .slide-head { font-weight: 600; line-height: 1.3; }
.slide-mini .slide-body { color: var(--text-muted); }

/* ── Caption block ───────────────────────────────────────────────── */
.caption-block {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 160px;
  overflow-y: auto;
  margin-top: 12px;
}

/* ── Password modal input ────────────────────────────────────────── */
.modal-small h3 { margin-bottom: 14px; font-size: 15px; }
.modal-small input[type="password"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}
.modal-small input:focus { outline: none; border-color: var(--accent); }
.modal-buttons { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Login page ──────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.login-box h1 { font-size: 22px; color: var(--accent); }
.login-box h2 { font-size: 15px; color: var(--text-muted); font-weight: 400; }

.login-box input[type="password"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
}

.login-box input:focus { outline: none; border-color: var(--accent); }

.login-box button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 14px;
}

.error { color: var(--error); font-size: 13px; }

/* ── Upload area ─────────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--accent); color: var(--text); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  main { padding: 16px; }
  .posts-grid { grid-template-columns: 1fr; }
  .week-header { flex-direction: column; align-items: flex-start; }
  .frame-instagram { width: 100%; height: auto; aspect-ratio: 1; }
}
