/* =========================================================
   Подслушано · Альшеевская — Mini App
   Dark, clean, soft purple accents
   ========================================================= */

:root {
  --bg: #0f0f12;
  --bg-elevated: #17171c;
  --bg-card: #1c1c24;
  --bg-hover: #24242e;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);

  --text: #f2f2f5;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b7b;

  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.15);
  --accent-hover: #9d74f7;
  --success: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ---------- HEADER ---------- */
.header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  z-index: 10;
}

.header-glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 120px;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:active {
  background: var(--bg-hover);
  color: var(--text);
}

/* ---------- MAIN / SCREENS ---------- */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px calc(24px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

.screen {
  display: none;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: block;
}

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

/* ---------- HERO ---------- */
.hero {
  margin: 8px 0 24px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- ACTION CARDS ---------- */
.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.action-card:active {
  transform: scale(0.985);
  background: var(--bg-hover);
}

.action-card.primary {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(139, 92, 246, 0.1));
  border-color: rgba(139, 92, 246, 0.35);
}

.action-card.primary:active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.35), rgba(139, 92, 246, 0.18));
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.action-card.primary .action-icon {
  background: rgba(139, 92, 246, 0.25);
}

.action-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.action-body strong {
  font-size: 15px;
  font-weight: 600;
}

.action-body span {
  font-size: 12px;
  color: var(--text-muted);
}

.action-arrow {
  color: var(--text-muted);
  font-size: 18px;
  opacity: 0.6;
}

/* ---------- INFO BLOCK ---------- */
.info-block {
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

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

.info-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.info-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-hover);
  text-decoration: none;
}

/* ---------- SCREEN HEADER ---------- */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-top: 4px;
}

.screen-header h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent-hover);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  font-family: inherit;
}

/* ---------- COMPOSE ---------- */
.compose-area {
  margin-bottom: 20px;
}

#post-text {
  width: 100%;
  min-height: 160px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

#post-text:focus {
  border-color: rgba(139, 92, 246, 0.5);
}

#post-text::placeholder {
  color: var(--text-muted);
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  margin-bottom: 14px;
}

/* Media zone */
.media-zone {
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--bg-elevated);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.media-zone:active {
  background: var(--bg-hover);
}

.media-placeholder {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
}

.media-icon {
  font-size: 22px;
}

.media-placeholder strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.media-placeholder span {
  font-size: 12px;
  color: var(--text-muted);
}

.media-preview {
  position: relative;
  min-height: 120px;
}

.media-preview img,
.media-preview video {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}

.preview-audio {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.remove-media {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- BUTTONS ---------- */
.compose-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 20px;
  border-radius: 14px;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
}

.btn-primary:active:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9, #7c3aed);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

.btn-ghost:active {
  background: var(--bg-hover);
}

.btn.full {
  width: 100%;
  margin-top: 16px;
}

.hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- SUCCESS ---------- */
.success-content {
  text-align: center;
  padding: 40px 8px 20px;
}

.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.success-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.success-content p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 28px;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.success-actions .btn {
  width: 100%;
}

/* ---------- STATUS ---------- */
.status-card {
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 24px 18px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.status-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.status-empty {
  text-align: center;
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.status-empty p {
  color: var(--text-secondary);
  margin-bottom: 18px;
  font-size: 14px;
}

.status-body {
  width: 100%;
  text-align: left;
}

.status-badge {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--warn);
}

.status-badge.approved {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.status-badge.rejected {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.status-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.status-preview {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
}

.status-reason {
  margin-top: 12px;
  font-size: 13px;
  color: var(--danger);
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-xs);
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #2a2a35;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: #3b1a1a;
  color: #fca5a5;
}

.toast.success {
  background: #14301f;
  color: #86efac;
}

/* Telegram theme overrides (optional soft integration) */
body.tg-theme {
  --bg: var(--tg-theme-bg-color, #0f0f12);
  --text: var(--tg-theme-text-color, #f2f2f5);
  --text-secondary: var(--tg-theme-hint-color, #a0a0b0);
  --accent: var(--tg-theme-button-color, #8b5cf6);
}
