/* GTM Playbook Generator - Visuals, Reports, Creative */

:root {
  --gtm-glow: 0 0 24px rgba(0, 82, 204, 0.12);
  --gtm-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
  --gtm-gradient-primary: linear-gradient(135deg, #0052CC 0%, #003D99 100%);
  --gtm-gradient-accent: linear-gradient(135deg, #00A86B 0%, #008556 100%);
  --gtm-gradient-warm: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  --gtm-gradient-danger: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  --gtm-gauge-pct: 50;
}

.gtm-page {
  background: var(--color-bg);
  color: var(--color-text-primary);
}

.gtm-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.gtm-main {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Cross links */
.gtm-cross-links {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}
.gtm-cross-links-label { margin-right: 0.5rem; }
.gtm-cross-links-sep { margin: 0 0.5rem; color: var(--color-text-muted); }
.gtm-cross-link { color: var(--color-primary); text-decoration: none; }
.gtm-cross-link:hover { text-decoration: underline; }

/* Input section - SSE design */
.gtm-input-section {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem 2rem 2rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.gtm-input-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gtm-gradient-primary);
}

.gtm-section-header { margin-bottom: 1.5rem; }
.gtm-section-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 0.5rem; }
.gtm-section-description { font-size: 0.9375rem; color: var(--color-text-secondary); margin: 0; line-height: 1.5; }

.gtm-quick-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.btn-gtm-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--color-bg-gray);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-gtm-action:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.gtm-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.gtm-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.375rem;
}

.gtm-field input,
.gtm-field select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-white);
}

.gtm-field input:focus,
.gtm-field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.15);
}

.gtm-analyze-row {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

/* Output section */
.gtm-output-section {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem 2rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.gtm-meta-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.gtm-meta-item strong { color: var(--color-text-primary); }

/* Tabs - Strategy Scenario Engine style (More results design) */
.gtm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.gtm-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.gtm-tab:hover {
  color: var(--color-primary);
  background: #e8f4fd;
}

.gtm-tab.active {
  color: var(--color-primary);
  background: #e8f4fd;
}

.gtm-tab-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--gtm-gradient-danger);
  color: white;
  padding: 0.125rem 0.375rem;
  border-radius: 10px;
}

.gtm-tab-panel { margin-top: 1rem; }

/* Bottom tabs */
.gtm-tabs-wrap-bottom {
  margin-top: 2rem;
  padding-top: 1rem;
  margin-bottom: 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.gtm-tabs-hint {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

.gtm-tabs-bottom {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0;
  border-bottom: none;
}

/* Readiness card */
.gtm-readiness-card {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(0, 82, 204, 0.04) 0%, rgba(0, 168, 107, 0.04) 100%);
  border-radius: 12px;
  border: 1px solid var(--color-border-light);
}

.gtm-readiness-gauge {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(
    var(--color-primary) 0% calc(var(--gtm-gauge-pct, 50) * 1%),
    var(--color-border) calc(var(--gtm-gauge-pct, 50) * 1%) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gtm-readiness-gauge::before {
  content: '';
  position: absolute;
  inset: 8px;
  background: var(--color-white);
  border-radius: 50%;
}

.gtm-gauge-value {
  position: relative;
  z-index: 1;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.gtm-gauge-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

.gtm-executive-summary { flex: 1; }
.gtm-exec-text { margin: 0; font-size: 1rem; line-height: 1.6; color: var(--color-text-primary); }

/* KPI grid */
.gtm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
  .gtm-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .gtm-tab {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .gtm-tabs-bottom {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .gtm-tabs-bottom .gtm-tab {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .gtm-kpi-grid { grid-template-columns: repeat(2, 1fr); }

  .gtm-timeline-visual {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding: 0.75rem;
    gap: 0.2rem;
  }
  .gtm-timeline-phase {
    min-width: 56px;
    padding: 0.5rem 0.375rem;
    flex-shrink: 0;
  }
  .gtm-timeline-phase-name { font-size: 0.6875rem; }
  .gtm-timeline-phase-duration { font-size: 0.625rem; }

  .gtm-phase-card { padding: 0.75rem; }
  .gtm-phase-name { font-size: 0.875rem; }
  .gtm-phase-duration { font-size: 0.75rem; }
  .gtm-phase-milestones { font-size: 0.8125rem; padding-left: 1rem; }
}

.gtm-kpi-card {
  padding: 1rem;
  background: var(--color-bg-gray);
  border-radius: 8px;
  text-align: center;
}

.gtm-kpi-value { font-size: 1.125rem; font-weight: 700; color: var(--color-primary); }
.gtm-kpi-label { font-size: 0.75rem; color: var(--color-text-secondary); margin-top: 0.25rem; }

/* Subsection - SSE design */
.gtm-subsection-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--color-text-primary);
}
.gtm-subsection-desc {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

/* Channel mix */
.gtm-channel-mix { margin-bottom: 1.5rem; }
.gtm-channel-bars { display: flex; flex-direction: column; gap: 0.75rem; }
.gtm-channel-row {
  display: grid;
  grid-template-columns: 1fr 2fr 3rem;
  align-items: center;
  gap: 1rem;
}
.gtm-channel-label { font-size: 0.875rem; }
.gtm-channel-track {
  height: 24px;
  background: var(--color-bg-gray);
  border-radius: 4px;
  overflow: hidden;
}
.gtm-channel-fill {
  height: 100%;
  background: var(--gtm-gradient-primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.gtm-channel-pct { font-size: 0.875rem; font-weight: 600; text-align: right; }

/* Priorities */
.gtm-priorities { margin-bottom: 1.5rem; }
.gtm-priorities-list { display: flex; flex-direction: column; gap: 0.5rem; }
.gtm-priority-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-gray);
  border-radius: 8px;
  border-left: 3px solid var(--color-primary);
}
.gtm-priority-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
}
.gtm-priority-text { font-size: 0.9375rem; line-height: 1.5; }

/* Funnel visual */
.gtm-funnel-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.gtm-funnel-stage {
  display: grid;
  grid-template-columns: 120px 1fr 3.5rem;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 600px;
}

.gtm-funnel-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text-primary);
  flex-shrink: 0;
}

.gtm-funnel-track {
  height: 32px;
  background: var(--color-bg-gray);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.gtm-funnel-bar {
  height: 100%;
  min-width: 4px;
  background: var(--funnel-color, var(--color-primary));
  border-radius: 6px;
  transition: width 0.4s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.gtm-funnel-rate {
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--color-text-secondary);
  text-align: right;
  flex-shrink: 0;
}

.gtm-funnel-table-wrap { overflow-x: auto; }
.gtm-funnel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.gtm-funnel-table th,
.gtm-funnel-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.gtm-funnel-table th { font-weight: 600; color: var(--color-text-secondary); background: var(--color-bg-gray); }

/* Metrics grid */
.gtm-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.gtm-metric-card {
  padding: 1rem;
  background: var(--color-bg-gray);
  border-radius: 8px;
  border: 1px solid var(--color-border-light);
}

.gtm-metric-name { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.25rem; }
.gtm-metric-target { font-size: 1.125rem; font-weight: 700; color: var(--color-primary); margin-bottom: 0.25rem; }
.gtm-metric-type { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.gtm-metric-benchmark { font-size: 0.8125rem; color: var(--color-text-secondary); margin-top: 0.5rem; }

/* Timeline visual */
.gtm-timeline-visual {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--color-bg-gray);
  border-radius: 8px;
}

.gtm-timeline-phase {
  flex: 1;
  min-width: 80px;
  padding: 0.75rem;
  background: var(--gtm-gradient-primary);
  color: white;
  border-radius: 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gtm-timeline-phase-name { font-size: 0.8125rem; font-weight: 600; }
.gtm-timeline-phase-duration { font-size: 0.6875rem; opacity: 0.9; }

.gtm-phases-list { display: flex; flex-direction: column; gap: 1rem; }
.gtm-phase-card {
  padding: 1rem;
  background: var(--color-bg-gray);
  border-radius: 8px;
  border-left: 4px solid var(--color-primary);
}
.gtm-phase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.gtm-phase-name { font-weight: 600; }
.gtm-phase-duration { font-size: 0.8125rem; color: var(--color-text-secondary); }
.gtm-phase-milestones { margin: 0; padding-left: 1.25rem; font-size: 0.9375rem; line-height: 1.6; }

/* Assumptions */
.gtm-assumptions-list { display: flex; flex-direction: column; gap: 0.75rem; }
.gtm-assumption-item {
  padding: 1rem;
  background: var(--color-bg-gray);
  border-radius: 8px;
  border: 1px solid var(--color-border-light);
}
.gtm-assumption-label { font-weight: 600; margin-bottom: 0.25rem; }
.gtm-assumption-validate { font-size: 0.875rem; color: var(--color-text-secondary); }

/* Risks */
.gtm-risks-list { display: flex; flex-direction: column; gap: 0.75rem; }
.gtm-risk-item {
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--color-border);
}
.gtm-risk-high { border-left-color: #EF4444; background: rgba(239, 68, 68, 0.06); }
.gtm-risk-medium { border-left-color: #F59E0B; background: rgba(245, 158, 11, 0.06); }
.gtm-risk-low { border-left-color: var(--color-accent); background: rgba(0, 168, 107, 0.06); }

.gtm-risk-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.gtm-risk-severity {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}
.gtm-risk-high .gtm-risk-severity { background: #EF4444; color: white; }
.gtm-risk-medium .gtm-risk-severity { background: #F59E0B; color: white; }
.gtm-risk-low .gtm-risk-severity { background: var(--color-accent); color: white; }
.gtm-risk-label { font-weight: 600; }
.gtm-risk-mitigation { font-size: 0.875rem; color: var(--color-text-secondary); }

/* Output actions */
.gtm-output-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.btn-gtm-copy {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--color-bg-gray);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-gtm-copy:hover {
  background: var(--color-white);
  border-color: var(--color-primary);
}

/* Knowledge Base (SSE reference design) */
.gtm-kb-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-decoration: none;
}
.gtm-kb-link:hover { color: var(--color-primary); }

.gtm-knowledge-base {
  margin-top: 3rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--color-border);
}

.gtm-kb-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--color-text-primary);
}

.gtm-kb-intro {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 720px;
}

.gtm-kb-article { margin-bottom: 1rem; }
.gtm-kb-article:last-child { margin-bottom: 0; }

.gtm-kb-details {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0 1.25rem 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gtm-kb-details:hover {
  border-color: rgba(0, 82, 204, 0.3);
}

.gtm-kb-details[open] {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(0, 82, 204, 0.1);
}

.gtm-kb-summary {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  padding: 1rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gtm-kb-summary::-webkit-details-marker { display: none; }

.gtm-kb-summary::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--color-primary);
  transition: transform 0.2s;
}

.gtm-kb-details[open] .gtm-kb-summary::before {
  transform: rotate(180deg);
}

.gtm-kb-takeaway {
  background: rgba(0, 82, 204, 0.06);
  border-left: 3px solid var(--color-primary);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: 1rem;
  border-radius: 0 4px 4px 0;
}

.gtm-kb-details p,
.gtm-kb-article p {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--color-text-primary);
  margin-bottom: 0.75rem;
}

.gtm-kb-details p:last-of-type,
.gtm-kb-article p:last-of-type { margin-bottom: 0; }

.gtm-kb-details ul,
.gtm-kb-article ul {
  margin: 0.75rem 0 1rem 1.25rem;
  padding: 0;
}

.gtm-kb-details li,
.gtm-kb-article li {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}

.gtm-kb-details a,
.gtm-kb-article a {
  color: var(--color-primary);
  text-decoration: none;
}

.gtm-kb-details a:hover,
.gtm-kb-article a:hover { text-decoration: underline; }

/* Print */
@media print {
  .gtm-input-section,
  .gtm-quick-actions,
  .gtm-analyze-row,
  .gtm-output-actions,
  .gtm-tabs,
  .gtm-tabs-wrap-bottom,
  .main-nav,
  .footer-institutional,
  .gtm-cross-links,
  .btn-gtm-copy,
  #gtm-export-csv { display: none !important; }
  .gtm-output-section { border: none; box-shadow: none; }
  .gtm-tab-panel { display: block !important; }
  .gtm-tab-panel[hidden] { display: block !important; }
}
