/* ─────────────────────────────────────────────
   Jule's Engage — Shared Stylesheet
   Loaded by all authenticated pages.
───────────────────────────────────────────── */

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

/* ── DESIGN TOKENS ── */
:root {
  /* Backgrounds */
  --bg:      #0f0f0f;
  --card:    #1a1a1a;
  --surface: #242424;

  /* Brand accents */
  --red:     #e63946;
  --amber:   #f4a261;

  /* Text */
  --text:    #f1f1f1;
  --muted:   #9a9a9a;

  /* Structural */
  --border:  #2e2e2e;

  /* Semantic */
  --success:     #2a9d8f;
  --destructive: #e63946;

  /* Social */
  --fb: #1877f2;
  --ig: #c13584;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --content-max: 960px;
  --header-h:    56px;
  --app-nav-h:   53px;
}

/* ── BASE ── */
html {
  font-size: 16px;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
}

a { color: inherit; }

/* ── HEADER ── */
.site-header {
  position: sticky;
  top: var(--app-nav-h);
  z-index: 100;
  background: rgba(15, 15, 15, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 16px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: -0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-subtitle {
  font-size: 13px;
  color: var(--muted);
  display: none;
  flex-shrink: 0;
}

@media (min-width: 600px) {
  .header-subtitle { display: inline; }
}

.nav-links {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.nav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── MODE BADGE ── */
.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mode-review {
  background: rgba(244, 162, 97, 0.12);
  color: var(--amber);
  border: 1px solid rgba(244, 162, 97, 0.28);
}

.mode-auto {
  background: rgba(42, 157, 143, 0.12);
  color: var(--success);
  border: 1px solid rgba(42, 157, 143, 0.28);
}

/* ── SIGN OUT BUTTON ── */
.btn-logout {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  padding: 6px 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.btn-logout:hover { color: var(--text); }

/* ── CONTENT WRAPPER ── */
.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 20px 16px 60px;
}

@media (min-width: 768px) {
  .content { padding: 28px 24px 80px; }
}

/* ── STATS BAR ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
  width: 100%;
}

@media (min-width: 768px) {
  .stats-bar { gap: 14px; margin-bottom: 24px; }
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  min-width: 0;
}

@media (min-width: 768px) {
  .stat { padding: 20px 24px; }
}

.stat-number {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 360px) { .stat-number { font-size: 24px; } }
@media (min-width: 480px) { .stat-number { font-size: 30px; } }
@media (min-width: 768px) { .stat-number { font-size: 36px; } }

.stat-label {
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 480px) { .stat-label { font-size: 11px; } }
@media (min-width: 768px) { .stat-label { font-size: 12px; letter-spacing: 0.07em; } }

/* ── TABS ── */
.tabs-wrapper {
  position: sticky;
  top: calc(var(--app-nav-h) + var(--header-h));
  z-index: 90;
  background: var(--bg);
  padding: 12px 0;
  margin-bottom: 4px;
  width: 100%;
}

.tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  width: 100%;
}

.tab {
  padding: 10px 16px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  transition: background 0.18s, color 0.18s;
  min-height: 40px;
  letter-spacing: 0.01em;
  min-width: 0;
}

.tab:hover:not(.active) { color: var(--text); background: var(--surface); }

.tab.active {
  background: var(--red);
  color: #fff;
}

/* ── PANELS (tab-switched content regions) ── */
.panel { display: none; }
.panel.active { display: block; }

/* ── CARD ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}

.card:hover { border-color: #3a3a3a; }

@media (min-width: 768px) {
  .card { padding: 24px; margin-bottom: 16px; }
}

/* ── META ROW ── */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 12px;
}

.commenter {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}

.timestamp {
  font-size: 12px;
  color: var(--muted);
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Category badges */
.POSITIVE {
  background: rgba(42, 157, 143, 0.14);
  color: #4ecdc4;
  border: 1px solid rgba(42, 157, 143, 0.28);
}
.QUESTION {
  background: rgba(24, 119, 242, 0.14);
  color: #69a8f7;
  border: 1px solid rgba(24, 119, 242, 0.28);
}
.COMPLAINT {
  background: rgba(230, 57, 70, 0.14);
  color: #f07880;
  border: 1px solid rgba(230, 57, 70, 0.28);
}

/* Source badges */
.source-facebook {
  background: rgba(24, 119, 242, 0.14);
  color: #69a8f7;
  border: 1px solid rgba(24, 119, 242, 0.28);
}
.source-instagram {
  background: rgba(193, 53, 132, 0.14);
  color: #e06db5;
  border: 1px solid rgba(193, 53, 132, 0.28);
}
.source-unknown {
  background: rgba(154, 154, 154, 0.1);
  color: var(--muted);
  border: 1px solid var(--border);
}

.edited-badge {
  background: rgba(244, 162, 97, 0.14);
  color: var(--amber);
  border: 1px solid rgba(244, 162, 97, 0.28);
}

/* ── QUOTED TEXT BLOCK ── */
.comment-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 8px;
  border-left: 3px solid var(--border);
  margin-bottom: 14px;
}

/* ── REPLY SECTION ── */
.reply-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.reply-display {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  padding: 12px 14px;
  background: rgba(230, 57, 70, 0.05);
  border: 1px solid rgba(230, 57, 70, 0.14);
  border-radius: 8px;
  margin-bottom: 14px;
  white-space: pre-wrap;
}

/* ── FORM ELEMENTS ── */
textarea,
input[type="text"],
input[type="email"],
select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.6;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

textarea {
  resize: vertical;
  margin-bottom: 14px;
}

textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.14);
}

/* ── ORIGINAL REPLY (diff view in examples) ── */
.original-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.original-reply {
  font-size: 13px;
  color: var(--muted);
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 8px;
  border-left: 3px solid rgba(244, 162, 97, 0.4);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ── ACTIONS ROW ── */
.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

@media (min-width: 768px) {
  .actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  transition: opacity 0.15s, background 0.15s, transform 0.1s, color 0.15s;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.btn:active { transform: scale(0.98); }

@media (min-width: 768px) {
  .btn { width: auto; min-height: 40px; }
}

.btn-approve {
  background: var(--success);
  color: #fff;
}
.btn-approve:hover:not(:disabled) { opacity: 0.88; }
.btn-approve:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-edit {
  background: rgba(244, 162, 97, 0.12);
  color: var(--amber);
  border: 1px solid rgba(244, 162, 97, 0.28);
}
.btn-edit:hover { background: rgba(244, 162, 97, 0.22); }

.btn-save {
  background: var(--red);
  color: #fff;
}
.btn-save:hover { opacity: 0.88; }

.btn-reject {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-reject:hover:not(:disabled) { color: var(--text); border-color: #444; }
.btn-reject:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--red);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-destructive {
  background: rgba(230, 57, 70, 0.14);
  color: #f07880;
  border: 1px solid rgba(230, 57, 70, 0.28);
}
.btn-destructive:hover:not(:disabled) { background: rgba(230, 57, 70, 0.24); }

.btn-muted {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-muted:hover:not(:disabled) { color: var(--text); border-color: #444; }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover:not(:disabled) { opacity: 0.88; }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 20px 0 8px;
}

.pagination-info {
  font-size: 13px;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-page {
  padding: 8px 18px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.btn-page:hover:not(:disabled) { background: var(--surface); border-color: #3a3a3a; }
.btn-page:disabled { color: var(--muted); cursor: not-allowed; opacity: 0.45; }

.page-indicator {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ── EMPTY STATE ── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* ── BANNER (success / error feedback) ── */
.banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.banner-success {
  background: rgba(42, 157, 143, 0.14);
  color: var(--success);
  border: 1px solid rgba(42, 157, 143, 0.28);
}

.banner-error {
  background: rgba(230, 57, 70, 0.14);
  color: #f07880;
  border: 1px solid rgba(230, 57, 70, 0.28);
}

/* ── FORM GROUP ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─────────────────────────────────────────────
   MOBILE RESPONSIVE — max-width: 767px
   All changes here are additive fixes scoped to
   mobile. Desktop layout is unchanged above.
───────────────────────────────────────────── */
@media (max-width: 767px) {

  /* ── HEADER: two-row layout ──
     Row 1 (48px): brand | sign-out
     Row 2 (40px): nav links, full width
     Total: 88px → tabs-wrapper top override below */
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0 16px;
    gap: 0;
    align-items: stretch;
  }

  .brand {
    flex: 1;
    display: flex;
    align-items: center;
    height: 48px;
    font-size: 17px;
    padding: 0;
  }

  /* header-subtitle is already display:none below 600px */

  .header-right {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0;
    gap: 0;
  }

  /* Hide mode badge in the header on mobile — keeps DOM node
     accessible to JS but avoids crowding the single header row */
  .mode-badge {
    display: none;
  }

  /* Nav wraps to its own full-width row below brand */
  .nav-links {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    margin-left: 0;
    gap: 0;
    padding: 0;
    border-top: 1px solid var(--border);
    height: 40px;
    align-items: stretch;
  }

  .nav-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 12px;
    border-radius: 0;
    text-align: center;
    white-space: nowrap;
  }

  /* ── TABS WRAPPER: adjust sticky offset for 88px mobile header ── */
  .tabs-wrapper {
    top: calc(var(--app-nav-h) + 88px);
  }

  /* ── CARDS: prevent any internal content from overflowing ── */
  .card {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .meta {
    max-width: 100%;
  }

  .comment-text,
  .reply-display,
  .original-reply {
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* ── FORM ELEMENTS ── */
  textarea,
  input[type="text"],
  input[type="email"],
  select {
    max-width: 100%;
  }
}

/* ── APP NAV (top-level, appears on all pages) ── */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #0f0f0f;
  border-bottom: 1px solid #2e2e2e;
  position: sticky;
  top: 0;
  z-index: 101;
}

.app-nav-logo img {
  display: block;
  opacity: 0.9;
}

.app-nav-logo:hover img {
  opacity: 1;
}

.app-nav-signout {
  font-size: 13px;
  color: #888;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.app-nav-signout:hover {
  color: #fff;
}

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

.app-nav-email {
  font-size: 12px;
  color: #666;
  display: none;
}

@media (min-width: 480px) {
  .app-nav-email { display: block; }
}

.app-nav-link {
  font-size: 13px;
  color: #888;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.app-nav-link:hover {
  color: #fff;
}

.app-nav-link--active {
  color: #fff;
}
