/* Social Tycoon — shared styles for every theme.
   Themes set the --st-* variables on :root so the shared views (settings,
   messages, ads, dashboard, 404…) and shared widgets blend into their look. */
:root {
  --st-bg: #f0f2f5; --st-surface: #fff; --st-surface-2: #f0f2f5; --st-hover: rgba(0,0,0,.05);
  --st-text: #050505; --st-muted: #65676b; --st-border: #dadde1;
  --st-primary: #0866ff; --st-on-primary: #fff; --st-danger: #e41e3f; --st-success: #31a24c;
  --st-radius: 10px; --st-radius-lg: 14px; --st-pill: 999px;
  --st-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --st-shadow: 0 1px 2px rgba(0,0,0,.1);
}

/* Avatars — themes size them inline; round by default (themes may square them, e.g. company logos) */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
  border-radius: 50%; flex-shrink: 0; letter-spacing: -.02em; user-select: none; }
.inline-form { display: inline; margin: 0; }
form.is-busy button[type=submit] { opacity: .6; pointer-events: none; }
a.is-busy { opacity: .6; pointer-events: none; }
[hidden] { display: none !important; }

/* Toasts */
.st-toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column;
  gap: 8px; align-items: center; pointer-events: none; }
.st-toast { pointer-events: auto; background: #1f2328; color: #fff; font: 500 14px/1.35 var(--st-font); padding: 11px 16px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: min(92vw, 460px); transition: opacity .3s, transform .3s; }
.st-toast-success { background: #1f2328; }
.st-toast-error { background: #d93025; }
.st-toast-hide { opacity: 0; transform: translateY(8px); }

/* Double-tap heart */
.st-heart-burst { position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; pointer-events: none; z-index: 5;
  animation: st-burst .85s ease-out forwards; filter: drop-shadow(0 4px 14px rgba(0,0,0,.35)); }
.st-heart-burst svg { width: 100%; height: 100%; fill: #fff; }
@keyframes st-burst { 0% { transform: scale(.2); opacity: 0 } 15% { transform: scale(1.15); opacity: 1 } 30% { transform: scale(.95) }
  45%, 80% { transform: scale(1); opacity: 1 } 100% { transform: scale(1.1) translateY(-24px); opacity: 0 } }

/* Demo mode switcher (only rendered when demo_mode = 1) */
.st-preview { position: fixed; left: 16px; bottom: 16px; z-index: 9998; font: 13px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.st-preview summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 12px; border-radius: 999px;
  background: rgba(20,22,26,.92); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.3); font-weight: 600; backdrop-filter: blur(8px); user-select: none; }
.st-preview summary::-webkit-details-marker { display: none; }
.st-preview-dot { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, #25f4ee, #fe2c55); }
.st-preview-menu { position: absolute; bottom: calc(100% + 8px); left: 0; width: 240px; background: #16181c; color: #e7e9ea; border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.4); padding: 6px; border: 1px solid rgba(255,255,255,.08); }
.st-preview-head { padding: 8px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8b98a5; font-weight: 700; }
.st-preview-item { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; color: inherit; text-decoration: none; }
.st-preview-item small { color: #8b98a5; font-size: 12px; }
.st-preview-item:hover { background: rgba(255,255,255,.07); }
.st-preview-item.is-active { background: rgba(29,155,240,.18); }
.st-preview-reset { color: #1d9bf0; font-weight: 600; border-top: 1px solid rgba(255,255,255,.08); border-radius: 0 0 10px 10px; margin-top: 4px; }
/* Phones: a small round button (themes may move it above their tab bars with --st-preview-bottom) */
@media (max-width: 700px) {
  .st-preview { bottom: var(--st-preview-bottom, 12px); left: 8px; }
  .st-preview summary { font-size: 0; gap: 0; width: 34px; height: 34px; padding: 0; justify-content: center; opacity: .85; }
  .st-preview summary .st-preview-dot { width: 12px; height: 12px; }
  .st-preview[open] summary { opacity: 1; }
}

/* Upload previews */
.st-preview-media { max-width: 100%; max-height: 60vh; border-radius: 10px; display: block; margin: 0 auto; background: #000; }

/* ---------------------------------------------------------------------------
   Neutral components for shared views (themes restyle via the variables)
   --------------------------------------------------------------------------- */
.st-wrap { max-width: 760px; margin: 0 auto; padding: 16px; font-family: var(--st-font); color: var(--st-text); }
.st-wrap-wide { max-width: 1040px; }
.st-card { background: var(--st-surface); border: 1px solid var(--st-border); border-radius: var(--st-radius-lg); box-shadow: var(--st-shadow); }
.st-card + .st-card { margin-top: 12px; }
:is(.st-grid, .st-grid-2, .st-stats) > .st-card + .st-card { margin-top: 0; }   /* grids space with gap */
.st-pad { padding: 16px; }
.st-h1 { font-size: 24px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.01em; }
.st-h2 { font-size: 17px; font-weight: 700; margin: 18px 0 10px; }
.st-muted { color: var(--st-muted); }
.st-small { font-size: 13px; }
.st-row { display: flex; gap: 12px; align-items: center; }
.st-row-wrap { flex-wrap: wrap; }
.st-grow { flex: 1; min-width: 0; }
.st-between { justify-content: space-between; }
@media (max-width: 520px) { .st-between { flex-wrap: wrap; row-gap: 10px; } }   /* long labels (Romanian) never push the page sideways */
.st-stack > * + * { margin-top: 12px; }
.st-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.st-grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .st-grid-2 { grid-template-columns: 1fr; } }
.st-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--st-border); background: var(--st-surface-2);
  color: var(--st-text); font: 600 14px/1 var(--st-font); padding: 9px 16px; border-radius: var(--st-radius); cursor: pointer; text-decoration: none; }
.st-btn:hover { filter: brightness(.96); }
.st-btn-primary { background: var(--st-primary); border-color: var(--st-primary); color: var(--st-on-primary); }
.st-btn-danger { background: transparent; border-color: var(--st-danger); color: var(--st-danger); }
.st-btn-sm { padding: 6px 12px; font-size: 13px; }
.st-btn-block { width: 100%; }
.st-btn svg { width: 16px; height: 16px; }
.st-field { margin-bottom: 14px; }
.st-label { display: block; font-size: 13px; font-weight: 600; color: var(--st-muted); margin-bottom: 6px; }
.st-input, .st-textarea, .st-select { width: 100%; box-sizing: border-box; background: var(--st-surface); color: var(--st-text); border: 1px solid var(--st-border);
  border-radius: var(--st-radius); padding: 10px 12px; font: 15px/1.4 var(--st-font); outline: none; }
.st-input:focus, .st-textarea:focus, .st-select:focus { border-color: var(--st-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-primary) 20%, transparent); }
.st-textarea { min-height: 90px; resize: vertical; }
.st-check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.st-check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--st-primary); }
.st-list { list-style: none; margin: 0; padding: 0; }
.st-list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: inherit; text-decoration: none; }
.st-list-item + .st-list-item { border-top: 1px solid var(--st-border); }
a.st-list-item:hover { background: var(--st-hover); }
.st-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--st-border); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
/* In a theme's grid or flex column, let the shared wrapper shrink so wide tab rows scroll instead of widening the page. */
.st-wrap { min-width: 0; width: 100%; box-sizing: border-box; }
.st-tab { padding: 12px 16px; font: 600 14px var(--st-font); color: var(--st-muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap;
  background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; }
.st-tab.is-active, .st-tab[aria-selected=true] { color: var(--st-text); border-bottom-color: var(--st-primary); }
.st-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--st-pill); background: var(--st-surface-2);
  color: var(--st-text); font-size: 13px; font-weight: 600; border: 1px solid var(--st-border); text-decoration: none; }
.st-chip-check { position: relative; }
.st-chip-check input { position: absolute; opacity: 0; }
.st-chip-check input:checked + span { background: var(--st-primary); color: var(--st-on-primary); border-color: var(--st-primary); }
.st-chip-check span { display: inline-block; padding: 6px 12px; border-radius: var(--st-pill); border: 1px solid var(--st-border); font-size: 13px; cursor: pointer; }
.st-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.st-badge { display: inline-block; min-width: 18px; padding: 2px 6px; border-radius: var(--st-pill); background: var(--st-danger); color: #fff;
  font-size: 11px; font-weight: 700; text-align: center; }
.st-status { display: inline-block; padding: 2px 8px; border-radius: var(--st-pill); font-size: 12px; font-weight: 700; }
.st-status-green { background: #e6f4ea; color: #137333; } .st-status-amber { background: #fef7e0; color: #b06000; }
.st-status-slate { background: #e8eaed; color: #3c4043; } .st-status-red { background: #fce8e6; color: #c5221f; }
.st-empty { text-align: center; padding: 48px 20px; color: var(--st-muted); }
.st-empty-ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--st-surface-2); color: var(--st-text); }
.st-empty-ic svg { width: 28px; height: 28px; }
.st-empty h3 { color: var(--st-text); font-size: 20px; margin: 0 0 4px; }
.st-empty p { margin: 0 auto; max-width: 360px; }
.st-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.st-stat { padding: 14px; }
.st-stat-v { font-size: 22px; font-weight: 800; }
.st-stat-l { font-size: 12px; color: var(--st-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.st-sep { height: 1px; background: var(--st-border); margin: 12px 0; }
.st-link { color: var(--st-primary); text-decoration: none; font-weight: 600; }
.st-link:hover { text-decoration: underline; }
.st-media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.st-media-grid a { position: relative; aspect-ratio: 1; overflow: hidden; background: #111; display: block; }
.st-media-grid img, .st-media-grid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-reach { margin-top: 10px; }
.st-reach-track { height: 8px; border-radius: 999px; background: var(--st-surface-2); overflow: hidden; }
.st-reach-fill { height: 100%; width: 0; background: var(--st-primary); transition: width .3s; }
.st-reach-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }

/* Shared messages view */
.st-dm { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - var(--st-top, 56px)); background: var(--st-surface); color: var(--st-text);
  font-family: var(--st-font); border-left: 1px solid var(--st-border); border-right: 1px solid var(--st-border); }
.st-dm-list { border-right: 1px solid var(--st-border); overflow-y: auto; }
.st-dm-list-head { padding: 16px; font-size: 20px; font-weight: 800; position: sticky; top: 0; background: var(--st-surface); z-index: 1; }
.st-dm-item { display: flex; gap: 12px; align-items: center; padding: 10px 16px; color: inherit; text-decoration: none; }
.st-dm-item:hover { background: var(--st-hover); }
.st-dm-item.is-active { background: var(--st-surface-2); }
.st-dm-item-main { flex: 1; min-width: 0; }
.st-dm-item-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-dm-item-prev { font-size: 13px; color: var(--st-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-dm-item.is-unread .st-dm-item-prev { color: var(--st-text); font-weight: 700; }
.st-dm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--st-primary); flex-shrink: 0; }
.st-dm-thread { display: flex; flex-direction: column; min-width: 0; }
.st-dm-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--st-border); }
.st-dm-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.st-dm-row { display: flex; align-items: flex-end; gap: 8px; max-width: 72%; }
.st-dm-row.is-mine { align-self: flex-end; flex-direction: row-reverse; }
.st-dm-bubble { padding: 9px 13px; border-radius: 18px; background: var(--st-surface-2); font-size: 15px; line-height: 1.35; white-space: pre-wrap; word-wrap: break-word; }
.st-dm-row.is-mine .st-dm-bubble { background: var(--st-primary); color: var(--st-on-primary); }
.st-dm-row.is-mine .st-dm-bubble a { color: inherit; text-decoration: underline; }
.st-dm-compose { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--st-border); }
.st-dm-compose input { flex: 1; border-radius: 999px; }
.st-dm-blank { flex: 1; display: grid; place-items: center; text-align: center; color: var(--st-muted); padding: 24px; }
@media (max-width: 800px) {
  .st-dm { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - var(--st-top, 56px)); }
  .st-dm.has-open .st-dm-list { display: none; }
  .st-dm:not(.has-open) .st-dm-thread { display: none; }
}

/* ---- Report dialog (render.php report_dialog(); opened by [data-report], app.js) ---- */
.st-report { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--st-radius-lg);
  background: var(--st-surface); color: var(--st-text); font-family: var(--st-font); box-shadow: 0 12px 40px rgba(0,0,0,.28); }
.st-report::backdrop { background: rgba(0,0,0,.55); }
.st-report-form { display: flex; flex-direction: column; max-height: inherit; margin: 0; }
.st-report-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 14px 48px; border-bottom: 1px solid var(--st-border); }
.st-report-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.st-report-x { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--st-surface-2); color: var(--st-text); font-size: 20px; line-height: 1; cursor: pointer; }
.st-report-body { overflow-y: auto; padding: 6px 16px 12px; }
.st-report-reasons { border: 0; margin: 0; padding: 0; }
.st-report-lead { padding: 10px 0 6px; font-weight: 600; font-size: 15px; }
.st-report-reason { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--st-border); cursor: pointer; font-size: 15px; }
.st-report-reason:hover { background: var(--st-hover); }
.st-report-reason input { width: 18px; height: 18px; margin: 0; accent-color: var(--st-primary); flex: none; }
.st-report-details { display: block; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--st-muted); }
.st-report-details textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 6px; background: var(--st-surface); color: var(--st-text);
  border: 1px solid var(--st-border); border-radius: var(--st-radius); padding: 9px 11px; font: 15px/1.4 var(--st-font); resize: vertical; }
.st-report-note { margin: 10px 0 0; font-size: 12.5px; color: var(--st-muted); }
.st-report-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--st-border); }

/* Dark appearance — shared widgets. A theme is dark when <html data-theme="dark">, or when it follows the
   device (data-appearance="device", see appearance_attr()) and the device is dark. :where() keeps these at
   class weight, so a theme's own rules for the same widgets (loaded later) win. */
:where(:root[data-theme=dark]) .st-status-green { background: rgba(129,201,149,.16); color: #81c995; }
:where(:root[data-theme=dark]) .st-status-amber { background: rgba(253,214,99,.14); color: #fdd663; }
:where(:root[data-theme=dark]) .st-status-slate { background: rgba(232,234,237,.12); color: #bdc1c6; }
:where(:root[data-theme=dark]) .st-status-red { background: rgba(242,139,130,.16); color: #f28b82; }
:where(:root[data-theme=dark]) .st-toast { box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.12); }
@media (prefers-color-scheme: dark) {
  :where(:root[data-appearance=device]) .st-status-green { background: rgba(129,201,149,.16); color: #81c995; }
  :where(:root[data-appearance=device]) .st-status-amber { background: rgba(253,214,99,.14); color: #fdd663; }
  :where(:root[data-appearance=device]) .st-status-slate { background: rgba(232,234,237,.12); color: #bdc1c6; }
  :where(:root[data-appearance=device]) .st-status-red { background: rgba(242,139,130,.16); color: #f28b82; }
  :where(:root[data-appearance=device]) .st-toast { box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.12); }
}
