/* ===== KELLEY AI ASSISTANT ===== */

/* Topbar button */
.kelley-btn {
  display: none;
  align-items: center; gap: 6px;
  background: var(--ncl-pink); color: #fff;
  border: none; border-radius: 8px;
  padding: 7px 15px; font-size: 8.5pt;
  font-family: inherit; letter-spacing: 0.04em;
  cursor: pointer; transition: background 0.15s;
  white-space: nowrap; line-height: 1;
}
.kelley-btn:hover { background: var(--ncl-pink-d9); }
.kelley-btn.visible { display: inline-flex; }

/* Overlay + box */
.kelley-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,102,0.6);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.kelley-overlay.open { opacity: 1; pointer-events: all; }

.kelley-box {
  background: #fff; border-radius: 16px;
  width: min(1080px, 97vw); height: min(780px, 92vh);
  display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,102,0.35);
  transform: translateY(20px); transition: transform 0.22s;
  overflow: hidden;
}
.kelley-overlay.open .kelley-box { transform: translateY(0); }

/* Header */
.kelley-header {
  background: var(--ncl-navy);
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; gap: 12px;
}
.kelley-header-left { display: flex; flex-direction: column; }
.kelley-name {
  font-family: var(--font-display);
  font-size: 17pt; color: var(--ncl-pink);
  letter-spacing: 0.1em; line-height: 1;
}
.kelley-tagline { font-size: 7pt; color: rgba(255,255,255,0.55); margin-top: 2px; letter-spacing: 0.04em; }
.kelley-header-right { display: flex; align-items: center; gap: 5px; }

.kelley-tab-btn {
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.65);
  border: none; border-radius: 6px; padding: 6px 12px;
  font-size: 8pt; font-family: inherit; cursor: pointer;
  transition: background 0.15s; letter-spacing: 0.03em;
  white-space: nowrap;
}
.kelley-tab-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
.kelley-tab-btn.active { background: var(--ncl-pink); color: #fff; }

.kelley-close {
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%; font-size: 16pt;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; flex-shrink: 0; margin-left: 4px;
}
.kelley-close:hover { background: rgba(255,255,255,0.28); }

/* Pane base */
.kelley-pane { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }

/* ── Generate pane ── */
.kelley-body {
  display: grid; grid-template-columns: 320px 1fr;
  flex: 1; overflow: hidden; min-height: 0;
}

.kelley-input-panel {
  padding: 16px 18px; overflow-y: auto;
  border-right: 1px solid var(--ncl-blue-f2);
  display: flex; flex-direction: column; gap: 13px;
}

.kelley-output-panel { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

.kelley-output-header {
  padding: 9px 18px; border-bottom: 1px solid var(--ncl-blue-f2);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; gap: 8px;
}
.kelley-output-label {
  font-family: var(--font-display); font-size: 8pt;
  color: var(--ncl-navy); letter-spacing: 0.1em; text-transform: uppercase;
}
.kelley-output-actions { display: flex; gap: 6px; }
.kelley-action-btn {
  font-size: 7.5pt; padding: 4px 11px; border-radius: 5px;
  border: 1px solid var(--ncl-blue-a6); background: #fff;
  color: var(--ncl-navy); cursor: pointer; font-family: inherit;
  transition: all 0.12s;
}
.kelley-action-btn:hover { border-color: var(--ncl-navy); }
.kelley-action-drive { color: #1a73e8; }
.kelley-action-drive:hover { border-color: #1a73e8; }
.kelley-action-clear { color: #bbb; }
.kelley-action-clear:hover { color: #c0392b; border-color: #c0392b; }

.kelley-output {
  flex: 1; overflow-y: auto; padding: 18px 20px;
  background: #fafbff; min-height: 0;
}
.kelley-output-text {
  white-space: pre-wrap; word-break: break-word;
  font-size: 9pt; line-height: 1.7; color: #1a1a2e;
  font-family: inherit;
}

.kelley-placeholder {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; min-height: 180px;
  color: var(--ncl-blue-a6); text-align: center; gap: 10px;
}
.kelley-placeholder-icon { font-size: 26pt; opacity: 0.5; }
.kelley-placeholder-text { font-size: 8.5pt; max-width: 240px; line-height: 1.55; }

.kelley-generating {
  font-size: 8pt; color: var(--ncl-pink); margin-top: 4px;
  animation: kelley-pulse 1.4s ease-in-out infinite;
}
@keyframes kelley-pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* Field labels */
.kelley-field-label {
  font-size: 7pt; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ncl-blue-59); font-weight: bold; margin-bottom: 7px;
}
.kelley-optional { font-weight: normal; text-transform: none; color: var(--ncl-blue-a6); letter-spacing: 0; }

/* Select */
.kelley-select {
  width: 100%; border: 1.5px solid var(--ncl-blue-a6); border-radius: 8px;
  padding: 8px 10px; font-size: 8.5pt; font-family: inherit;
  color: var(--ncl-navy); background: #fff; outline: none;
  transition: border-color 0.15s; cursor: pointer;
}
.kelley-select:focus { border-color: var(--ncl-navy); }

/* Textareas */
.kelley-request-input, .kelley-names-input {
  width: 100%; border: 1.5px solid var(--ncl-blue-a6); border-radius: 8px;
  padding: 9px 11px; font-size: 8.5pt; font-family: inherit;
  color: #1a1a2e; background: #fff; outline: none; resize: vertical;
  transition: border-color 0.15s; line-height: 1.5;
}
.kelley-request-input:focus, .kelley-names-input:focus { border-color: var(--ncl-navy); }

/* Content type grid */
.kelley-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.kelley-type-btn {
  padding: 7px 9px; border: 1.5px solid var(--ncl-blue-a6);
  border-radius: 8px; background: #fff; font-size: 7.5pt;
  font-family: inherit; color: var(--ncl-blue-59); cursor: pointer;
  text-align: left; transition: all 0.12s; line-height: 1.3;
}
.kelley-type-btn .kt-icon { font-size: 12pt; display: block; margin-bottom: 2px; }
.kelley-type-btn:hover { border-color: var(--ncl-blue-73); color: var(--ncl-navy); }
.kelley-type-btn.active {
  border-color: var(--ncl-pink); background: var(--ncl-pink-f7);
  color: var(--ncl-navy); font-weight: bold;
}

/* Platform row */
.kelley-platform-row { display: flex; gap: 6px; flex-wrap: wrap; }
.kelley-plat-opt {
  display: flex; align-items: center; gap: 3px;
  font-size: 7.5pt; color: var(--ncl-navy); cursor: pointer;
  padding: 4px 10px; border: 1.5px solid var(--ncl-blue-a6);
  border-radius: 20px; transition: all 0.12s; user-select: none;
}
.kelley-plat-opt:has(input:checked) { border-color: var(--ncl-pink); background: var(--ncl-pink-f7); font-weight: bold; }
.kelley-plat-opt input { display: none; }

/* Style indicator */
.kelley-style-indicator {
  display: flex; align-items: center; gap: 7px;
  font-size: 7.5pt; color: var(--ncl-blue-59);
  background: var(--ncl-blue-f2); border-radius: 7px;
  padding: 7px 10px;
}
.kelley-style-dot { width: 7px; height: 7px; border-radius: 50%; background: #27ae60; flex-shrink: 0; }
.kelley-style-dot.none { background: var(--ncl-blue-a6); }
.kelley-style-edit-btn {
  background: none; border: none; color: var(--ncl-pink);
  font-size: 7.5pt; cursor: pointer; font-family: inherit;
  padding: 0; margin-left: auto; text-decoration: underline;
}

/* Generate button */
.kelley-generate-btn {
  width: 100%; background: var(--ncl-navy); color: #fff;
  border: none; border-radius: 10px; padding: 12px;
  font-family: var(--font-display); font-size: 11pt;
  letter-spacing: 0.08em; cursor: pointer;
  transition: background 0.15s; margin-top: auto;
}
.kelley-generate-btn:hover { background: var(--ncl-blue-40); }
.kelley-generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── History pane ── */
.kelley-history-panel { flex: 1; overflow-y: auto; padding: 16px 20px; }
.kelley-hist-item {
  border: 1.5px solid var(--ncl-blue-f2); border-radius: 10px;
  padding: 11px 14px; margin-bottom: 9px; cursor: pointer;
  transition: border-color 0.12s;
}
.kelley-hist-item:hover { border-color: var(--ncl-blue-a6); }
.kelley-hist-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.kelley-hist-type {
  font-size: 6.5pt; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: bold; background: var(--ncl-blue-f2); color: var(--ncl-blue-59);
  padding: 2px 8px; border-radius: 10px;
}
.kelley-hist-date { font-size: 7pt; color: #999; margin-left: auto; }
.kelley-hist-prompt {
  font-size: 8pt; color: #444; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kelley-hist-response {
  white-space: pre-wrap; font-size: 8pt; color: #1a1a2e;
  margin-top: 10px; line-height: 1.65; padding-top: 10px;
  border-top: 1px solid var(--ncl-blue-f2);
}
.kelley-hist-row-actions { display: flex; gap: 6px; margin-top: 8px; }
.kelley-hist-empty {
  text-align: center; color: #bbb; padding: 48px 20px;
  font-size: 8.5pt; line-height: 1.6;
}

/* ── Style wizard pane ── */
.kelley-style-panel { flex: 1; overflow-y: auto; padding: 20px 26px; }
.kelley-pane-title {
  font-family: var(--font-display); font-size: 12pt; color: var(--ncl-navy);
  letter-spacing: 0.06em; margin-bottom: 5px;
}
.kelley-style-intro { font-size: 8.5pt; color: #666; margin-bottom: 20px; line-height: 1.55; }
.kelley-wiz-q { margin-bottom: 18px; }
.kelley-wiz-label { font-size: 8.5pt; font-weight: bold; color: var(--ncl-navy); margin-bottom: 8px; }
.kelley-wiz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kelley-wiz-opt {
  display: flex; align-items: flex-start; gap: 8px;
  border: 1.5px solid var(--ncl-blue-a6); border-radius: 9px;
  padding: 9px 12px; cursor: pointer; transition: all 0.12s; user-select: none;
}
.kelley-wiz-opt:has(input:checked) { border-color: var(--ncl-pink); background: var(--ncl-pink-f7); }
.kelley-wiz-opt input { display: none; }
.kelley-wiz-opt strong { display: block; font-size: 8pt; color: var(--ncl-navy); }
.kelley-wiz-opt small { font-size: 7pt; color: #888; }
.kelley-wiz-input, .kelley-wiz-textarea {
  width: 100%; border: 1.5px solid var(--ncl-blue-a6); border-radius: 8px;
  padding: 9px 11px; font-size: 8.5pt; font-family: inherit;
  color: #1a1a2e; outline: none; transition: border-color 0.15s;
  resize: vertical; line-height: 1.5; background: #fff;
}
.kelley-wiz-input:focus, .kelley-wiz-textarea:focus { border-color: var(--ncl-navy); }
.kelley-wiz-save-row {
  display: flex; align-items: center; gap: 14px;
  margin-top: 8px; padding-top: 16px;
  border-top: 1px solid var(--ncl-blue-f2);
}
.kelley-wiz-status { font-size: 8.5pt; color: #27ae60; flex: 1; }

/* ── Access panel ── */
.kelley-access-panel { flex: 1; overflow-y: auto; padding: 20px 26px; }
.kelley-access-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 9px; margin-bottom: 6px;
  background: #fafbff; border: 1px solid var(--ncl-blue-f2);
}
.kelley-access-info { flex: 1; min-width: 0; }
.kelley-access-name { font-size: 9pt; font-weight: bold; color: var(--ncl-navy); }
.kelley-access-role { font-size: 7pt; color: #999; }
.kelley-toggle {
  position: relative; width: 40px; height: 23px;
  background: #ddd; border-radius: 12px; cursor: pointer;
  border: none; transition: background 0.2s; flex-shrink: 0;
}
.kelley-toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 17px; height: 17px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.kelley-toggle.on { background: var(--ncl-pink); }
.kelley-toggle.on::after { transform: translateX(17px); }
.kelley-toggle:disabled { opacity: 0.5; cursor: not-allowed; }

/* Roster panel hint */
.kelley-roster-hint {
  font-size: 7pt; color: var(--ncl-blue-59); margin-top: 5px;
  line-height: 1.5;
}

/* ── Image upload ── */
.kelley-image-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
  flex-wrap: wrap;
}
.kelley-image-add-btn {
  background: none;
  border: 1.5px dashed var(--ncl-blue-a6);
  color: var(--ncl-blue-59);
  font-size: 8pt;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.kelley-image-add-btn:hover { border-color: var(--ncl-navy); color: var(--ncl-navy); }
.kelley-image-preview {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--ncl-blue-f2);
  border: 1px solid var(--ncl-blue-a6);
  border-radius: 8px;
  padding: 4px 8px 4px 6px;
}
.kelley-image-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 5px;
  display: block;
}
.kelley-image-remove {
  background: none;
  border: none;
  color: #aaa;
  font-size: 14pt;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.kelley-image-remove:hover { color: #c33; }

/* ── Refine bar ── */
.kelley-refine-bar {
  flex-shrink: 0;
  border-top: 1px solid var(--ncl-blue-f2);
  padding: 10px 14px 12px;
  background: #fafafa;
  display: flex; flex-direction: column; gap: 8px;
}
.kelley-refine-input {
  width: 100%; resize: none;
  border: 1px solid #dde;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit; font-size: 8.5pt; color: #222;
  line-height: 1.4;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.kelley-refine-input:focus { border-color: var(--ncl-pink); }
.kelley-refine-actions { display: flex; align-items: center; gap: 8px; }
.kelley-refine-btn {
  background: var(--ncl-navy); color: #fff;
  border: none; border-radius: 7px;
  padding: 6px 16px; font-size: 8pt;
  font-family: inherit; letter-spacing: 0.04em;
  cursor: pointer; transition: background 0.15s;
}
.kelley-refine-btn:hover { background: var(--ncl-blue-40); }
.kelley-refine-btn:disabled { opacity: 0.5; cursor: default; }
.kelley-start-over-btn {
  background: none; border: none;
  color: #999; font-size: 7.5pt;
  font-family: inherit; cursor: pointer;
  padding: 0; text-decoration: underline;
  letter-spacing: 0.02em;
}
.kelley-start-over-btn:hover { color: #555; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .kelley-box { height: 95vh; }
  .kelley-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .kelley-input-panel { border-right: none; border-bottom: 1px solid var(--ncl-blue-f2); max-height: 44vh; overflow-y: auto; }
}
@media (max-width: 640px) {
  .kelley-box { width: 100vw; height: 100dvh; border-radius: 0; }
  .kelley-name { font-size: 13pt; }
  .kelley-tab-btn { padding: 5px 8px; font-size: 7.5pt; }
  .kelley-wiz-opts { grid-template-columns: 1fr; }
  .kelley-type-grid { grid-template-columns: 1fr 1fr; }
}
