/* ── Reset & base ─────────────────────────────────────────────────────────── */

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

:root {
  --color-bg:         #f8f9fa;
  --color-surface:    #ffffff;
  --color-border:     #dee2e6;
  --color-primary:    #4f46e5;
  --color-primary-h:  #4338ca;
  --color-success:    #16a34a;
  --color-danger:     #dc2626;
  --color-text:       #1f2937;
  --color-muted:      #6b7280;
  --radius:           8px;
  --shadow:           0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --max-width:        860px;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

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

ul { list-style: none; }

/* ── Layout shell ─────────────────────────────────────────────────────────── */

.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--color-text);
}

/* ── Nav ──────────────────────────────────────────────────────────────────── */

.nav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
}
.nav-brand a { color: inherit; }

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  font-size: .95rem;
  color: var(--color-muted);
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-primary);
  border-color: var(--color-primary);
  text-decoration: none;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  text-align: center;
  padding: 1rem;
  color: var(--color-muted);
  font-size: .85rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}

.btn-primary  { background: var(--color-primary);  color: #fff; }
.btn-primary:hover { background: var(--color-primary-h); text-decoration: none; }

.btn-secondary { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-bg); text-decoration: none; }

.btn-success  { background: #dcfce7; color: var(--color-success); cursor: default; }
.btn-danger   { background: #fee2e2; color: var(--color-danger); }
.btn-danger:hover { background: #fecaca; }

.btn-disabled { background: var(--color-bg); color: var(--color-muted); border: 1px solid var(--color-border); cursor: not-allowed; }

button:disabled { opacity: .6; cursor: not-allowed; }

/* ── Utility ──────────────────────────────────────────────────────────────── */

.loading { color: var(--color-muted); font-style: italic; }
.error   { color: var(--color-danger); background: #fee2e2; padding: .75rem 1rem; border-radius: var(--radius); }

.back-link { margin-bottom: 1.25rem; }

/* ── Home page ────────────────────────────────────────────────────────────── */

.hero {
  background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.hero-sub {
  color: var(--color-muted);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.card-section h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .85rem;
}

.user-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.user-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  box-shadow: var(--shadow);
}

.user-email   { font-size: .8rem; color: var(--color-primary); }
.user-company { font-size: .8rem; color: var(--color-muted); }

/* ── Posts page ───────────────────────────────────────────────────────────── */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.post-card h3 {
  margin-bottom: .4rem;
  font-size: 1rem;
}

.post-excerpt { color: var(--color-muted); font-size: .9rem; }

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-indicator { color: var(--color-muted); font-size: .9rem; }

/* ── Post detail ──────────────────────────────────────────────────────────── */

.post-detail {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.post-title { font-size: 1.5rem; margin-bottom: 1rem; }
.post-body  { color: var(--color-muted); line-height: 1.8; }

.comments-section h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.comment-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.comment-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .5rem;
}

.comment-email { font-size: .8rem; color: var(--color-primary); }

/* ── Store page ───────────────────────────────────────────────────────────── */

.store-intro {
  color: var(--color-muted);
  margin-bottom: 1.75rem;
}

.store-category { margin-bottom: 2rem; }

.category-heading {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
  margin-bottom: 1rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--color-border);
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.package-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}

.package-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }

.pkg-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
}

.pkg-title { font-size: 1rem; font-weight: 600; flex: 1; }
.pkg-price { font-size: .95rem; font-weight: 700; color: var(--color-primary); white-space: nowrap; }
.pkg-desc  { font-size: .85rem; color: var(--color-muted); flex: 1; }

.pkg-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.pkg-category-tag {
  font-size: .75rem;
  background: #eef2ff;
  color: var(--color-primary);
  padding: .2rem .5rem;
  border-radius: 99px;
}

.store-footer-note {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--color-muted);
}

/* ── Library page ─────────────────────────────────────────────────────────── */

.library-count {
  color: var(--color-muted);
  font-size: .9rem;
  margin-bottom: 1rem;
}

.library-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.library-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.library-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  gap: 1rem;
}

.library-item-header:hover { background: var(--color-bg); }

.library-item-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.library-item-title { font-size: 1rem; font-weight: 600; }

.library-date { font-size: .8rem; color: var(--color-muted); }

.library-item-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

.accordion-arrow { font-size: .75rem; color: var(--color-muted); }

.library-item-body {
  padding: 1.25rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.library-item-body h4 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-muted);
  margin: 1rem 0 .5rem;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.article-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) - 2px);
  padding: .75rem 1rem;
}

.article-item strong {
  display: block;
  margin-bottom: .25rem;
}

.article-item p {
  font-size: .875rem;
  color: var(--color-muted);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
