/* AI Content Writer - Tool Styles */

.tool-section {
  --cw-bg:       #ffffff;
  --cw-bg2:      #f8f9fb;
  --cw-bg3:      #eef0f4;
  --cw-border:   #e5e7eb;
  --cw-text:     #111827;
  --cw-muted:    #6b7280;
  --cw-faint:    #9ca3af;

  /* Step palette */
  --cw-step0-bg:    #534AB7;
  --cw-step0-light: #EEEDFE;
  --cw-step0-text:  #3C3489;

  --cw-step1-bg:    #0F6E56;
  --cw-step1-light: #E1F5EE;
  --cw-step1-text:  #085041;

  --cw-step2-bg:    #185FA5;
  --cw-step2-light: #E6F1FB;
  --cw-step2-text:  #0C447C;

  --cw-step3-bg:    #993C1D;
  --cw-step3-light: #FAECE7;
  --cw-step3-text:  #712B13;

  --cw-step4-bg:    #3B6D11;
  --cw-step4-light: #EAF3DE;
  --cw-step4-text:  #27500A;
}

/* ---- Shell ---- */
.cw-shell {
  max-width: 1100px;
  margin: 0 auto;
  font-family: Heebo, Arial, sans-serif;
}

/* ---- Header card ---- */
.cw-header {
  background: linear-gradient(135deg, #534AB7 0%, #185FA5 100%);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.cw-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cw-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cw-header-title {
  font-weight: 600;
  font-size: 17px;
  color: white;
  margin: 0;
  line-height: 1.3;
}

.cw-header-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
}

.cw-header-reset {
  background: rgba(255,255,255,0.18);
  border: none;
  color: white;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: Heebo, Arial, sans-serif;
  transition: background 0.15s;
}

.cw-header-reset:hover {
  background: rgba(255,255,255,0.28);
}

/* ---- Step indicator ---- */
.cw-steps {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  background: var(--cw-bg2);
  border-radius: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--cw-border);
  overflow-x: auto;
}

.cw-step-item {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.cw-step-item:last-child {
  flex: none;
}

.cw-step-inner {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.cw-step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.3s;
}

.cw-step-label {
  font-size: 12px;
  font-weight: 400;
  transition: color 0.3s;
}

.cw-step-connector {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  margin: 0 10px;
  transition: background 0.3s;
  min-width: 16px;
}

/* ---- Config toggle button ---- */
.cw-config-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border: 1.5px solid var(--cw-border);
  border-radius: 14px;
  margin-bottom: 12px;
  background: var(--cw-bg);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}

.cw-config-toggle:hover {
  border-color: #c7d2fe;
  box-shadow: 0 1px 6px rgba(99,102,241,0.08);
}

.cw-config-toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cw-config-toggle-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #eef2ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cw-config-toggle-label {
  font-size: 13px;
  font-weight: 500;
}

.cw-config-toggle-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Panel ---- */
.cw-panel {
  background: var(--cw-bg);
  border-radius: 14px;
  border: 1.5px solid var(--cw-border);
  margin-bottom: 18px;
  overflow: hidden;
}

.cw-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1.5px solid var(--cw-border);
}

.cw-panel-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cw-panel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.cw-panel-title {
  font-size: 13px;
  font-weight: 500;
}

.cw-panel-badge {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  color: white;
}

.cw-panel-body {
  padding: 16px;
}

/* ---- Form controls ---- */
.cw-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-bottom: 5px;
}

.cw-group {
  margin-bottom: 16px;
}

.cw-input,
.cw-select,
.cw-textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 8px;
  border: 1.5px solid var(--cw-border);
  background: var(--cw-bg);
  color: var(--cw-text);
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  font-family: Heebo, Arial, sans-serif;
  transition: border-color 0.2s;
}

.cw-input:focus,
.cw-select:focus,
.cw-textarea:focus {
  border-color: var(--blue-35, #a6cbff);
  box-shadow: 0 0 0 3px rgba(0,106,255,0.09);
}

.cw-textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.65;
}

.cw-select {
  cursor: pointer;
}

.cw-col2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

@media (max-width: 540px) {
  .cw-col2 {
    grid-template-columns: 1fr;
  }
}

.cw-hint {
  font-size: 11px;
  color: var(--cw-faint);
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cw-hint a,
.cw-hint-link {
  font-size: 11px;
  color: #A32D2D;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
}

.cw-divider {
  border: none;
  border-top: 1.5px solid var(--cw-border);
  margin: 4px 0 18px;
}

/* ---- Provider buttons ---- */
.cw-provider-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cw-provider-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  border: 1.5px solid var(--cw-border);
  background: var(--cw-bg);
  color: var(--cw-muted);
  cursor: pointer;
  font-weight: 400;
  font-family: Heebo, Arial, sans-serif;
  transition: all 0.15s;
}

.cw-provider-btn.active {
  background: #534AB7;
  border-color: #534AB7;
  color: white;
  font-weight: 500;
}

/* ---- Buttons ---- */
.cw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: Heebo, Arial, sans-serif;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.cw-btn:hover:not(:disabled) {
  opacity: 0.88;
}

.cw-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cw-btn-primary {
  background: #534AB7;
  color: white;
}

.cw-btn-secondary {
  background: #EF9F27;
  color: white;
}

.cw-btn-ghost {
  background: transparent;
  border: 1.5px solid var(--cw-border);
  color: var(--cw-muted);
  padding: 6px 14px;
  font-size: 12px;
}

.cw-btn-sm {
  padding: 3px 10px;
  font-size: 11px;
  background: transparent;
  border: 1.5px solid #534AB7;
  color: #534AB7;
  border-radius: 6px;
  cursor: pointer;
  font-family: Heebo, Arial, sans-serif;
  font-weight: 500;
}

.cw-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---- Error box ---- */
.cw-error {
  font-size: 13px;
  color: #A32D2D;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #FCEBEB;
  border-radius: 8px;
}

/* ---- Loading dots ---- */
.cw-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
}

.cw-dots {
  display: flex;
  gap: 5px;
}

.cw-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #534AB7;
  animation: cwPulse 1.2s ease-in-out infinite;
}

.cw-dot:nth-child(2) { animation-delay: 0.2s; }
.cw-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes cwPulse {
  0%, 100% { opacity: 0.2; }
  50%       { opacity: 1; }
}

.cw-loading-label {
  font-size: 13px;
  color: var(--cw-muted);
}

/* ---- Output text ---- */
.cw-output {
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--cw-text);
  white-space: pre-wrap;
  max-height: 460px;
  overflow-y: auto;
  padding: 4px 0;
  word-break: break-word;
}

.cw-output a {
  color: #185FA5;
  word-break: break-all;
  font-weight: 500;
}

/* ---- Sources list ---- */
.cw-sources {
  margin-top: 14px;
  padding-top: 14px;
}

.cw-sources-title {
  font-size: 11px;
  font-weight: 600;
  color: #185FA5;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cw-source-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: flex-start;
}

.cw-source-num {
  font-size: 11px;
  color: white;
  background: #185FA5;
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
  margin-top: 1px;
}

.cw-source-title {
  font-size: 12px;
  color: #185FA5;
  text-decoration: none;
  font-weight: 500;
}

.cw-source-title:hover {
  text-decoration: underline;
}

.cw-source-url {
  font-size: 11px;
  color: var(--cw-faint);
  word-break: break-all;
}

/* ---- Panel action area ---- */
.cw-panel-actions {
  margin-top: 14px;
  padding-top: 14px;
}

/* ---- Revision input ---- */
.cw-revision-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  align-items: center;
}

.cw-revision-row .cw-input {
  flex: 1;
}

/* ---- Info text ---- */
.cw-info {
  font-size: 13px;
  margin: 0 0 10px;
}

/* ---- Intro note ---- */
.cw-intro-note {
  font-size: 13px;
  margin: 0 0 16px;
}

/* ---- Model load button row ---- */
.cw-model-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.cw-model-error {
  font-size: 11px;
  color: #A32D2D;
  margin-bottom: 6px;
}

.cw-model-hint {
  font-size: 12px;
  color: var(--cw-faint);
  padding: 8px 0;
}

.cw-model-tip {
  font-size: 11px;
  color: var(--cw-faint);
  margin-top: 5px;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .cw-header {
    padding: 16px;
  }
  .cw-header-title {
    font-size: 15px;
  }
  .cw-panel-body {
    padding: 12px;
  }
  .cw-steps {
    padding: 10px 12px;
  }
}

/* ---- Informational content card ---- */
#cwContent.content-card {
  margin-top: 100px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#cwContent.content-card h2 {
  margin: 0 0 12px;
  color: #000000;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 700;
}

#cwContent.content-card h3 {
  margin: 18px 0 8px;
  color: #000000;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
}

#cwContent.content-card p {
  margin: 0 0 12px;
  color: #000000;
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
}

#cwContent.content-card ol,
#cwContent.content-card ul {
  margin: 0 0 12px;
  padding-left: 26px;
  list-style-position: outside;
  color: #000000;
  line-height: 1.55;
}

#cwContent.content-card ul {
  list-style: disc;
}

#cwContent.content-card ol {
  list-style: decimal;
}

#cwContent.content-card li {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
  display: list-item;
  padding-left: 6px;
}
