@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap");

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

:root {
  --bg: #fefaf1;
  --surface: #ffffff;
  --surface-2: #f5f0e8;
  --border: #e8e0d0;
  --text: #00002d;
  --text-muted: #6b6b8a;
  --accent: #d31900;
  --accent-dim: rgba(211, 25, 0, 0.08);
  --accent-hover: #b51500;
  --neutral: #bfb1a2;
  --neutral-dim: rgba(191, 177, 162, 0.2);
  --success: #2e7d52;
  --sidebar-w: 230px;
}

body {
  font-family:
    "Open Sans",
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 28px 24px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-text {
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--neutral);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.logo-subtitle {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
  margin-top: 3px;
}

.nav-links {
  list-style: none;
  padding: 16px 0;
  flex: 1;
}

.nav-links li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  border-radius: 6px;
  margin: 2px 10px;
  font-size: 13px;
  transition: all 0.15s;
}

.nav-links li a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-links li a.active {
  background: var(--accent);
  color: #fff;
}

.nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-user {
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
}
.logout-link {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  font-size: 12px;
}
.logout-link:hover {
  color: var(--accent);
}

/* Content */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px;
  max-width: 1280px;
}

.content.full-width {
  margin-left: 0;
}

/* Page header */
.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-family: "Poppins", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
  display: block;
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 1px 4px rgba(0, 0, 44, 0.05);
}

.card-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.card-value {
  font-family: "Poppins", sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
}

.card-value--accent {
  color: var(--accent);
}
.card-value--small {
  font-size: 14px;
  padding-top: 4px;
  font-weight: 600;
}

/* Sections */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 44, 0.04);
}

.section-title {
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
}

.section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  margin-top: -12px;
}

/* Profile */
.profile-block {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.profile-pic {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--neutral);
}

.profile-name {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}
.profile-bio {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
.profile-link {
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
  margin-top: 5px;
  display: inline-block;
}

/* Charts */
.chart-container {
  position: relative;
  height: 180px;
}
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.charts-row .chart-container {
  height: 160px;
}

/* Top posts */
.top-posts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top-post-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.top-post-rank {
  font-family: "Poppins", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--neutral);
  width: 28px;
  text-align: center;
}

.top-post-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.top-post-info {
  flex: 1;
  min-width: 0;
}
.top-post-caption {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-post-date {
  font-size: 11px;
  color: var(--neutral);
  margin-bottom: 3px;
}

.top-post-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  flex-shrink: 0;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 42px;
}

.stat-chip-label {
  font-size: 10px;
  color: var(--text-muted);
}
.stat-chip-value {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.stat-chip-value--accent {
  color: var(--accent);
}

/* Channels */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.channel-card {
  border-radius: 10px;
  padding: 18px;
  border: 1px solid var(--border);
}

.channel-active {
  background: var(--surface-2);
  border-color: var(--neutral);
}
.channel-planned {
  background: var(--bg);
  border-style: dashed;
}

.channel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.channel-name {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.channel-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 20px;
}
.channel-active .channel-badge {
  background: var(--accent-dim);
  color: var(--accent);
}
.channel-planned .channel-badge {
  background: var(--neutral-dim);
  color: var(--neutral);
}

.channel-role {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.channel-metric {
  font-family: "Poppins", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.channel-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}
.channel-coming {
  font-size: 11px;
  color: var(--neutral);
  font-style: italic;
}

/* Media grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 44, 0.04);
}

.media-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}
.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-type {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 44, 0.75);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.media-info {
  padding: 14px;
}
.media-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
  line-height: 1.4;
}
.media-date {
  font-size: 11px;
  color: var(--neutral);
  margin-bottom: 12px;
}

.media-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.media-stats span {
  white-space: nowrap;
}

.media-engagement {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--accent-dim);
  border-radius: 8px;
  margin-bottom: 10px;
}

.engagement-label {
  font-size: 11px;
  color: var(--accent);
  flex: 1;
}
.engagement-value {
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}
.engagement-rate {
  font-size: 11px;
  color: var(--accent);
  opacity: 0.7;
}

/* Insights accordion */
.media-insights {
  margin-bottom: 10px;
}

.media-insights summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  user-select: none;
}

.media-insights summary::-webkit-details-marker {
  display: none;
}
.media-insights summary::before {
  content: "+ ";
  color: var(--accent);
}
.media-insights[open] summary::before {
  content: "- ";
}

.insights-body {
  padding: 10px 0 4px;
}

.insights-rates {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.insights-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.insights-tips li {
  font-size: 12px;
  color: var(--text);
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}

.insights-tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

.media-link {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
}
.media-link:hover {
  color: var(--accent);
}

/* Load more */
.load-more-wrap {
  text-align: center;
  margin-top: 24px;
}

.btn-load-more {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-muted);
  padding: 10px 28px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-load-more:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-load-more:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Stories */
.stories-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.story-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 160px;
}

.story-meta {
  font-size: 11px;
  color: var(--neutral);
  margin-bottom: 8px;
}
.story-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Alert */
.alert {
  background: var(--accent-dim);
  border: 1px solid rgba(211, 25, 0, 0.2);
  color: var(--accent);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  font-family: "Open Sans", sans-serif;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.form-error {
  background: rgba(211, 25, 0, 0.08);
  border: 1px solid rgba(211, 25, 0, 0.2);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-container {
  width: 100%;
  max-width: 380px;
  padding: 44px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 44, 0.08);
}

.login-logo {
  font-family: "Poppins", sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 2px;
}

.login-title {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
  font-weight: 400;
}

.login-form {
  display: flex;
  flex-direction: column;
}

/* Roles table */
.roles-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.role-row {
  display: flex;
  gap: 16px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
  align-items: flex-start;
}

.role-name {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  color: var(--accent);
  min-width: 90px;
  font-size: 13px;
}
.role-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.config-form {
  max-width: 420px;
}

/* Responsive */
@media (max-width: 900px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .content {
    margin-left: 0;
    padding: 20px 16px;
  }
  .cards-grid {
    grid-template-columns: 1fr 1fr;
  }
  .media-grid {
    grid-template-columns: 1fr;
  }
  .top-post-stats {
    display: none;
  }
}
