/**
 * RoosisIA Kanban SaaS — CSS Briefing IA (Auto-Precificar)
 * Prefixo: rkb- (roosis kanban briefing)
 */

/* ── VARIÁVEIS EXTRA ── */
:root {
  --rkb-acc:    #7c6fe0;
  --rkb-acc2:   rgba(124,111,224,0.14);
  --rkb-acc3:   rgba(124,111,224,0.06);
  --rkb-blue:   #60a5fa;
  --rkb-blue2:  rgba(96,165,250,0.12);
  --rkb-teal:   #2dd4bf;
  --rkb-teal2:  rgba(45,212,191,0.12);
  --rkb-coral:  #fb923c;
  --rkb-coral2: rgba(251,146,60,0.12);
}

/* ── POPUP EXTRA-LARGE ── */
.rk-popup-xl {
  max-width: 1120px;
  width: 98vw;
}

/* ── TASK BADGE ── */
.rkb-task-badge {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  background: var(--rkb-acc2);
  color: var(--rkb-acc);
  border: 1px solid rgba(124,111,224,0.3);
  border-radius: 20px;
  padding: 3px 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── ICON ACC ── */
.rk-icon-acc {
  background: var(--rkb-acc2) !important;
  border-color: rgba(124,111,224,0.25) !important;
}

/* ── PROGRESS ── */
.rkb-progress-wrap {
  padding: 10px 20px 0;
  background: var(--rk-bg);
  border-bottom: 1px solid var(--rk-border);
}

.rkb-prog-segs {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.rkb-prog-seg {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--rk-surface2);
  transition: background 0.3s;
}

.rkb-prog-seg.done   { background: var(--rkb-acc); }
.rkb-prog-seg.active { background: rgba(124,111,224,0.4); }

.rkb-comp-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
}

.rkb-comp-bar-bg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--rk-surface2);
}

.rkb-comp-bar-fill {
  height: 3px;
  border-radius: 2px;
  background: var(--rkb-acc);
  transition: width 0.4s;
  width: 0%;
}

.rkb-comp-pct {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--rkb-acc);
  min-width: 34px;
  text-align: right;
}

/* ── LAYOUT 2 COLUNAS ── */
.rkb-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  min-height: 0;
  overflow: hidden;
}

.rkb-phases-col {
  padding: 16px 20px;
  overflow-y: auto;
  max-height: calc(90vh - 150px);
}

.rkb-phases-col::-webkit-scrollbar { width: 4px; }
.rkb-phases-col::-webkit-scrollbar-track { background: transparent; }
.rkb-phases-col::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.rkb-prompt-col {
  background: var(--rk-bg);
  border-left: 1px solid var(--rk-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(90vh - 150px);
}

/* ── PHASE BUTTON ── */
.rkb-phase-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--rk-surface2);
  border: 1px solid var(--rk-border);
  border-radius: var(--rk-radius-sm);
  cursor: pointer;
  transition: border-color 0.2s;
  margin-bottom: 2px;
  user-select: none;
}

.rkb-phase-btn:hover { border-color: rgba(255,255,255,0.18); }

.rkb-phase-btn.open {
  border-color: rgba(255,255,255,0.14);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  margin-bottom: 0;
}

.rkb-phase-left {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
}

.rkb-phase-num {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rkb-col-blue   { background: var(--rkb-blue2);  color: var(--rkb-blue); }
.rkb-col-teal   { background: var(--rkb-teal2);  color: var(--rkb-teal); }
.rkb-col-amber  { background: var(--rk-amber-glow); color: var(--rk-amber); }
.rkb-col-coral  { background: var(--rkb-coral2); color: var(--rkb-coral); }
.rkb-col-acc    { background: var(--rkb-acc2);   color: var(--rkb-acc); }
.rkb-col-green  { background: var(--rk-green-glow); color: var(--rk-green); }
.rkb-col-red    { background: var(--rk-red-glow);  color: var(--rk-red); }

.rkb-phase-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--rk-text);
}

.rkb-cc {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--rk-hint);
  margin-left: auto;
  margin-right: 6px;
  white-space: nowrap;
}

.rkb-chevron {
  font-size: 10px;
  color: var(--rk-hint);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.rkb-phase-btn.open .rkb-chevron { transform: rotate(180deg); }

/* ── PHASE BODY ── */
.rkb-phase-body {
  display: none;
  background: var(--rk-surface2);
  border: 1px solid rgba(255,255,255,0.1);
  border-top: none;
  border-bottom-left-radius: var(--rk-radius-sm);
  border-bottom-right-radius: var(--rk-radius-sm);
  padding: 14px;
  margin-bottom: 8px;
}

.rkb-phase-body.open {
  display: block;
  animation: rkSlideIn 0.15s ease-out;
}

/* ── CHECKLIST ── */
.rkb-chk-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rk-border);
  cursor: pointer;
  font-size: 12px;
  color: var(--rk-muted);
  line-height: 1.5;
}

.rkb-chk-item:last-of-type { border-bottom: none; }

.rkb-chk-item strong { color: var(--rk-text); font-weight: 500; }

.rkb-chk {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--rk-surface);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.15s;
  position: relative;
  margin-top: 2px;
}

.rkb-chk:checked { background: var(--rkb-acc); border-color: var(--rkb-acc); }
.rkb-chk:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-left: none;
  border-top: none;
  transform: rotate(45deg);
}

/* ── SUB DIVIDER ── */
.rkb-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--rk-hint);
  margin: 12px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rkb-sub::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rk-border);
}

/* ── CALC OUTPUT ── */
.rkb-calc-out {
  background: var(--rkb-acc3);
  border: 1px solid rgba(124,111,224,0.2);
  border-radius: var(--rk-radius-sm);
  padding: 9px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--rkb-acc);
  min-height: 38px;
  display: flex;
  align-items: center;
}

/* ── BOTÃO ADICIONAR PEÇA ── */
.rkb-btn-peca {
  background: rgba(246,173,85,0.12);
  border: 1px solid rgba(246,173,85,0.3);
  border-radius: var(--rk-radius-sm);
  color: var(--rk-amber);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 14px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
  margin-top: 8px;
}

.rkb-btn-peca:hover { background: rgba(246,173,85,0.2); }

/* ── COMPLEXIDADE ── */
.rkb-comp-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.rkb-comp-btn {
  padding: 8px;
  border: 1px solid var(--rk-border);
  border-radius: var(--rk-radius-sm);
  background: var(--rk-surface);
  color: var(--rk-muted);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}

.rkb-comp-simples { background: var(--rk-green-glow); border-color: rgba(104,211,145,0.4); color: var(--rk-green); }
.rkb-comp-media   { background: var(--rk-amber-glow); border-color: rgba(246,173,85,0.4);  color: var(--rk-amber); }
.rkb-comp-alta    { background: var(--rk-red-glow);   border-color: rgba(252,129,129,0.4); color: var(--rk-red); }

/* ── PROMPT CARD (coluna direita) ── */
.rkb-prompt-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom: 1px solid var(--rk-border);
}

.rkb-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(124,111,224,0.15);
  flex-shrink: 0;
}

.rkb-prompt-pulse {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--rkb-acc);
}

.rkb-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rkb-acc);
  animation: rkbPulse 2s infinite;
}

@keyframes rkbPulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.rkb-btn-copy {
  background: transparent;
  border: 1px solid var(--rk-border);
  border-radius: 6px;
  color: var(--rk-muted);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.rkb-btn-copy:hover { background: var(--rk-surface2); color: var(--rk-text); }

.rkb-prompt-body {
  flex: 1;
  padding: 12px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--rk-muted);
  line-height: 1.8;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.rkb-prompt-body::-webkit-scrollbar { width: 4px; }
.rkb-prompt-body::-webkit-scrollbar-track { background: transparent; }
.rkb-prompt-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* ── SEND FOOTER ── */
.rkb-send-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--rk-border);
  flex-wrap: wrap;
}

.rkb-completion-info {
  font-size: 11px;
  color: var(--rk-muted);
}

.rkb-btn-send {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #4c3f99, #7c6fe0);
  border: 1px solid rgba(124,111,224,0.4);
  border-radius: var(--rk-radius-sm);
  color: #e0dafb;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.rkb-btn-send:hover { filter: brightness(1.12); transform: translateY(-1px); }
.rkb-btn-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }

/* ── RESULTADO DA IA ── */
.rkb-ia-result-wrap {
  flex: 0 0 auto;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--rk-border);
}

.rkb-ia-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--rk-green);
  border-bottom: 1px solid var(--rk-border);
  flex-shrink: 0;
}

.rkb-ia-result-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  background: var(--rk-green-glow);
  color: var(--rk-green);
  border: 1px solid rgba(104,211,145,0.3);
  border-radius: 10px;
  padding: 2px 9px;
}

.rkb-ia-result-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--rk-text);
  white-space: pre-wrap;
  font-family: 'DM Mono', monospace;
}

.rkb-ia-result-body::-webkit-scrollbar { width: 4px; }
.rkb-ia-result-body::-webkit-scrollbar-track { background: transparent; }
.rkb-ia-result-body::-webkit-scrollbar-thumb { background: rgba(104,211,145,0.2); border-radius: 4px; }

.rkb-ia-result-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--rk-border);
  flex-shrink: 0;
}

.rkb-btn-apply {
  width: 100%;
  padding: 10px;
  background: var(--rk-green-glow);
  border: 1px solid rgba(104,211,145,0.4);
  border-radius: var(--rk-radius-sm);
  color: var(--rk-green);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.rkb-btn-apply:hover { background: rgba(104,211,145,0.22); }
.rkb-btn-apply:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── PEÇA CARD ── */
.rkb-peca-card {
  background: var(--rk-surface);
  border: 1px solid var(--rk-border);
  border-radius: var(--rk-radius-sm);
  padding: 10px;
  margin-bottom: 8px;
}

.rkb-peca-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rkb-peca-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--rk-amber);
}

.rkb-btn-remove-peca {
  background: var(--rk-red-glow);
  border: 1px solid rgba(252,129,129,0.3);
  border-radius: 4px;
  color: var(--rk-red);
  font-size: 10px;
  padding: 2px 8px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.rkb-btn-remove-peca:hover { background: rgba(252,129,129,0.25); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .rkb-layout { grid-template-columns: 1fr; }
  .rkb-prompt-col {
    border-left: none;
    border-top: 1px solid var(--rk-border);
    max-height: 320px;
  }
}
