/* ============================================================
   RF AI Sandbox, shared styles for Guided AI Sandbox stages
   Used by every Foundations-phase AI unit (no-code stages).
   Three-panel workspace: Unit | Ask the AI | Field Notes.
   ============================================================ */

body { margin: 0; overflow: hidden; }

.stage-container { display: flex; flex-direction: column; height: 100vh; }

.stage-header {
    background: linear-gradient(135deg, var(--rf-coral), var(--rf-pink), var(--rf-purple));
    color: var(--rf-light);
    padding: 1rem;
    flex-shrink: 0;
}
.stage-header-content { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 1.5rem; }
.stage-header-logo { height: 48px; width: auto; flex-shrink: 0; }
.stage-header-text { flex: 1; }
.stage-header-nav { display: flex; gap: 0.75rem; flex-shrink: 0; }
.header-btn {
    background: rgba(255,255,255,0.2); color: white; padding: 0.5rem 1rem;
    border-radius: 4px; font-weight: 600; font-size: 0.875rem; transition: background 0.2s;
    border: none; cursor: pointer; text-decoration: none; display: inline-block;
}
.header-btn:hover { background: rgba(255,255,255,0.3); }
.stage-header h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
.stage-header p { margin: 0; font-size: 0.875rem; opacity: 0.9; }
.progress-bar { width: 100%; height: 4px; background: rgba(255,255,255,0.2); margin-top: 0.75rem; }
.progress-fill { height: 100%; background: white; transition: width 0.3s ease; }

.workspace { display: flex; flex: 1; overflow: hidden; }
.panel { display: flex; flex-direction: column; overflow: hidden; flex: 1 1 0; min-width: 200px; }
.panel-divider { width: 5px; background: #111827; cursor: col-resize; flex-shrink: 0; position: relative; transition: background 0.15s; }
.panel-divider:hover, .panel-divider.active { background: var(--rf-coral); }
.panel-divider::after { content: '\22EE'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #374151; font-size: 14px; user-select: none; pointer-events: none; }
.panel-divider:hover::after, .panel-divider.active::after { color: white; }

.panel-header {
    background: var(--rf-dark); color: var(--rf-light); padding: 0.75rem 1rem;
    font-weight: 600; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em;
    flex-shrink: 0; display: flex; justify-content: space-between; align-items: center;
}
.panel-content { flex: 1; overflow-y: auto; padding: 2rem; background: white; }

/* Step-by-step unit content */
.step { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 2px solid #f3f4f6; }
.step:last-child { border-bottom: none; }
.step-number {
    display: inline-block; background: linear-gradient(135deg, var(--rf-coral), var(--rf-pink));
    color: white; padding: 0.25rem 0.75rem; border-radius: 4px; font-weight: 700; font-size: 0.875rem; margin-bottom: 0.75rem;
}
.step h3 { font-size: 1.25rem; margin: 0 0 0.75rem; color: var(--rf-dark); }
.step p { line-height: 1.7; margin-bottom: 0.75rem; font-size: 0.9375rem; color: #374151; }
.step ul { margin: 0.75rem 0; padding-left: 1.5rem; }
.step li { margin-bottom: 0.5rem; line-height: 1.6; font-size: 0.9375rem; color: #374151; }

.tip-box { background: rgba(255,138,101,0.08); border-left: 3px solid var(--rf-coral); border: 1px solid rgba(255,138,101,0.35); padding: 1rem; margin: 1rem 0; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.tip-box h4 { margin: 0 0 0.5rem; font-size: 0.9375rem; color: var(--rf-coral); }
.tip-box p { margin: 0; font-size: 0.875rem; }

.try-box { background: rgba(181,101,216,0.08); border-left: 3px solid var(--rf-purple); border: 1px solid rgba(181,101,216,0.3); padding: 1rem; margin: 1rem 0; border-radius: 6px; }
.try-box h4 { margin: 0 0 0.5rem; font-size: 0.9375rem; color: var(--rf-purple); }
.try-box p { margin: 0 0 0.5rem; font-size: 0.875rem; color: #374151; }
.try-prompt { display: block; background: #0A0E1A; color: #E5E7EB; padding: 0.6rem 0.85rem; border-radius: 6px; font-family: 'SF Mono','Monaco','Courier New',monospace; font-size: 0.8125rem; margin: 0.4rem 0; cursor: pointer; transition: background 0.15s; }
.try-prompt:hover { background: #151B2D; }
.try-prompt::before { content: '💬 '; }

/* MIDDLE: Ask the AI */
#panel-ai .panel-content { padding: 0; display: flex; flex-direction: column; background: #F6F7F9; }
.sandbox-banner { background: #FEF3C7; color: #92400E; font-size: 0.8125rem; padding: 0.6rem 1rem; border-bottom: 1px solid #FCD34D; display: flex; gap: 0.5rem; align-items: center; }
.chat-log { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.msg { max-width: 88%; padding: 0.75rem 1rem; border-radius: 14px; font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--rf-blue); color: white; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: white; color: #1F2937; border: 1px solid #E5E7EB; border-bottom-left-radius: 4px; }
.msg.ai .msg-tag { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--rf-purple); font-weight: 700; margin-bottom: 0.3rem; }
.msg.thinking { color: var(--rf-gray); font-style: italic; }
.chat-empty { color: var(--rf-gray); font-size: 0.9rem; text-align: center; margin: auto; max-width: 260px; line-height: 1.6; }
.chat-input-row { display: flex; gap: 0.5rem; padding: 0.85rem; border-top: 1px solid #E5E7EB; background: white; }
.chat-input { flex: 1; resize: none; border: 1px solid #D1D5DB; border-radius: 10px; padding: 0.6rem 0.75rem; font-family: var(--font-body); font-size: 0.9rem; line-height: 1.4; max-height: 120px; }
.chat-input:focus { outline: none; border-color: var(--rf-coral); box-shadow: 0 0 0 3px rgba(255,138,101,0.15); }
.send-btn { flex-shrink: 0; align-self: flex-end; background: linear-gradient(135deg, var(--rf-coral), var(--rf-pink)); color: white; border: none; border-radius: 10px; padding: 0.6rem 1.1rem; font-weight: 700; cursor: pointer; font-size: 0.9rem; }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* RIGHT: Field Notes */
#panel-notes .panel-content { padding: 0; display: flex; flex-direction: column; }
.notes-intro { padding: 1rem 1.25rem 0.5rem; font-size: 0.85rem; color: var(--rf-gray); line-height: 1.5; }
.notes-prompts { padding: 0 1.25rem; margin: 0.25rem 0 0.5rem; }
.notes-prompts li { font-size: 0.82rem; color: #4B5563; margin-bottom: 0.3rem; line-height: 1.45; }
.notes-area { flex: 1; margin: 0.5rem 1.25rem 0.75rem; border: 1px solid #D1D5DB; border-radius: 10px; padding: 0.85rem; font-family: var(--font-body); font-size: 0.9rem; line-height: 1.6; resize: none; }
.notes-area:focus { outline: none; border-color: var(--rf-purple); box-shadow: 0 0 0 3px rgba(181,101,216,0.15); }
.notes-status { padding: 0 1.25rem 0.85rem; font-size: 0.75rem; color: var(--rf-gray); }

.reset-btn { background: rgba(255,255,255,0.2); border: none; padding: 0.25rem 0.75rem; border-radius: 3px; color: white; cursor: pointer; font-size: 0.75rem; transition: background 0.2s; }
.reset-btn:hover { background: rgba(255,255,255,0.3); }

@media (max-width: 1024px) {
    .workspace { flex-direction: column; }
    .panel { flex: none; height: 40%; }
    .panel-divider { width: 100%; height: 5px; cursor: row-resize; }
    .panel-divider::after { content: '...'; }
    .stage-header-content { flex-wrap: wrap; }
    .stage-header-logo { height: 36px; }
    .stage-header-nav { width: 100%; justify-content: flex-end; }
}
