/* Main CSS — Premium dark theme inspired by Linear/Vercel/Stripe */

:root {
  /* Canvas */
  --canvas: #0a0a0a;
  --surface: #141414;
  --elevated: #1e1e1e;
  --hover: #2a2a2a;

  /* Text */
  --text-primary: #e5e5e5;
  --text-secondary: #a0a0a0;
  --text-tertiary: #666666;

  /* Borders */
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);

  /* Brand */
  --orange: #F94E03;
  --orange-light: #FB7B3D;

  /* Semantic */
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --info: #60a5fa;

  /* Legacy compat */
  --light-bg: #E0E0DA;
  --green: #10B981;
  --gray: #6B7280;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

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

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== ANIMATIONS ========== */

@keyframes ambientDrift {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
  25% { transform: translate(30px, -20px) scale(1.05); opacity: 0.7; }
  50% { transform: translate(-20px, 15px) scale(0.95); opacity: 0.4; }
  75% { transform: translate(15px, 25px) scale(1.02); opacity: 0.6; }
}

@keyframes ambientDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
  33% { transform: translate(-25px, 20px) scale(1.08); opacity: 0.5; }
  66% { transform: translate(20px, -15px) scale(0.92); opacity: 0.35; }
}

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

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

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

/* ========== SELECTOR SCREEN (index.html) ========== */
body.selector-screen {
  background: var(--canvas);
  color: var(--text-primary);
}

body.selector-screen::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse 600px 600px at 30% 20%, rgba(249, 78, 3, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 70% 70%, rgba(249, 78, 3, 0.04) 0%, transparent 70%);
  animation: ambientDrift 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

body.selector-screen::after {
  content: '';
  position: fixed;
  top: -30%;
  left: -30%;
  width: 160%;
  height: 160%;
  background:
    radial-gradient(ellipse 400px 400px at 60% 30%, rgba(249, 78, 3, 0.03) 0%, transparent 60%);
  animation: ambientDrift2 15s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.hero-section {
  text-align: center;
  padding: 3.5rem 2rem 2rem;
  position: relative;
  z-index: 1;
}

.hero-logo {
  animation: fadeInUp 0.6s var(--ease-out) both;
}

.hero-logo img {
  height: 72px;
  filter: drop-shadow(0 4px 20px rgba(249, 78, 3, 0.2));
  transition: all 0.4s var(--ease-out);
}

.hero-logo img:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 8px 30px rgba(249, 78, 3, 0.35));
}

.hero-title {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  animation: fadeInUp 0.6s var(--ease-out) 0.1s both;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.01em;
  animation: fadeInUp 0.6s var(--ease-out) 0.2s both;
}

.section-title {
  text-align: center;
  margin: 2.5rem 0 1.5rem;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.6s var(--ease-out) 0.3s both;
}

.section-title h2 {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: inline-block;
  position: relative;
}

.section-title h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 2px;
  background: var(--orange);
  border-radius: 1px;
}

/* Campaign Cards Grid */
.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

.campaign-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  text-align: center;
  transition: all 0.35s var(--ease-out);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  animation: fadeInUp 0.5s var(--ease-out) both;
}

.campaign-card:nth-child(1) { animation-delay: 0.35s; }
.campaign-card:nth-child(2) { animation-delay: 0.4s; }
.campaign-card:nth-child(3) { animation-delay: 0.45s; }
.campaign-card:nth-child(4) { animation-delay: 0.5s; }

.campaign-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(249, 78, 3, 0.06), transparent 40%);
  pointer-events: none;
}

.campaign-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--border-hover);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(249, 78, 3, 0.08);
}

.campaign-card:hover::before {
  opacity: 1;
}

.campaign-card .campaign-logo {
  max-height: 72px;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 1rem;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
  transition: all 0.35s var(--ease-out);
}

.campaign-card:hover .campaign-logo {
  transform: scale(1.04);
}

.campaign-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.campaign-period {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 1.25rem;
  font-weight: 400;
}

.campaign-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-active {
  background: rgba(52, 211, 153, 0.1);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.status-upcoming {
  background: rgba(249, 78, 3, 0.1);
  color: var(--orange);
  border: 1px solid rgba(249, 78, 3, 0.2);
}

.status-ended {
  background: rgba(102, 102, 102, 0.1);
  color: var(--text-tertiary);
  border: 1px solid rgba(102, 102, 102, 0.2);
}

/* Integrations Section */
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

.integration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  transition: all 0.3s var(--ease-out);
}

.integration-card:hover {
  background: var(--elevated);
  border-color: var(--border-hover);
}

.integration-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.integration-status {
  font-size: 0.7rem;
  font-weight: 500;
}

.integration-connected { color: var(--success); }
.integration-disconnected { color: var(--text-tertiary); }

.footer-info {
  text-align: center;
  padding: 2rem;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  position: relative;
  z-index: 1;
}

/* ========== DASHBOARD SCREENS ========== */

/* Dark Theme (Imersao & Desafio) */
body.theme-dark {
  background: var(--canvas);
  color: var(--text-primary);
}

/* Light Theme (BF25) */
body.theme-light {
  background: var(--light-bg);
  color: #1A1A1A;
}

/* Common header */
.campaign-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-light) 100%);
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(249, 78, 3, 0.25);
  animation: fadeInUp 0.5s var(--ease-out) both;
}

/* Desafio campaign — red-to-orange gradient */
body.campaign-desafio0326 .campaign-header {
  background: linear-gradient(135deg, #E8321E 0%, #F47B30 100%);
  box-shadow: 0 8px 32px rgba(232, 50, 30, 0.3);
}

body.campaign-desafio0326 .header-text h1 {
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

.header-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.header-text h1 {
  color: white;
  font-weight: 700;
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.header-text p {
  color: rgba(255, 255, 255, 0.85);
  margin: 0.25rem 0 0 0;
  font-size: 0.85rem;
  font-weight: 400;
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  margin-bottom: 1rem;
  transition: all 0.25s var(--ease-out);
  text-decoration: none;
  animation: fadeIn 0.4s var(--ease-out) both;
}

.theme-dark .back-btn {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.theme-dark .back-btn:hover {
  background: var(--elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.theme-light .back-btn {
  background: rgba(0, 0, 0, 0.06);
  color: #1A1A1A;
}

.theme-light .back-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Container */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

/* Loading spinner */
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 12px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-text {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

/* Error / Info messages */
.info-msg {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin: 1rem 0;
}

.theme-dark .info-msg {
  background: rgba(249, 78, 3, 0.06);
  border: 1px solid rgba(249, 78, 3, 0.12);
  color: var(--text-secondary);
}

.theme-light .info-msg {
  background: #FFF3E0;
  border: 1px solid #FFB74D;
  color: #4A5568;
}

.error-msg {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin: 1rem 0;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--error);
}

/* Subsection title — replaces inline h3 styles */
.subsection-title {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1.75rem 0 0.75rem;
}

.theme-dark .subsection-title {
  color: var(--text-secondary);
}

.theme-light .subsection-title {
  color: #4A5568;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-title { font-size: 1.8rem; }
  .campaigns-grid { grid-template-columns: 1fr; padding: 0 1rem; }
  .campaign-header { flex-direction: column; text-align: center; }
  .dashboard-container { padding: 1rem; }
  .integrations-grid { padding: 0 1rem; }
}
