/* =========================
   IMPORTS
============================= */
@import "components/share-menu.css";

/* =========================
   BASE STYLES
============================= */
body {
  font-family: Arial, sans-serif;
  padding: 20px;
  background: #fff;
  color: #222;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Floating scroll-to-top button */
#infoScrollTop {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: none; /* shown via JS */
  padding: 8px 10px;
  border: 1px solid var(--color-btn-border);
  border-radius: 999px;
  background: rgba(255,255,255,0.6);
  color: var(--color-link);
  font-weight: 700;
  cursor: pointer;
}
body.theme-contra #infoScrollTop,
body.theme-all_round #infoScrollTop,
body.theme-gents #infoScrollTop { background: rgba(0,0,0,0.22); color: var(--color-text); }

/* =========================
   INFO PAGE (About • Terms • Privacy • Contact)
   Themed, readable, and structured
============================= */
/* Override the centered flex layout used by main.quote-wrapper for the Info page */
main.quote-wrapper.info-wrapper {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  display: block;           /* cancel flex centering */
  text-align: left;         /* align content left */
}
/* Keep a convenience class too */
.info-wrapper { text-align: left; }

.info-title {
  margin: 8px 0 18px;
  font-size: 1.8rem;
  color: var(--color-blockquote);
}

/* Sticky subnav under the title */
.info-subnav {
  position: sticky;
  top: 56px; /* sit below the top bar */
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 6px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  background-color: rgba(255,255,255,0.6);
}
.info-subnav-link {
  padding: 4px 8px;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  color: var(--color-link);
  font-weight: 600;
  font-size: 0.95rem;
}
.info-subnav-link:hover { color: var(--color-btn-hover); }
.info-subnav-link.active { border-bottom-color: var(--color-meta-border); color: var(--color-blockquote); }

.info-nav .info-link.active {
  background: var(--color-btn-bg-hover);
  border-color: var(--color-btn-border);
  color: var(--color-btn-hover);
}

.info-section { margin: 22px 0 26px; scroll-margin-top: 96px; }
.info-section + .info-section { border-top: 1px solid rgba(0,0,0,0.12); padding-top: 18px; }
.info-section h2 {
  font-size: 1.4rem;
  color: var(--color-blockquote);
  margin: 0 0 8px;
  border-bottom: 2px solid var(--color-meta-border);
  padding-bottom: 6px;
}

.last-updated { font-size: 0.8rem; opacity: 0.65; font-weight: 500; margin-left: 6px; }

/* Content card that works on both dark and light themes without a heavy frame */
/* Remove boxes: lean, left-aligned content without frames */
.info-card { border: none; padding: 0; background: transparent; }

.info-section p,
.info-section li { color: var(--color-text); }
.info-section p { line-height: 1.7; margin: 8px 0; }
.info-section ul { padding-left: 18px; margin: 8px 0; }
.info-section a.info-link-inline { color: var(--color-link); text-decoration: underline; text-underline-offset: 2px; }

/* Dark theme refinements for info page (ensure contrast) */
/* No frames in dark themes either */
body.theme-contra .info-card,
body.theme-all_round .info-card,
body.theme-gents .info-card { border: none; background: transparent; }
body.theme-contra .info-section h2,
body.theme-all_round .info-section h2,
body.theme-gents .info-section h2 { border-bottom-color: rgba(255,255,255,0.35); }
body.theme-contra .info-section + .info-section,
body.theme-all_round .info-section + .info-section,
body.theme-gents .info-section + .info-section { border-top-color: rgba(255,255,255,0.18); }
/* Dark theme subnav contrast */
body.theme-contra .info-subnav,
body.theme-all_round .info-subnav,
body.theme-gents .info-subnav { background-color: rgba(0,0,0,0.18); }

@media screen and (max-width: 600px) {
  .info-title { font-size: 1.6rem; }
  .info-section h2 { font-size: 1.25rem; }
  .info-card { padding: 12px; }
  .info-subnav { top: 52px; gap: 6px; padding: 6px 4px; }
  .info-subnav-link { font-size: 0.9rem; padding: 3px 6px; }
}

/* =========================
   MODALS (overlay popups)
============================= */
.modal {
  position: fixed;
  inset: 0; /* top:0;right:0;bottom:0;left:0 */
  background: rgba(0, 0, 0, 0.45);
  display: none; /* toggled to flex in JS */
  align-items: center;
  justify-content: center;
  z-index: 1200; /* above theme summary (900) and calendar */
  padding: 16px;
  box-sizing: border-box;
}
.modal .modal-content {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
  max-width: 720px;
  width: 100%;
  padding: 20px;
  position: relative;
}
.modal .close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 20px;
  cursor: pointer;
}

/* Shared button look for header/footer buttons */
.header-btn,
.footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px; /* base spacing */
  line-height: 1.2;
  border-radius: 6px;
  box-sizing: border-box; /* consistent sizing */
}

h1 {
  font-size: 24px;
  margin-bottom: 10px;
}

/* =========================
   THEME SUMMARY TABLE
   Clean & Responsive UI
============================= */
.theme-summary {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: 16px 18px;
  z-index: 1;
  font-family: 'Helvetica Neue', sans-serif;
}

/* Inline the Theme Summary within the page flow on the dashboard */
body.dashboard-page .theme-summary {
  position: static;
  top: auto;
  right: auto;
  width: 100%;
  max-width: 100%;
  max-height: none;
  overflow: visible;
  margin: 8px 0 16px;
}

#themeSummaryTable {
  transition: max-height 0.3s ease;
  overflow: hidden;
}

.theme-summary h2 {
  font-size: 1.05rem;
  margin: 0 0 12px;
  color: #111;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.theme-summary table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.theme-summary th,
.theme-summary td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.theme-summary th {
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.04em;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.theme-summary tr:nth-child(even) td {
  background-color: #f6f9ff;
}

.theme-summary tr:hover td {
  background-color: #e9f1ff;
}

/* =========================
   TOP ACTIONS BUTTONS
============================= */
.top-actions {
  margin-bottom: 25px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

.top-actions .button-link,
.top-actions button {
  padding: 10px 16px;
  background: #3a86ff;
  color: white;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s ease;
  user-select: none;
}

.top-actions .button-link:hover,
.top-actions button:hover {
  background: #265cbf;
}

#deleteAllBtn {
  background: #d64545;
}

#deleteAllBtn:hover {
  background: #a82b2b;
  color: white;
}

/* =========================
   CALENDAR NAVIGATION
============================= */
.calendar-nav {
  margin-bottom: 15px;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.calendar-nav a {
  color: #3a86ff;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
  cursor: pointer;
}

.calendar-nav a:hover {
  color: #265cbf;
}

.calendar-nav strong {
  font-weight: 700;
  color: #333;
}

/* =========================
   CALENDAR TABLE
============================= */
.calendar-wrap { width: 100%; max-width: 960px; margin: 0 auto; }
.calendar { width: 100%; table-layout: fixed; }
.calendar th, .calendar td { width: calc(100% / 7); }

.calendar-vars,
:root {
  /* Defaults (can be overridden by theme on body) */
  --calendar-badge-bg: #2ea44f;
  --calendar-badge-fg: #ffffff;
  --calendar-today-outline: #3a86ff;
  --calendar-today-bg: #f0f6ff;
  --calendar-today-link: #444444;
  --calendar-today-link-hover: #000000;
  --day-col: 160px;            /* width of a day column */
  --calendar-cell-h: 120px;    /* uniform cell height to fit two lines */
}

/* Theme overrides: Gents */
body.theme-gents {
  --calendar-badge-bg: #004696;           /* theme primary */
  --calendar-badge-fg: #ffffff;
  --calendar-today-outline: #004696;
  --calendar-today-bg: rgba(0, 70, 150, 0.08);
  --calendar-today-link: #004696;
  --calendar-today-link-hover: #002c5a;
}

.calendar {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}

.calendar th,
.calendar td {
  border: 1px solid #ccc;
  text-align: center;
  padding: 6px 8px; /* smaller */
  width: calc(100% / 7); /* 7 days */
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none; /* prevent text selection on click */
  font-size: 14px; /* smaller text */
}

.calendar td:hover {
  background-color: #eef4ff;
}

.calendar-day.scheduled {
  background-color: #cfe9d6;
  font-weight: bold;
  color: #246b29;
}

/* Badge and day number inside cells */
.calendar td { position: relative; height: var(--calendar-cell-h); vertical-align: top; overflow: hidden; }
.calendar .day-num { display: block; font-weight: 600; }
.calendar .day-num {
  position: absolute;
  top: 6px;
  left: 6px;
  font-weight: 600;
}

.calendar .day-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--calendar-badge-bg);
  color: var(--calendar-badge-fg);
  font-size: 11px;
  line-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calendar .events { margin-top: 24px; display: block; }
.calendar .event {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 1.2;
  color: #444;
}
.calendar .more { margin-top: 2px; font-size: 12px; color: #666; }

/* Compact calendar: reduce height to one third */
.calendar-compact { --calendar-cell-h: 40px; }

/* Today and weekend highlights */
.calendar-day.today { outline: 2px solid var(--calendar-today-outline); outline-offset: -2px; background: var(--calendar-today-bg); }
.calendar-day.weekend:not(.scheduled) { background-color: #fafafa; }

/* Legend under calendar */
.calendar-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin: 8px 0 16px;
  font-size: 0.9rem;
}
.calendar-legend .legend-item { display: inline-flex; align-items: center; color: #444; }
.calendar-legend .legend-item .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.calendar-legend .legend-item .dot.scheduled { background: var(--calendar-badge-bg); }
.calendar-legend .legend-item .dot.today { background: var(--calendar-today-outline); }

/* Style the Today link in nav */
.calendar-nav .today-link { color: var(--calendar-today-link); text-decoration: underline; }
.calendar-nav .today-link:hover { color: var(--calendar-today-link-hover); }

/* Responsive shrinking for calendar cells */
@media screen and (max-width: 600px) {
  .calendar td { padding: 4px 6px; height: 44px; font-size: 12px; }
  .calendar .day-num { font-size: 12px; }
  .calendar .day-badge { min-width: 16px; height: 16px; font-size: 10px; line-height: 16px; }
  .calendar .events { margin-top: 18px; }
}

/* Make dashboard page width equal to one calendar month width */
body.dashboard-page { max-width: 960px; width: 100%; margin: 0 auto; }

@media screen and (max-width: 480px) {
  .calendar th,
  .calendar td {
    padding: 6px 8px;
    height: var(--calendar-cell-h);
    font-size: 14px;
    vertical-align: top;
    position: relative;
    overflow: hidden; /* prevent cell growth */
  }

  h1 {
    font-size: 20px;
  }

  /* Quote table smaller font for mobile */
  .quote-table {
    font-size: 13px;
  }

  /* Modal content max width smaller on mobile */
  .modal-content {
    max-width: 90%;
    padding: 15px;
  }
}
.theme-color {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.scheduled-quote {
  background-color: #e6ffe6 !important;
}

/* Quote list outline and pagination */
.quote-list-wrap.outlined {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

/* Make quote list scrollable with sticky header for better UX */
.quote-list-wrap.outlined {
  max-height: 60vh;
  overflow: auto;
}
.quote-table thead th { position: sticky; top: 0; z-index: 2; }

.quote-list-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.quote-list-controls .per-page {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.quote-list-controls select {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #cfd6e4;
  border-radius: 6px;
  background: #fff;
}

.pagination { display: flex; gap: 6px; justify-content: center; margin: 12px 0; }
.pagination button {
  padding: 8px 12px;
  border: none;
  background: #3a86ff;
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
.pagination button:hover { background: #265cbf; }
.pagination button[disabled] { opacity: 0.55; cursor: not-allowed; }
.pagination button.active { background: #265cbf; }
.pagination .ellipsis { padding: 8px 6px; color: #6b7280; background: transparent; cursor: default; }

/* Quote table inner dividers */
.quote-table {
  width: 100%;
  border-collapse: separate; /* allow inner borders without collapsing radius */
  border-spacing: 0;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.quote-table thead th {
  background: #f7f9fc;
  font-weight: 600;
  border-bottom: 1px solid #e3e7ee;
}
.quote-table thead th.sortable { cursor: pointer; user-select: none; }
.quote-table thead th.sorted { background: #eef3ff; color: #1f3b8f; }
.quote-table thead th .sort-indicator { margin-left: 6px; font-size: 12px; color: #6b7280; }
.quote-table thead th.sorted .sort-indicator { color: #1f3b8f; }
.quote-table th, .quote-table td {
  padding: 10px 12px;
}
.quote-table tbody td { vertical-align: top; }

/* Quote cell is fully visible (no line clamp), clickable to expand details */
.quote-table tbody td:nth-child(2) {
  display: block;
  overflow: visible;
}

.quote-table td.quote-cell { cursor: pointer; }
.quote-table td.quote-cell .chev {
  display: inline-block;
  width: 14px;
  margin-right: 6px;
  color: #6b7280;
  transition: transform 0.2s ease;
}
.quote-table td.quote-cell.expanded .chev { transform: rotate(90deg); }

/* Center align numeric-like columns (with Explanation column present) */
.quote-table tbody td:nth-child(1), /* ID */
.quote-table tbody td:nth-child(5), /* Year */
.quote-table tbody td:nth-child(7), /* Scheduled */
.quote-table tbody td:nth-child(8), /* Views */
.quote-table tbody td:nth-child(9)  /* Likes */ {
  text-align: center;
  white-space: nowrap;
}

/* Style action buttons in Actions column */
.quote-table tbody td:last-child button,
.quote-table tbody td:last-child a.button-link {
  padding: 6px 10px;
  background: #eef3ff;
  color: #1f3b8f;
  border: 1px solid #cfd6e4;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
}
.quote-table tbody td:last-child button:hover,
.quote-table tbody td:last-child a.button-link:hover {
  background: #dfe8ff;
}

/* Also style specific action controls for consistency */
.quote-table .editBtn,
.quote-table .deleteBtn,
.quote-table .unscheduleBtn {
  padding: 6px 10px;
  background: #eef3ff;
  color: #1f3b8f;
  border: 1px solid #cfd6e4;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.quote-table .editBtn:hover,
.quote-table .deleteBtn:hover,
.quote-table .unscheduleBtn:hover {
  background: #dfe8ff;
}
.quote-table .deleteBtn { background: #ffecec; color: #8f1f1f; border-color: #f1c0c0; }
.quote-table .deleteBtn:hover { background: #ffdede; }
.quote-table tbody td {
  border-top: 1px solid #eee; /* row dividers */
}
.quote-table th + th, .quote-table td + td {
  border-left: 1px solid #f0f0f0; /* column dividers */
}
.quote-table tbody tr:hover td {
  background: #fafcff;
}

/* Expandable row for full quote/explanation */
.row-details { display: none; background: #fbfdff; }
.row-details .details-inner { padding: 12px; color: #111; }
.row-details .details-meta { color: #555; font-size: 13px; margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; }
.row-details.show { display: table-row; }

/* Inline snippets inside the Quote cell */
.quote-table .quote-snippet, .quote-table .quote-text { font-weight: 500; color: #111; }
.quote-table .explain-snippet { margin-top: 4px; font-size: 12.5px; color: #4b5563; }

/* Optional subtle striping */
.quote-table tbody tr:nth-child(even) td { background: #fcfdff; }

/* Filters bar aligns with controls */
#filterForm {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
#filterForm select,
#filterForm input[type="text"],
#filterForm button {
  padding: 8px 10px;
  font-size: 14px;
  border-radius: 6px;
}
#filterForm select,
#filterForm input[type="text"] { border: 1px solid #cfd6e4; background: #fff; }
#filterForm button { background: #3a86ff; color: #fff; border: none; font-weight: 600; cursor: pointer; }
#filterForm button:hover { background: #265cbf; }

/* Unified toolbar look for filters + per-page */
.quote-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 6px;
}
.quote-toolbar .left,
.quote-toolbar .right { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.active-filters { display: inline-flex; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 12px; line-height: 1; border: 1px solid #e3e7ee; background: #f7f9fc; color: #333; }
.chip-scheduled { background: #e6f6ea; border-color: #cce7d3; color: #1c5a27; }
.chip-muted { background: #f3f4f6; color: #666; }
.chip-today { background: #eef3ff; border-color: #cfd6e4; color: #1f3b8f; }

/* =========================
   DASHBOARD STATS GRID
   Professional UI cards for KPIs
============================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e7ebf3;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card .stat-label {
  font-size: 12px;
  color: #667085;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
}

.stat-card.good { border-color: #cce7d3; }
.stat-card.warn { border-color: #ffe4b3; }
.stat-card.bad { border-color: #f5c2c7; }

/* Modal form controls */
.modal .modal-content label { display: inline-block; margin: 6px 6px 4px 0; font-weight: 600; }
.modal .modal-content input[type="text"],
.modal .modal-content textarea,
.modal .modal-content select {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd6e4;
  border-radius: 6px;
  box-sizing: border-box;
  margin-bottom: 10px;
}
.modal .modal-content button {
  padding: 10px 14px;
  background: #3a86ff;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.modal .modal-content button:hover { background: #265cbf; }

/* =========================
   FOOTER RESPONSIVENESS
============================= */
.bottom-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 20px;
  font-size: 16px;
  border-top: none;
  margin-top: auto;
  max-width: 960px; /* do not exceed specified width */
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
  background: transparent; /* allow footer to carry full-width color */
}

.bottom-bar .left,
.bottom-bar .right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Mobile tweaks */
@media screen and (max-width: 600px) {
  .bottom-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 12px; /* tighter container padding */
  }

  .bottom-bar .left,
  .bottom-bar .right {
    width: 100%;
    justify-content: center;
    margin-bottom: 4px; /* tighter and consistent across header/footer */
    gap: 4px; /* tighter */
  }

  .footer-btn {
    flex: 1 0 40%;
    min-width: 110px;
    margin: 0; /* rely on gap for spacing */
    padding: 6px 8px; /* smaller padding on mobile */
    min-height: 34px; /* consistent button height */
  }

  /* remove trailing bottom space on last row */
  .bottom-bar .right:last-child { margin-bottom: 0; }
}

/* =========================
   TOP MENU RESPONSIVENESS
============================= */
.top-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 20px;
  font-size: 16px;
  border-bottom: none;
  max-width: 960px; /* do not exceed specified width */
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
  background: transparent; /* allow header to carry full-width color */
}

.top-bar .left,
.top-bar .right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Mobile tweaks */
@media screen and (max-width: 600px) {
  .top-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 12px; /* tighter container padding */
  }

  .top-bar .left,
  .top-bar .right {
    width: 100%;
    justify-content: center;
    margin-bottom: 4px; /* tighter and consistent across header/footer */
    gap: 4px; /* tighter */
  }

  .header-btn {
    flex: 1 0 40%;
    min-width: 110px;
    margin: 0; /* rely on gap for spacing */
    padding: 6px 8px; /* smaller padding on mobile */
    min-height: 34px; /* consistent button height */
  }

  /* remove trailing bottom space on last row */
  .top-bar .right:last-child { margin-bottom: 0; }
}

/* Extra-tight spacing for very small devices (<=480px) */
@media screen and (max-width: 480px) {
  .top-bar .left,
  .top-bar .right,
  .bottom-bar .left,
  .bottom-bar .right {
    margin-bottom: 2px; /* identical tighter spacing */
    gap: 2px; /* even tighter gaps on very small screens */
  }

  .header-btn,
  .footer-btn {
    margin: 0; /* rely on gap */
    padding: 4px 8px; /* extra-tight padding */
    line-height: 1.15; /* compact but readable */
    min-height: 32px; /* uniform height */
  }

  .top-bar,
  .bottom-bar {
    padding: 4px 8px; /* extra-tight container padding */
  }

  /* slightly smaller font for buttons to avoid wrap and keep height tight */
  .header-btn,
  .footer-btn { font-size: 13px; }
}

/* Ultra-compact preset for very small devices (<=360px) */
@media screen and (max-width: 360px) {
  .top-bar .left,
  .top-bar .right,
  .bottom-bar .left,
  .bottom-bar .right {
    margin-bottom: 1px;
    gap: 1px;
  }

  .header-btn,
  .footer-btn {
    font-size: 12.5px;
    padding: 3px 7px;
    min-height: 30px;
  }

  .top-bar,
  .bottom-bar {
    padding: 3px 6px;
  }

  /* ensure no trailing space on last row in ultra-compact */
  .top-bar .right:last-child,
  .bottom-bar .right:last-child { margin-bottom: 0; }
}

/* =========================
   DEV THEME MENU (shown with ?dev=1)
============================= */
.dev-menu {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 4000;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  padding: 10px;
  width: 240px;
  backdrop-filter: blur(6px);
}
.dev-menu__title { font-weight: 700; font-size: 14px; margin: 0 0 6px; }
.dev-menu__select { width: 100%; margin-bottom: 6px; padding: 6px; border-radius: 6px; border: 1px solid #cfd6e4; }
.dev-menu__btn { width: 100%; padding: 8px; border-radius: 6px; border: none; background: #3a86ff; color: #fff; font-weight: 700; cursor: pointer; }
.dev-menu__btn:hover { background: #265cbf; }
.dev-menu__list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dev-menu__link { display: inline-block; padding: 4px 6px; border: 1px solid #e3e7ee; border-radius: 999px; font-size: 12px; text-decoration: none; color: #1f3b8f; background: #f7f9fc; }
.dev-menu__link[aria-current="page"] { background: #eef3ff; border-color: #cfd6e4; font-weight: 700; }
.dev-menu__close { position: absolute; top: 4px; right: 6px; border: none; background: transparent; font-size: 18px; cursor: pointer; color: #777; }
.dev-menu__close:hover { color: #111; }

/* =========================
   QUOTE DISPLAY - Info Icon & Explanation
============================= */
.quote-container {
  position: relative;
  width: 100%;
}

.info-icon {
  position: absolute;
  top: -10px;
  right: -4px;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.6;
  padding: 2px;
  transition: opacity 0.2s ease;
}

.info-icon:hover {
  opacity: 1;
}

.explanation-bubble {
  position: absolute;
  top: 20px;
  right: 0;
  background: #fff;
  color: #111;
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  max-width: 300px;
  font-size: 0.9rem;
  line-height: 1.4;
  z-index: 10;
  display: none;
}

/* =========================
   FADE-IN ANIMATION
============================= */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Additional layout sections remain unchanged
   and are preserved in your current stylesheet. */
   


/* =========================
   Scheduled Quote Preview Card
   (in Schedule modal)
============================= */
.scheduled-preview {
  border: 2px solid #3a86ff; /* primary accent border */
  border-radius: 10px;
  padding: 14px 16px;
  background: #f7fbff; /* subtle background to lift card */
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 10px;
}
.scheduled-preview .sp-text {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 8px;
}
.scheduled-preview .sp-meta {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 10px;
}
.scheduled-preview .sp-actions {
  display: flex;
  gap: 8px;
}
.scheduled-preview .sp-actions .deleteScheduledBtn {
  background: #d64545;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}
.scheduled-preview .sp-actions .deleteScheduledBtn:hover {
  background: #a82b2b;
}

/* Helper states for preview area */
#schedulePreview .preview-empty,
#schedulePreview .preview-none,
#schedulePreview .preview-error,
#schedulePreview .preview-loading {
  padding: 10px 12px;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  background: #fafcff;
  color: #333;
}
/* =========================
   CUSTOM QUOTE DISPLAY FIXES
   Mobile-friendly quote layout + 2-column buttons
============================= */

/* Keep on-screen quote layout capped at 960px on wide screens */
@media screen and (min-width: 961px) {
  .quote-wrapper,
  .quote-container,
  blockquote#quoteContainer {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
}

/* Force quote block to full width on mobile */
@media screen and (max-width: 600px) {
  .quote-wrapper {
    width: 100%;
    padding: 0 12px;
    box-sizing: border-box;
  }

  .quote-container {
    width: 100%;
    max-width: 100%;
  }

  blockquote {
    text-align: center;
    width: 100%;
    padding: 0 10px;
  }
}

/* =========================
   BEST OF PAGE STYLES
============================= */
.best-wrapper { max-width: 960px; width: 100%; margin: 0 auto; }
.best-heading { margin: 16px 0 18px; font-size: 1.8rem; color: var(--color-blockquote); border-bottom: 2px solid var(--color-meta-border); padding-bottom: 6px; }
.best-list { padding: 4px 0; width: 100%; background: transparent; }
/* Ensure all nested containers remain transparent */
.best-list, .best-item, .best-row, .best-content { background: transparent !important; }
/* Frameless: override dashboard list frame */
.best-list.quote-list-wrap.outlined { max-height: none; overflow: visible; border: none; border-radius: 0; box-shadow: none; background: transparent; }
/* High-specificity safety net to eliminate any residual white frames from global styles */
.best-wrapper .quote-list-wrap.outlined { background: transparent !important; border: none !important; box-shadow: none !important; border-radius: 0 !important; }
.best-item { padding: 14px 0; border-bottom: 1px solid rgba(0,0,0,0.08); }
.best-item:last-child { border-bottom: none; }
.best-row { display: flex; align-items: flex-start; gap: 12px; }
.best-item:hover { background: rgba(255,255,255,0.04); }
.best-rank { min-width: 30px; text-align: right; font-weight: 700; color: #475569; }
.best-content { flex: 1 1 auto; }
.best-text { font-size: 1.22rem; line-height: 1.5; color: var(--color-blockquote); font-family: var(--font-family-serif); }
.best-meta { margin-top: 4px; color: #475569; font-size: 0.95rem; }
.best-actions { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.best-likes { color: var(--color-link); font-weight: 600; background: transparent; border: 1px solid var(--color-btn-border); border-radius: 999px; padding: 2px 8px; line-height: 1.2; font-size: 0.85rem; }
/* Align Best Of copy button with header/footer button styling, but smaller */
.best-copy { padding: 4px 8px; border: 1px solid var(--color-btn-border); border-radius: var(--radius-btn); background: transparent; cursor: pointer; font-weight: 600; font-size: 0.86rem; color: var(--color-link); }
.best-copy:hover { background: var(--color-btn-bg-hover); color: var(--color-btn-hover); }
.best-controls { display: flex; justify-content: center; margin: 12px 0; }
.best-load-more { padding: 10px 16px; background: #3a86ff; color: #fff; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; }
.best-load-more:hover { background: #265cbf; }

@media screen and (max-width: 600px) {
  .best-text { font-size: 1.08rem; line-height: 1.45; }
  .best-rank { min-width: 24px; }
  .best-item { padding: 12px 12px; }
}

/* Dark theme refinements: Contra */
body.theme-contra .best-item { border-bottom: 1px solid rgba(255,255,255,0.12); }
body.theme-contra .best-item:hover { background: rgba(255,255,255,0.06); }
body.theme-contra .best-meta { color: rgba(255,255,255,0.78); }
body.theme-contra .best-likes { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.24); color: #dde7ff; }
body.theme-contra .best-copy { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.24); color: var(--contra-ivory); }
body.theme-contra .best-copy:hover { background: rgba(255,255,255,0.14); }