/* === Variáveis de cor (IA Theme) === */
:root {
  --cpgf-primary: #6366f1;
  --cpgf-primary-hover: #4f46e5;
  --cpgf-ai-gradient: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
  --cpgf-bg: #0f172a;
  --cpgf-sidebar-bg: #1e293b;
  --cpgf-border: #334155;
  --cpgf-text-primary: #f8fafc;
  --cpgf-text-secondary: #94a3b8;
  --cpgf-message-bg-user: var(--cpgf-ai-gradient);
  --cpgf-message-bg-bot: #1e293b;
  --cpgf-glow: 0 0 15px rgba(99, 102, 241, 0.3);
}

/* === Reset básico e controle de scroll da página === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body.cpgf-split {
  overflow: auto;
  height: auto;
}

/* === Container principal === */
.cpgf-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  background: var(--cpgf-bg);
}

/* === Sidebar de sessões === */
.cpgf-sessions {
  width: 320px;
  background: var(--cpgf-sidebar-bg);
  border-right: 1px solid var(--cpgf-border);
  display: flex;
  flex-direction: column;
  padding-top: 20px;
}
.cpgf-sessions-header {
  position: relative;
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid var(--cpgf-border);
}
.cpgf-logo {
  position: relative;
  color: #fff;
  font-weight: bold;
  font-size: 1.5rem;
  margin-bottom: 12px;
  height: 60px;
  margin-top: -10px;
  max-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#cpgf-particles {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
.cpgf-logo svg.cpgf-ai-icon,
.cpgf-logo span {
  position: relative;
  z-index: 1;
  margin: 0 4px;
}
#cpgf-new-session {
  position: relative;
  z-index: 2;
  background: var(--cpgf-ai-gradient);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 12px;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}
#cpgf-new-session:hover {
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.cpgf-sessions-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--cpgf-primary) var(--cpgf-sidebar-bg);
}
.cpgf-sessions-list::-webkit-scrollbar {
  width: 8px;
}
.cpgf-sessions-list::-webkit-scrollbar-track {
  background: var(--cpgf-sidebar-bg);
  border-radius: 4px;
}
.cpgf-sessions-list::-webkit-scrollbar-thumb {
  background: var(--cpgf-primary);
  border-radius: 4px;
  border: 2px solid var(--cpgf-sidebar-bg);
}
.cpgf-sessions-list::-webkit-scrollbar-thumb:hover {
  background: var(--cpgf-primary-hover);
}
.cpgf-sessions-item {
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 6px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.cpgf-sessions-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--cpgf-glow);
}
.cpgf-sessions-item.active {
  background: var(--cpgf-primary);
  color: #fff;
}

/* === Prompt Counter === */
.cpgf-prompt-counter {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--cpgf-sidebar-bg);
  padding: 10px 30px 10px 15px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 1000;
  font-size: 0.9em;
  color: var(--cpgf-text-primary);
}
.cpgf-prompt-counter span {
  font-weight: bold;
  color: var(--cpgf-primary);
}
.cpgf-prompt-close {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 1.2em;
  color: var(--cpgf-text-primary);
  cursor: pointer;
}

/* === Oculta o painel de código até gerar === */
#cpgf-code-area {
  display: none;
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.cpgf-container.cpgf-split #cpgf-code-area {
  display: flex;
  flex-direction: column;
  width: 50%;
  order: 2;
}
.cpgf-container.cpgf-split .cpgf-sessions {
  display: none;
}

/* Botão fechar painel de código */
.cpgf-close-code {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--cpgf-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.cpgf-close-code:hover {
  background: var(--cpgf-primary-hover);
}

/* === Área do Chat === */
.cpgf-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.cpgf-chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--cpgf-border);
  background: var(--cpgf-bg);
}
.cpgf-chat-title {
  color: var(--cpgf-text-primary);
  font-weight: 600;
}
.cpgf-disclaimer {
  padding: 8px 24px;
  background: var(--cpgf-sidebar-bg);
  color: var(--cpgf-text-secondary);
  text-align: center;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--cpgf-border);
}

/* === Mensagens roláveis === */
.cpgf-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}
.cpgf-welcome {
  position: absolute;
  top: 25% !important; /* era 50%, agora mais acima */
  left: 50%;
  transform: translate(-50%, -35%);
  width: 100%;
  text-align: center;
  pointer-events: none;
}
.cpgf-welcome h2 {
  color: var(--cpgf-text-primary);
  font-size: 2.5rem; /* aumente conforme necessário */
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
}
.cpgf-welcome p {
  color: var(--cpgf-text-secondary);
  font-size: 1.2rem;
}

/* === Balões de mensagem === */
.cpgf-message {
  max-width: 75%;
  padding: 16px 20px;
  border-radius: 12px;
  line-height: 1.5;
  animation: cpgf-fadeIn 0.3s ease;
}
.cpgf-message.user {
  align-self: flex-end;
  background: var(--cpgf-message-bg-user);
  color: #fff;
  border-radius: 12px 12px 4px 12px;
}
.cpgf-message.bot {
  align-self: flex-start;
  position: relative;
  border: 1px solid var(--cpgf-border);
  box-shadow: var(--cpgf-glow);
  background-image:
    radial-gradient(circle at 100% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 20%),
    linear-gradient(to bottom right, #1e293b, #0f172a);
  color: var(--cpgf-text-primary);
  border-radius: 12px 12px 12px 4px;
}
.cpgf-message.bot::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(45deg,
    transparent 40%,
    rgba(99, 102, 241, 0.3) 50%,
    transparent 60%
  );
  animation: cpgf-scan 6s linear infinite;
  z-index: -1;
}

/* === Botão “Parar geração” === */
.cpgf-stop-container {
  padding: 0 24px;
  margin-bottom: 8px;
  text-align: Center;
  display: block;
}
.cpgf-stop-button {
  background: var(--cpgf-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.cpgf-stop-button:hover {
  background: var(--cpgf-primary-hover);
}

/* Spinner do botão “Parar geração” */
.cpgf-stop-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cpgf-spin 0.8s linear infinite;
}
@keyframes cpgf-spin {
  to { transform: rotate(360deg); }
}

/* === Input fixa embaixo === */
.cpgf-input-container {
  padding: 12px 24px;
  border-top: 1px solid var(--cpgf-border);
}
.cpgf-input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}
.cpgf-textarea {
  width: 100%;
  min-height: 180px;    /* altura mínima desejada */
  padding: 16px 48px 16px 20px;
  border: 1px solid var(--cpgf-border);
  border-radius: 24px;
  background: #1a1a1a;
  color: #fff;
}
.cpgf-textarea:focus {
  outline: none;
  border-color: var(--cpgf-primary);
  box-shadow: 0 0 0 3px rgba(45,106,226,0.1);
}
.cpgf-submit-button {
  position: absolute;
  right: 16px; bottom: 16px;
  width: 36px; height: 36px;
  background: var(--cpgf-primary);
  color: #fff;
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.cpgf-submit-button:hover {
  background: var(--cpgf-primary-hover);
}
.cpgf-spinner {
  position: absolute;
  right: 16px; bottom: 16px;
  width: 20px; height: 20px;
  border: 3px solid rgba(0,0,0,0.2);
  border-top-color: var(--cpgf-primary);
  border-radius: 50%;
  animation: cpgf-spin 1s linear infinite;
  display: none;
}

/* === Tabs de arquivos === */
.cpgf-tabs {
  display: flex;
  border-bottom: 1px solid var(--cpgf-border);
  background: var(--cpgf-sidebar-bg);
}
.cpgf-tab {
  padding: 8px 16px;
  cursor: pointer;
  color: var(--cpgf-text-secondary);
  border: 1px solid transparent;
  border-bottom: none;
  margin-right: 4px;
  border-radius: 6px 6px 0 0;
  background: var(--cpgf-sidebar-bg);
}
.cpgf-tab.active {
  background: var(--cpgf-bg);
  color: var(--cpgf-text-primary);
  border-color: var(--cpgf-border);
  border-bottom: 1px solid var(--cpgf-bg);
}

/* === Conteúdo das abas (código) === */
.cpgf-tab-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  padding: 16px;
  background: var(--cpgf-bg);
  color: var(--cpgf-text-primary);
  position: relative;
}

/* === Footer e link de download === */
.cpgf-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--cpgf-border);
  background: var(--cpgf-bg);
  text-align: right;
}
.cpgf-download-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--cpgf-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s;
}
.cpgf-download-button:hover {
  background: var(--cpgf-primary-hover);
}
.cpgf-download-button .dashicons {
  font-size: 1.2em;
  vertical-align: middle;
}

/* === Animações gerais === */
@keyframes cpgf-fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cpgf-scan {
  0% { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

/* === Tipagem futurista === */
.cpgf-typing-indicator {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid var(--cpgf-border);
  border-radius: 15px;
  padding: 15px;
  backdrop-filter: blur(5px);
  color: #fff !important;
}
.cpgf-typing-dot {
  width: 8px; height: 8px;
  background: var(--cpgf-ai-gradient);
  border-radius: 50%;
  display: inline-block;
  margin: 0 4px;
  animation: cpgf-pulse 1.4s infinite ease-in-out;
}
@keyframes cpgf-pulse {
  0%, 80%, 100% { transform: scale(0.6); }
  40% { transform: scale(1); }
}

/* === Responsividade Mobile === */
@media (max-width: 768px) {
  /* .cpgf-sessions { display: none; }  -- agora gerenciado pelo off-canvas */
  .cpgf-container { flex-direction: column; height: 100vh; }
  .cpgf-chat-area { flex: 1; overflow-y: auto; }
}

/* === MOBILE MENU OFF-CANVAS === */
.cpgf-mobile-menu-button,
.cpgf-mobile-close-button {
  display: none;
  background: none;
  border: none;
  color: var(--cpgf-primary);
  font-size: 1.5rem;
  cursor: pointer;
}
@media (max-width: 768px) {
  /* mostra o toggle ao lado do título */
  .cpgf-mobile-menu-button {
    display: inline-flex;
    margin-right: 10px;
  }
  /* close dentro da sidebar */
  .cpgf-mobile-close-button {
    display: inline-flex;
    position: absolute;
    top: 16px;
    right: 16px;
    color: var(--cpgf-text-primary);
    z-index: 1100;
  }
  /* sidebar off-canvas */
  .cpgf-sessions {
    position: fixed;
    top: 0; left: 0;
    width: 80%;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
  }
  /* overlay parcial — cobre só a área *fora* da sidebar */
.cpgf-mobile-overlay {
  position: fixed;
  top: 0; 
  left: 80%;                /* começa onde termina a sidebar */
  width: 20%;               /* cobre só 20% restantes */
  height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
}

/* quando aberto — sidebar acima do overlay */
.cpgf-container.mobile-open .cpgf-sessions {
  transform: translateX(0);
  z-index: 1050;            /* garante que fique acima do overlay */
}

  /* força o container ocupar 100vh no mobile e o chat flex-grow */
  .cpgf-container {
    height: 100vh;
    flex-direction: column;
  }
  .cpgf-container:not(.cpgf-split) .cpgf-chat-area {
    flex: 1;
    overflow-y: auto;
  }
}

/* === Highlight.js (tema noturno) === */
.hljs {
  background: #0b1021 !important;
  border-radius: 8px;
  padding: 1em !important;
  border: 1px solid #1a2139;
}
.hljs-keyword { color: #ff79c6 !important; }
.hljs-function { color: #50fa7b !important; }
.hljs-attr     { color: #bd93f9 !important; }
.hljs-string   { color: #f1fa8c !important; }

/* === NOVOS COMPONENTES === */
/* Toggle buttons */
.cpgf-code-toggle {
  padding: 10px 24px;
  background: var(--cpgf-sidebar-bg);
  border-bottom: 1px solid var(--cpgf-border);
  text-align: right;
}
.cpgf-toggle-btn {
  background: var(--cpgf-primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  margin-left: 8px;
  cursor: pointer;
  font-size: 0.9em;
}
.cpgf-toggle-btn:hover {
  background: var(--cpgf-primary-hover);
}

/* Contextual tips */
.cpgf-code-tip {
  position: relative;
  padding: 12px;
  margin: 10px 0;
  background: rgba(99, 102, 241, 0.1);
  border-left: 4px solid var(--cpgf-primary);
}
.cpgf-code-tip::before {
  content: '💡';
  margin-right: 8px;
}

/* Onboarding steps */
.cpgf-onboarding {
  background: rgba(255,255,255,0.05);
  padding: 20px;
  margin: 15px;
  border-radius: 8px;
  color: #ffffff !important;
}
.cpgf-onboarding h3,
.cpgf-onboarding .cpgf-step {
  color: #ffffff !important;
}
.cpgf-step {
  margin: 8px 0;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Preview section */
.cpgf-preview {
  padding: 20px;
  background: #1a1f2f;
  margin: 15px;
  border-radius: 8px;
}

/* Code area hierarchy */
.cpgf-code-area {
  border-left: 1px solid var(--cpgf-border);
  background: #0b0f1a;
  box-shadow: -5px 0 15px rgba(0,0,0,0.3);
}

/* Feedback Visual Durante Geração */
.cpgf-gen-progress {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 15px;
}
.cpgf-gen-progress .cpgf-progress-bar {
  height: 4px;
  background: var(--cpgf-primary);
  transition: width 0.3s ease;
  margin-bottom: 15px;
}
.cpgf-step-done {
  padding: 8px;
  margin: 5px 0;
  background: linear-gradient(90deg, rgba(99,102,241,0.1) 0%, transparent 100%);
  border-left: 3px solid var(--cpgf-primary);
  opacity: 0;
  animation: cpgf-step-appear 0.3s forwards;
}
@keyframes cpgf-step-appear {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Validação em Tempo Real */
.cpgf-char-counter {
  position: absolute;
  right: 70px;
  bottom: 25px;
  color: var(--cpgf-text-secondary);
  font-size: 0.8em;
}
#cpgf-description.valid {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16,185,129,0.1);
}
#cpgf-description.invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,0.1);
}

/* Undo Avançado */
.cpgf-undo-alert {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--cpgf-bg);
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  display: flex; gap: 15px; align-items: center;
  z-index: 1000;
}
.cpgf-undo-btn {
  background: var(--cpgf-primary);
  border: none; color: #fff;
  padding: 6px 12px; border-radius: 4px;
  cursor: pointer; transition: background 0.2s;
}
.cpgf-undo-btn:hover {
  background: var(--cpgf-primary-hover);
}

/* Botões e seção de edição via IA */
.cpgf-edit-button,
.cpgf-upgrade-button,
.cpgf-edit-apply-button {
  display: inline-flex;
  align-items: center; gap: 6px;
  background: var(--cpgf-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s;
  border: none;
  cursor: pointer;
}
.cpgf-edit-button:hover:not(:disabled),
.cpgf-upgrade-button:hover,
.cpgf-edit-apply-button:hover {
  background: var(--cpgf-primary-hover);
}
.cpgf-edit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.cpgf-free-notice {
  color: var(--cpgf-text-secondary);
  margin-top: 8px;
}
.cpgf-edit-section {
  margin-top: 12px;
}
.cpgf-edit-container {
  padding: 16px;
  background: var(--cpgf-sidebar-bg);
  border-top: 1px solid var(--cpgf-border);
}
.cpgf-edit-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--cpgf-border);
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
}
.cpgf-edit-spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(0,0,0,0.2);
  border-top-color: var(--cpgf-primary);
  border-radius: 50%;
  animation: cpgf-spin 1s linear infinite;
  display: none;
  margin-left: 8px;
  vertical-align: middle;
}

/* Modal de Histórico e Diff */
.cpgf-modal {
  position: fixed;
  top: 10%; left: 50%;
  transform: translateX(-50%);
  background: var(--cpgf-sidebar-bg);
  color: var(--cpgf-text-primary);
  padding: 20px;
  border-radius: 8px;
  z-index: 9999;
  max-height: 80%;
  overflow: auto;
  width: 80%;
}
.cpgf-modal h3 { margin-bottom: 12px; }
.cpgf-modal ul { list-style: none; padding: 0; margin-bottom: 12px; }
.cpgf-modal li { margin: 8px 0; }
.cpgf-modal button {
  margin: 8px 4px;
  background: var(--cpgf-primary);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.cpgf-modal button:hover { background: var(--cpgf-primary-hover); }
.cpgf-modal pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--cpgf-bg);
  padding: 10px;
  border-radius: 4px;
  border: 1px solid var(--cpgf-border);
  margin-bottom: 16px;
}

/* Diff visual */
.diff-add {
  background: rgba(40, 167, 69, 0.2);
  display: inline-block;
  width: 100%;
}
.diff-del {
  background: rgba(220, 53, 69, 0.2);
  text-decoration: line-through;
  display: inline-block;
  width: 100%;
}

/* Corrige cor dos passos de progresso */
.cpgf-gen-progress,
.cpgf-gen-progress .cpgf-step-container,
.cpgf-gen-progress .cpgf-step-done {
  color: var(--cpgf-text-primary);
}

/* === CodeMirror Custom Styles === */
.CodeMirror {
    height: 100% !important;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    padding: 15px;
    background: #0b0f1a !important;
}
.CodeMirror-gutters {
    background: #0b0f1a !important;
    border-right: 1px solid #1a2139 !important;
}
.CodeMirror-linenumber {
    color: #4a5568 !important;
}
.CodeMirror-activeline-background {
    background: rgba(99, 102, 241, 0.05) !important;
}
.cm-s-dracula .CodeMirror-selected {
    background: #3a3f5b !important;
}
.CodeMirror {
  transition: all 0.3s ease-in-out;
}
.cm-tab {
  transition: transform 0.2s ease;
}
.CodeMirror-activeline-background {
  background: linear-gradient(90deg, rgba(99,102,241,0.1) 0%, transparent 100%) !important;
}
/* Faz o conteúdo das abas ocupar 100% em altura */
.cpgf-container.cpgf-split #cpgf-code-area {
  display: flex;
  flex-direction: column;
}
/* Transformamos a área de conteúdo das abas em flex container */
.cpgf-tab-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Cada div interna (pane de arquivo) cresce para preencher o espaço */
.cpgf-tab-content > div {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
/* Já garantimos que o próprio CodeMirror preencha 100% da altura */
.CodeMirror {
  height: 100% !important;
}



/* === Conta no rodapé da sidebar === */
.cpgf-account {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--cpgf-border);
  display: flex;
  align-items: center;
  position: relative;
}
.cpgf-account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 10px;
}
.cpgf-account-name {
  color: var(--cpgf-text-primary);
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cpgf-account-toggle {
  background: none;
  border: none;
  color: var(--cpgf-text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
}

/* menu dropdown */
.cpgf-account-menu {
  position: absolute;
  bottom: 60px;        /* fica logo acima do rodapé */
  left: 20px;
  background: var(--cpgf-sidebar-bg);
  border: 1px solid var(--cpgf-border);
  border-radius: 6px;
  box-shadow: var(--cpgf-glow);
  list-style: none;
  padding: 0;
  margin: 0;
  width: 200px;
  display: none;
  z-index: 1100;
}
.cpgf-account-menu li {
  border-bottom: 1px solid var(--cpgf-border);
}
.cpgf-account-menu li:last-child {
  border-bottom: none;
}
.cpgf-account-menu a {
  display: block;
  padding: 10px 15px;
  color: var(--cpgf-text-primary);
  text-decoration: none;
}
.cpgf-account-menu a:hover {
  background: var(--cpgf-border);
}

/* assegura no mobile (sidebar off-canvas) */
@media (max-width: 768px) {
  .cpgf-account {
    padding: 20px;
  }
  .cpgf-account-menu {
    bottom: auto;
    top: 60px;
    left: 20px;
  }
}

.cpgf-circle-loader {
  width: 24px;
  height: 24px;
  display: inline-block;
}

.cpgf-circle-loader svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cpgf-circle-fg {
  stroke: var(--cpgf-primary);
  stroke-width: 3;
  fill: none;
}



.cpgf-upgrade-banner-btn {
  padding: 8px 16px;
  background: transparent;
  border: 2px solid #fff;
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}
.cpgf-upgrade-banner-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}


/* === Modal de Acesso Restrito — Estilo Customizado === */
.cpgf-modal {
  /* largura fixa com responsividade */
  width: 600px;
  max-width: 95%;
  padding: 30px;
  background: #1a1f2f;                      /* tom escuro próximo ao tema */
  border: 2px solid #6366f1;                /* borda roxa */
  box-shadow: 0 8px 30px rgba(99,102,241,0.4);
  border-radius: 12px;
  color: #f8fafc;                           /* texto claro */
  top: 15%;                                 /* posicionamento vertical */
}

/* Título do modal */
.cpgf-modal h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: #ffffff;
}

/* Parágrafo de instrução */
.cpgf-modal p {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Botão principal (login/registro) */
.cpgf-modal .cpgf-login-button {
  display: inline-block;
  background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
  color: #fff;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

/* Hover do botão */
.cpgf-modal .cpgf-login-button:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  transform: translateY(-2px);
}



/* === Mobile: fullscreen para o painel de código === */
@media (max-width: 768px) {
  /* Quando estiver no modo “split” (código aberto) */
  .cpgf-container.cpgf-split #cpgf-code-area {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2000 !important;
    overflow-y: auto !important;
    background: var(--cpgf-bg) !important;
  }
  /* Esconder o sidebar e o chat por baixo do código */
  .cpgf-container.cpgf-split .cpgf-sessions,
  .cpgf-container.cpgf-split .cpgf-chat-area {
    display: none !important;
  }
}


.cpgf-examples-wrapper {
  margin: 10px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.6s ease-in-out;
}

.cpgf-examples-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
  padding-left: 10px;
}

.cpgf-plugin-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.cpgf-plugin-example {
  background: linear-gradient(135deg, #1f2937, #111827);
  border: 1px solid #333;
  border-radius: 14px;
  padding: 16px 20px;
  min-width: 160px;
  text-align: center;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  transform: perspective(800px) rotateX(0deg);
}
.cpgf-plugin-example:hover {
  transform: perspective(800px) rotateX(4deg) translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  background: linear-gradient(135deg, #4338ca, #1e40af);
}

.cpgf-plugin-example .cpgf-icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.cpgf-plugin-example .cpgf-title {
  font-weight: 500;
  font-size: 0.95rem;
}

/* Animação inicial */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  } to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Container do slider: alinha nav + conteúdo */
.cpgf-examples-slider {
  display: flex;
  align-items: center;
}

/* Botões de navegação (prev/next) */
.cpgf-ex-nav {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cpgf-ex-nav:hover {
  background: rgba(255,255,255,0.2);
}


/* Força uma única linha e habilita scroll suave */
.cpgf-plugin-examples {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 16px;             /* mantém seu espaçamento */
  padding: 8px 0;        /* um pouco de “respiro” vertical */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}
.cpgf-plugin-examples::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

/* Cada card fixa o início como ponto de snap */
.cpgf-plugin-example {
  flex: 0 0 auto;
  scroll-snap-align: start;
}



@media (max-width: 768px) {
  .cpgf-examples-wrapper {
    display: none !important;
  }
}



/* 1) box-sizing para todo o CSS */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 2) container agora usa 100% em vez de 100vw/100vh */
.cpgf-container {
  display: flex;
  width: 100%;
  height: 100%;
}

/* 3) sidebar responsiva */
.cpgf-sessions {
  width: clamp(180px, 18%, 300px);
  flex: 0 0 auto;
}

/* 4) chat-area preenche o resto */
.cpgf-chat-area {
  flex: 1 1 auto;
  min-width: 0;
}

/* 5) garantir que o header não estoure por causa do botão */
.cpgf-chat-header > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* (opcional) ajuste fino no padding do botão de upgrade */
.cpgf-upgrade-banner-btn {
  padding: 6px 12px;
  white-space: nowrap;
}


/* Garante que o botão seja flex e o ícone fique centralizado */
.cpgf-submit-button {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ajusta o tamanho do ícone dentro do botão */
.cpgf-submit-button .dashicons {
  font-size: 20px;   /* ajuste conforme sua preferência */
  line-height: 1;
}
