/* ══════════════════════════════════════════════════════
   TIPSTER PRO — Premium Dark Dashboard
   ══════════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
  --bg-base: #080a0f;
  --bg-surface: #0e1117;
  --bg-card: #13171f;
  --bg-card-hover: #171c26;
  --bg-input: #0a0d14;
  --bg-input-focus: #0d1018;

  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.3);
  --accent-blue-light: #60a5fa;
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.3);
  --accent-orange: #f59e0b;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(59, 130, 246, 0.3);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow-blue: 0 0 30px rgba(59, 130, 246, 0.15);
  --shadow-glow-green: 0 0 30px rgba(16, 185, 129, 0.15);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ══════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(14, 17, 23, 0.9);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(16,185,129,0.2));
  border: 1px solid rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-blue);
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent-blue-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 6px 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}
.status-dot.online { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); animation: pulse-green 2s infinite; }
.status-dot.offline { background: #ef4444; }

@keyframes pulse-green {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent-green); }
  50% { opacity: 0.7; box-shadow: 0 0 16px var(--accent-green); }
}

.status-text {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════════════════ */
.app-main {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 20px;
  padding: 24px 28px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 79px);
}

/* ─── Panels ─── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  height: fit-content;
}

.panel-config { position: sticky; top: 103px; }
.panel-preview { position: sticky; top: 103px; }

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-icon { font-size: 1.2rem; }

.panel-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.live-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 999px;
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── Field groups ── */
.field-group { margin-bottom: 18px; }

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.label-icon { font-size: 0.9rem; }

.field-input,
.field-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  padding: 11px 14px;
  outline: none;
  transition: var(--transition);
  resize: none;
}

.field-input:focus,
.field-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
  background: var(--bg-input-focus);
}

.field-input::placeholder,
.field-textarea::placeholder { color: var(--text-muted); }

.field-textarea { resize: vertical; min-height: 130px; line-height: 1.6; }

.field-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.input-wrapper { position: relative; }
.input-wrapper .field-input { padding-right: 44px; }

.btn-toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}
.btn-toggle-pass:hover { color: var(--text-secondary); }

.config-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 20px 0;
}

/* ── Multi-Channel Manager ── */
.saved-channels-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.saved-channel-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.saved-channel-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.saved-channel-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-channel-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.saved-channel-meta code {
  color: var(--accent-blue-light);
  font-family: monospace;
  background: rgba(59,130,246,0.1);
  padding: 1px 4px;
  border-radius: 4px;
}

.btn-remove-channel {
  background: rgba(239,68,68,0.1);
  border: none;
  color: #f87171;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-remove-channel:hover {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
}

/* ── Toggle por canal ── */
.channel-toggle-wrap {
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.channel-toggle-slider {
  display: inline-block;
  width: 34px;
  height: 19px;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.channel-toggle-slider.on  { background: var(--accent-green); }
.channel-toggle-slider.off { background: var(--border-subtle); border: 1px solid rgba(255,255,255,0.1); }
.channel-toggle-slider::after {
  content: '';
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  transition: left 0.2s;
}
.channel-toggle-slider.on::after  { left: 18px; }
.channel-toggle-slider.off::after { left: 3px; }

.btn-outline-dashed {
  background: transparent;
  border: 1px dashed var(--border-subtle);
  color: var(--text-secondary);
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-outline-dashed:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue-light);
  background: rgba(59,130,246,0.05);
}

.add-channel-form {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.2s ease-out;
}

.field-sm label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.field-sm .field-input {
  padding: 8px 10px;
  font-size: 0.75rem;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-sm {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-save { background: rgba(16,185,129,0.15); color: var(--accent-green); border: 1px solid rgba(16,185,129,0.3); }
.btn-save:hover { background: rgba(16,185,129,0.25); }

.btn-cancel { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.btn-cancel:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

/* ── Bot Status Card ── */
.bot-status-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 14px;
}

.bot-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Channel Input Wrapper ── */
.channel-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.channel-input-wrapper .field-input {
  flex: 1;
}

.btn-find-channels {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: var(--radius-md);
  color: var(--accent-blue-light);
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-find-channels:hover {
  background: rgba(59,130,246,0.22);
  border-color: var(--accent-blue);
}

.btn-find-channels:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Channel List Dropdown ── */
.channel-list {
  margin-top: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}

.channel-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-subtle);
}

.channel-item:last-child { border-bottom: none; }

.channel-item:hover {
  background: var(--bg-card-hover);
}

.channel-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.channel-item-id {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: monospace;
  word-break: break-all;
}

.channel-item-type {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  color: var(--accent-blue-light);
  border-radius: 999px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.channel-select-btn {
  align-self: flex-start;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 999px;
  color: var(--accent-green);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 14px;
  transition: var(--transition);
  white-space: nowrap;
}
.channel-select-btn:hover { background: rgba(16,185,129,0.2); border-color: var(--accent-green); }

/* ── Invite Bot Section ── */
.invite-section { margin-top: 10px; }

.invite-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.invite-label strong { color: var(--accent-blue-light); }

.invite-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-invite {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  line-height: 1.3;
  transition: var(--transition);
}

.btn-invite-channel {
  background: rgba(44,165,224,0.12);
  border: 1px solid rgba(44,165,224,0.3);
  color: #2ca5e0;
}
.btn-invite-channel:hover {
  background: rgba(44,165,224,0.22);
  border-color: #2ca5e0;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(44,165,224,0.2);
}

.btn-invite-group {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--accent-green);
}
.btn-invite-group:hover {
  background: rgba(16,185,129,0.22);
  border-color: var(--accent-green);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16,185,129,0.2);
}

.invite-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  animation: fadeIn 0.3s ease;
}

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

.info-card {
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(16,185,129,0.05));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 8px;
}

.info-card-icon { font-size: 1.1rem; flex-shrink: 0; }

.info-card p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Instructions Card ── */
.instructions-card {
  background: linear-gradient(135deg, rgba(59,130,246,0.06), rgba(16,185,129,0.04));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 8px;
}

.instructions-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.instructions-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: steps;
}

.instructions-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.instructions-list li strong { color: var(--text-primary); }

.step-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.instructions-warning {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.75rem;
  color: #fca5a5;
  line-height: 1.5;
}

.instructions-warning strong { color: #f87171; }
.instructions-warning u { text-decoration-color: rgba(248,113,113,0.5); }


/* ── URL processed ── */
.url-input-wrapper { display: flex; flex-direction: column; gap: 8px; }

.url-processed {
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.url-processed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-copy-link {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 999px;
  color: var(--accent-green);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-copy-link:hover {
  background: rgba(16,185,129,0.22);
  border-color: var(--accent-green);
  transform: scale(1.04);
}

.url-processed-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-green);
  font-weight: 600;
}

.url-processed-value {
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
  line-height: 1.4;
  font-family: monospace;
}

/* ── Caption area ── */
.caption-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.caption-header .field-label { margin-bottom: 0; }

.emoji-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-emoji {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
  padding: 5px 8px;
  transition: var(--transition);
  line-height: 1;
}

.btn-emoji:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  transform: scale(1.15);
}

.placeholder-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.chip {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 999px;
  color: var(--accent-blue-light);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: monospace;
  padding: 4px 12px;
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover {
  background: rgba(59,130,246,0.2);
  border-color: var(--accent-blue);
}

.chip-link {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.3);
  color: var(--accent-green);
  font-family: 'Inter', sans-serif;
}

.chip-link:hover {
  background: rgba(16,185,129,0.2);
  border-color: var(--accent-green);
}

.html-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.html-hint span {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.html-hint code {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: #f59e0b;
  font-size: 0.68rem;
  padding: 2px 6px;
  font-family: monospace;
}

/* ── Capture Button ── */
.btn-capture {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-blue), #1d4ed8);
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 16px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 24px 0 16px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(59,130,246,0.4);
}

/* ── Image Upload Area ── */
.upload-area {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
  cursor: pointer;
  transition: var(--transition);
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin: 4px 0;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--accent-blue);
  background: rgba(59,130,246,0.06);
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  pointer-events: none;
  padding: 20px;
  text-align: center;
}
.upload-placeholder p { margin: 0; font-size: 0.85rem; }
.upload-preview {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-preview img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
}
.btn-clear-image {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.55);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 2;
}
.btn-clear-image:hover { background: rgba(239,68,68,0.85); }

/* ── Save Buttons & Tabs ── */
.btn-save-sm {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-save-sm:hover {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
}

.caption-header-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.caption-tabs {
  display: flex;
  background: var(--bg-card);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-save-caption {
  background: #22c55e;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-save-caption:hover {
  background: #16a34a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-save-caption:active {
  transform: translateY(0);
}


/* ── Toggle Switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}
.toggle-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.toggle-switch {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-track {
  display: block;
  width: 44px;
  height: 24px;
  background: var(--border-subtle);
  border-radius: 999px;
  position: relative;
  transition: background 0.25s;
}
.toggle-switch input:checked ~ .toggle-track {
  background: var(--accent-blue);
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.toggle-switch input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(20px);
}



.btn-capture::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s;
}

.btn-capture:hover::before { left: 100%; }
.btn-capture:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(59,130,246,0.5); }
.btn-capture:active { transform: translateY(0); }
.btn-capture:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.capture-text {
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

.capture-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Action Bar ── */
.action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.action-bar-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.btn-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-input);
  color: var(--text-secondary);
}

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

.btn-action svg { flex-shrink: 0; }

.btn-telegram { color: #2ca5e0; border-color: rgba(44,165,224,0.3); }
.btn-telegram:hover:not(:disabled) {
  background: rgba(44,165,224,0.1);
  border-color: #2ca5e0;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(44,165,224,0.2);
}

.btn-download { color: var(--accent-green); border-color: rgba(16,185,129,0.3); }
.btn-download:hover:not(:disabled) {
  background: rgba(16,185,129,0.1);
  border-color: var(--accent-green);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(16,185,129,0.2);
}

.btn-copy { color: var(--accent-orange); border-color: rgba(245,158,11,0.3); }
.btn-copy:hover {
  background: rgba(245,158,11,0.1);
  border-color: var(--accent-orange);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(245,158,11,0.2);
}

.btn-copylink { color: #a78bfa; border-color: rgba(167,139,250,0.3); }
.btn-copylink:hover {
  background: rgba(167,139,250,0.1);
  border-color: #a78bfa;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(167,139,250,0.2);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  white-space: nowrap;
}

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

.toast.success { border-color: rgba(16,185,129,0.4); color: var(--accent-green); }
.toast.error { border-color: rgba(239,68,68,0.4); color: #f87171; }

/* ══════════════════════════════════════════════════════
   TELEGRAM PREVIEW WIDGET
   ══════════════════════════════════════════════════════ */

.phone-mockup {
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  background: #1c1c1e;
  border-radius: 30px;
  padding: 12px;
  box-shadow:
    0 30px 60px rgba(0,0,0,0.6),
    inset 0 0 0 1px rgba(255,255,255,0.08),
    0 0 0 8px #0a0a0a;
}

.phone-screen {
  background: #111b21;
  border-radius: 20px;
  overflow: hidden;
  min-height: 400px;
}

.tg-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #1f2c34;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.tg-back {
  font-size: 1.4rem;
  color: #00a884;
  cursor: pointer;
  padding: 0 4px;
}

.tg-channel-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.tg-channel-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #e9edef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-subscribers {
  font-size: 0.6rem;
  color: #8696a0;
}

.tg-menu {
  color: #aebac1;
  font-size: 1.1rem;
  cursor: pointer;
}

.tg-chat {
  padding: 12px 8px;
  min-height: 340px;
  background: #0b141a;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.tg-message {
  background: #1f2c34;
  border-radius: 12px 12px 12px 4px;
  overflow: hidden;
  max-width: 95%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.tg-image-wrapper { width: 100%; }

.tg-image-placeholder {
  background: linear-gradient(135deg, #1a2332, #0f1a24);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #8696a0;
  font-size: 0.7rem;
  text-align: center;
  padding: 16px;
}

.placeholder-icon { font-size: 1.8rem; }

.tg-image {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 280px;
}

.tg-caption {
  padding: 10px 12px 6px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #e9edef;
  white-space: pre-wrap;
  word-break: break-word;
}

.tg-caption em { color: #8696a0; font-style: italic; }

.tg-btn-apostar {
  display: block;
  margin: 6px 8px 8px;
  background: #1e5f8c;
  border: none;
  border-radius: 8px;
  color: #e9edef;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.tg-btn-apostar:hover {
  background: #2b7ab5;
  color: white;
}

.tg-meta {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 2px 10px 8px;
}

.tg-time {
  font-size: 0.6rem;
  color: #8696a0;
}

.tg-channel-tag {
  font-size: 0.6rem;
  color: #00a884;
}

/* ── Preview Info Strip ── */
.preview-info {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pi-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.pi-value {
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
  font-family: monospace;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .app-main {
    grid-template-columns: 260px 1fr 290px;
    gap: 16px;
    padding: 20px 20px;
  }
}

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
  }
  .panel-config, .panel-preview {
    position: static;
  }
  .action-bar {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .app-header { padding: 12px 16px; }
  .app-main { padding: 12px 12px; gap: 12px; }
  .action-bar { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   LOGIN OVERLAY
   ══════════════════════════════════════════════════════ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(16, 185, 129, 0.07) 0%, transparent 55%);
  padding: 20px;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-card), 0 0 60px rgba(59, 130, 246, 0.08);
  animation: loginFadeIn 0.35s ease;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.login-brand-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(16,185,129,0.15));
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.login-brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.login-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-field {
  margin-bottom: 18px;
}

.login-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.login-input-wrapper {
  position: relative;
}

.login-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-input-wrapper .login-input {
  padding-right: 44px;
}

.login-toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.login-toggle-pass:hover { color: var(--text-secondary); }

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: #fca5a5;
  font-size: 0.82rem;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-blue), #1d4ed8);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 14px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.login-btn:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.4);
}

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

.login-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.login-footer {
  text-align: center;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 22px;
}

.login-footer code {
  color: var(--accent-blue-light);
  font-size: 0.71rem;
}

/* ─── Header: usuário logado + botão sair ─── */
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--border-subtle);
}

.header-username {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

/* ─── Botão Usuários (header) ─── */
.btn-users {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-blue-light);
  font-size: 0.73rem;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.btn-users:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}

/* ══════════════════════════════════════════════════════
   MODAL BASE
   ══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.25s ease;
}

.modal-box-lg { max-width: 680px; }

@keyframes modalSlideIn {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

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

.modal-title h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px 10px;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

/* ── Lista de usuários ── */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: border-color var(--transition);
}
.user-item:hover { border-color: var(--border-accent); }

.user-item-info { flex: 1; min-width: 0; }

.user-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.user-badge-admin  { background: rgba(59,130,246,0.15); color: var(--accent-blue-light); border: 1px solid rgba(59,130,246,0.25); }
.user-badge-user   { background: rgba(148,163,184,0.1); color: var(--text-secondary);    border: 1px solid var(--border-subtle); }
.user-badge-inactive { background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }

.user-item-meta {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.user-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-user-edit, .btn-user-delete {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  transition: background var(--transition), border-color var(--transition);
}
.btn-user-edit {
  background: rgba(59,130,246,0.08);
  color: var(--accent-blue-light);
  border-color: rgba(59,130,246,0.15);
}
.btn-user-edit:hover { background: rgba(59,130,246,0.18); border-color: rgba(59,130,246,0.3); }

.btn-user-delete {
  background: rgba(239,68,68,0.08);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.15);
}
.btn-user-delete:hover { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.3); }

/* ── Formulário create/edit ── */
.user-form {
  margin-top: 16px;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
}

.user-form-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.user-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.user-form-active-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.user-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 540px) {
  .user-form-grid { grid-template-columns: 1fr; }
}
