:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #ec4899;
  --accent-hover: #db2777;
  --success: #10b981;
  --warning: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-radius: 12px;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: #090d16;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-text span {
  color: var(--primary);
}

/* Project Selector Box */
.project-selector-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 1.25rem;
}

.project-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}

.project-dropdown {
  width: 100%;
  padding: 0.5rem;
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: white;
  font-family: inherit;
  font-size: 0.85rem;
}

.nav-divider {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin: 0.75rem 0 0.5rem 0.5rem;
}

.active-project-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

/* Top Flow Tabs */
.top-flow-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.flow-tab {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.flow-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.flow-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

/* Sidebar Page Contents vs Top Flow Tabs */
.sidebar-page-content {
  display: none;
}

.sidebar-page-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.action-buttons-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.text-accent { color: var(--accent); }
.text-primary { color: var(--primary); }

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.nav-item i {
  font-size: 1.1rem;
  width: 20px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), transparent);
  color: var(--primary);
  border-left: 3px solid var(--primary);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  width: fit-content;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  color: var(--text-muted);
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  max-width: 1400px;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.header-title h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}
.btn-text:hover {
  text-decoration: underline;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-lg {
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
}

.btn-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-tag:hover {
  background: var(--primary);
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.metric-icon.purple { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.metric-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.metric-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.metric-icon.amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0.2rem 0;
}

.metric-trend {
  font-size: 0.75rem;
}
.metric-trend.positive { color: var(--success); }

/* Workflow Banner */
.workflow-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.workflow-banner h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.workflow-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.step-box {
  background: rgba(15, 23, 42, 0.6);
  padding: 1rem;
  border-radius: 10px;
  flex: 1;
  min-width: 200px;
  position: relative;
}

.step-num {
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.step-box h4 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.step-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.step-arrow {
  font-size: 1.25rem;
  color: var(--text-muted);
}

/* Tab Contents */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .grid-2col { grid-template-columns: 1fr; }
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.platform-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.platform-chip {
  padding: 0.5rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.platform-chip:has(input:checked),
.platform-chip.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #a5b4fc;
}

.cta-shortcuts {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Phone Mockup */
.phone-mockup {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  background: #000;
  border-radius: 30px;
  border: 8px solid #334155;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.phone-header {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111;
  border-bottom: 1px solid #222;
}

.phone-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
}

.phone-media {
  position: relative;
  width: 100%;
  height: 320px;
  background: #1a1a1a;
}

.phone-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
}

.phone-actions {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
}

.phone-actions div {
  display: flex;
  gap: 0.75rem;
}

.phone-caption {
  padding: 0 1rem 1rem;
  font-size: 0.8rem;
  line-height: 1.3;
}

/* Auto-DM Triggers */
.trigger-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.trigger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-purple { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.badge-green { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }

.status-green {
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 600;
}

.status-red {
  color: #ef4444;
  font-size: 0.8rem;
  font-weight: 600;
}

.dm-bubble {
  background: #26334d;
  padding: 0.85rem;
  border-radius: 12px;
  border-top-left-radius: 2px;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* Live Simulator */
.highlight-box {
  border: 1px solid var(--primary);
  background: linear-gradient(180deg, var(--bg-card), rgba(99, 102, 241, 0.05));
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.sim-post {
  background: #0f172a;
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.sim-post-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.small-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sim-caption {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  padding-left: 0.5rem;
  border-left: 3px solid var(--accent);
}

.comment-box {
  display: flex;
  gap: 0.5rem;
}

.comment-box input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: white;
}

/* Direct Modal Simulation */
.sim-dm-modal {
  margin-top: 1.25rem;
  background: #1e1b4b;
  border: 1px solid var(--accent);
  border-radius: 12px;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

.sim-dm-header {
  background: rgba(236, 72, 153, 0.2);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.close-dm {
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
}

.sim-dm-content {
  padding: 1.25rem;
}

.sim-dm-content p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

/* JForm Section & LGPD Box */
.jform-container {
  border-top: 4px solid var(--success);
}

.jform-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.jform-brand {
  color: var(--success);
  font-size: 1.1rem;
}

.form-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.form-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.lgpd-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.4;
}

.checkbox-container input {
  margin-top: 0.2rem;
  width: 18px;
  height: 18px;
  accent-color: var(--success);
}

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.text-green { color: var(--success); }

.info-alert {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: #93c5fd;
  margin-top: 1.5rem;
}

/* Webhooks */
.webhook-endpoint-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #0f172a;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

.webhook-endpoint-box code {
  color: #a5b4fc;
  font-family: monospace;
}

.webhook-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 350px;
  overflow-y: auto;
}

.log-item {
  background: #0f172a;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--success);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.code-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.json-code {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  color: #38bdf8;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  max-height: 350px;
  overflow: auto;
}

/* Utilities */
.hidden { display: none !important; }
.mt-4 { margin-top: 1rem; }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--success);
  color: white;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 9999;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}
