/* ============================================================
   Design Brief Bot — WordPress Plugin Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&family=Syne:wght@400;500;600;700;800&family=Cabinet+Grotesk:wght@300;400;500;700&display=swap');

/* SCOPED CSS VARIABLES */
.dbb-wrapper {
    --dbb-bg:           #0a0a12;
    --dbb-surface:      #111120;
    --dbb-chat-bg:      #0f0f1c;
    --dbb-bubble-bot:   #17172a;
    --dbb-bubble-user:  #1a2a1a;
    --dbb-border:       rgba(99,102,241,0.15);
    --dbb-indigo:       #6366f1;
    --dbb-indigo-light: #818cf8;
    --dbb-violet:       #8b5cf6;
    --dbb-green:        #22c55e;
    --dbb-amber:        #f59e0b;
    --dbb-red:          #ef4444;
    --dbb-text:         #e2e8f0;
    --dbb-text-dim:     #94a3b8;
    --dbb-text-mute:    #475569;
    --dbb-panel-w:      300px;
    --dbb-topbar-h:     56px;

    all: initial;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 400px;
    background: var(--dbb-bg);
    color: var(--dbb-text);
    font-family: 'Cabinet Grotesk', sans-serif;
    font-size: 15px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

.dbb-wrapper *, .dbb-wrapper *::before, .dbb-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---- TOP BAR ---- */
.dbb-topbar {
    height: var(--dbb-topbar-h);
    background: var(--dbb-surface);
    border-bottom: 1px solid var(--dbb-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    flex-shrink: 0;
    z-index: 10;
}

.dbb-logo {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--dbb-indigo), var(--dbb-violet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.dbb-progress-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dbb-progress-label {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--dbb-text-dim);
    white-space: nowrap;
}

.dbb-progress-track {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
    min-width: 0;
}

.dbb-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--dbb-indigo), var(--dbb-violet));
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

.dbb-voice-btn {
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.3);
    color: var(--dbb-indigo-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    line-height: 1.4;
}

.dbb-voice-btn:hover {
    background: rgba(99,102,241,0.2);
}

.dbb-voice-btn.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(139,92,246,0.3));
    border-color: var(--dbb-indigo);
    animation: dbb-pulse-btn 2s infinite;
}

@keyframes dbb-pulse-btn {
    0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.3); }
    50%      { box-shadow: 0 0 0 6px rgba(99,102,241,0); }
}

.dbb-export-btn {
    background: linear-gradient(135deg, var(--dbb-indigo), var(--dbb-violet));
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.4;
}

.dbb-export-btn:hover { opacity: 0.9; }

/* ---- MAIN LAYOUT ---- */
.dbb-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ---- CHAT AREA ---- */
.dbb-chat-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--dbb-chat-bg);
}

.dbb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.dbb-messages::-webkit-scrollbar { width: 4px; }
.dbb-messages::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.2); border-radius: 4px; }

/* ---- BUBBLES ---- */
.dbb-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 720px;
}

.dbb-msg-row.bot  { align-self: flex-start; }
.dbb-msg-row.user { align-self: flex-end; flex-direction: row-reverse; }

.dbb-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.dbb-bot-avatar  { background: linear-gradient(135deg,#4f46e5,#7c3aed); }
.dbb-user-avatar {
    background: linear-gradient(135deg,#15803d,#166534);
    font-family: 'DM Mono', monospace;
    font-size: 9px; color: #86efac; letter-spacing: .05em;
}

.dbb-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.6;
    max-width: 560px;
    word-break: break-word;
    font-family: 'Cabinet Grotesk', sans-serif;
    font-size: 14px;
}

.dbb-msg-row.bot  .dbb-bubble {
    background: var(--dbb-bubble-bot);
    border: 1px solid var(--dbb-border);
    border-bottom-left-radius: 4px;
    color: var(--dbb-text);
}

.dbb-msg-row.user .dbb-bubble {
    background: var(--dbb-bubble-user);
    border: 1px solid rgba(34,197,94,0.12);
    border-bottom-right-radius: 4px;
    color: #d1fae5;
}

.dbb-bubble.dbb-completeness {
    background: #1c1510;
    border-color: rgba(245,158,11,0.3);
    color: #fde68a;
}

.dbb-completeness-header {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--dbb-amber);
    margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}

.dbb-bubble.dbb-completeness ul {
    margin-top: 6px;
    padding-left: 16px;
    color: #fde68a;
    font-size: 13px;
    line-height: 1.8;
}

.dbb-section-divider {
    align-self: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: .15em;
    color: rgba(139,92,246,0.7);
    text-transform: uppercase;
    padding: 4px 0;
    animation: dbb-fadein .5s forwards;
    opacity: 0;
}

@keyframes dbb-fadein { to { opacity: 1; } }

/* ---- CHOICE PILLS ---- */
.dbb-choices {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 10px;
}

.dbb-choice-pill {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(99,102,241,0.3);
    background: rgba(99,102,241,0.06);
    color: var(--dbb-indigo-light);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    font-family: 'DM Mono', monospace;
}

.dbb-choice-pill:hover { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.6); }
.dbb-choice-pill.selected {
    background: linear-gradient(135deg,rgba(99,102,241,0.3),rgba(139,92,246,0.3));
    border-color: var(--dbb-indigo);
    color: #fff;
}

.dbb-skip-link {
    font-size: 12px;
    color: var(--dbb-text-mute);
    cursor: pointer;
    margin-top: 8px;
    display: inline-block;
    transition: color .15s;
    background: none;
    border: none;
    font-family: 'Cabinet Grotesk', sans-serif;
    padding: 0;
}

.dbb-skip-link:hover { color: var(--dbb-text-dim); }

.dbb-required-star { color: var(--dbb-red); margin-left: 2px; }

/* ---- TYPING INDICATOR ---- */
.dbb-typing-dot {
    display: inline-flex; gap: 4px; align-items: center;
    padding: 10px 14px;
}

.dbb-typing-dot span {
    width: 6px; height: 6px;
    background: var(--dbb-indigo-light);
    border-radius: 50%;
    animation: dbb-bounce .8s infinite;
}

.dbb-typing-dot span:nth-child(2) { animation-delay: .15s; }
.dbb-typing-dot span:nth-child(3) { animation-delay: .3s; }

@keyframes dbb-bounce {
    0%,80%,100% { transform: translateY(0); }
    40%          { transform: translateY(-6px); }
}

/* ---- INPUT ZONE ---- */
.dbb-input-zone {
    padding: 16px 20px;
    background: var(--dbb-surface);
    border-top: 1px solid var(--dbb-border);
    flex-shrink: 0;
}

.dbb-text-input-wrap {
    display: flex; gap: 10px; align-items: flex-end;
}

.dbb-answer-input {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--dbb-border);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--dbb-text);
    font-family: 'Cabinet Grotesk', sans-serif;
    font-size: 14px;
    resize: none;
    outline: none;
    line-height: 1.5;
    max-height: 120px;
    transition: border-color .2s;
    min-height: 42px;
}

.dbb-answer-input:focus  { border-color: rgba(99,102,241,0.5); }
.dbb-answer-input::placeholder { color: var(--dbb-text-mute); }

.dbb-send-btn {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--dbb-indigo), var(--dbb-violet));
    border: none; border-radius: 10px;
    color: #fff; font-size: 16px;
    cursor: pointer; transition: opacity .2s;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}

.dbb-send-btn:hover { opacity: 0.85; }

.dbb-no-speech-warn {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.25);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px; color: var(--dbb-amber);
    margin-bottom: 8px;
    font-family: 'DM Mono', monospace;
}

/* ---- VOICE BAR ---- */
.dbb-voice-bar {
    flex-direction: column;
    gap: 10px;
}

.dbb-voice-status {
    text-align: center;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: .05em;
    transition: color .3s;
}

.dbb-voice-status.speaking  { color: #a78bfa; }
.dbb-voice-status.listening { color: #4ade80; }
.dbb-voice-status.thinking  { color: var(--dbb-amber); }
.dbb-voice-status.idle      { color: var(--dbb-text-mute); }

.dbb-waveform {
    display: flex; align-items: center; justify-content: center;
    gap: 3px; height: 32px;
}

.dbb-wave-bar {
    width: 3px; border-radius: 3px;
    background: var(--dbb-indigo-light);
    height: 4px;
    transition: background .3s;
}

.dbb-wave-bar.speaking  { animation: dbb-wave .6s ease-in-out infinite alternate; background: #a78bfa; }
.dbb-wave-bar.listening { animation: dbb-wave .4s ease-in-out infinite alternate; background: #4ade80; }
.dbb-wave-bar.thinking  { animation: dbb-wave .8s ease-in-out infinite alternate; background: var(--dbb-amber); }

@keyframes dbb-wave {
    from { height: 4px; }
    to   { height: 24px; }
}

.dbb-wave-bar:nth-child(2) { animation-delay: .05s; }
.dbb-wave-bar:nth-child(3) { animation-delay: .1s; }
.dbb-wave-bar:nth-child(4) { animation-delay: .15s; }
.dbb-wave-bar:nth-child(5) { animation-delay: .2s; }
.dbb-wave-bar:nth-child(6) { animation-delay: .25s; }
.dbb-wave-bar:nth-child(7) { animation-delay: .3s; }

.dbb-voice-preview {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--dbb-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--dbb-text-dim);
    min-height: 36px;
}

.dbb-voice-controls {
    display: flex; align-items: center; justify-content: center; gap: 12px;
}

.dbb-mic-btn {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--dbb-indigo), var(--dbb-violet));
    border: none; color: #fff; font-size: 20px;
    cursor: pointer;
    transition: all .2s;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}

.dbb-mic-btn.recording {
    animation: dbb-mic-pulse 1s infinite;
    background: linear-gradient(135deg,#dc2626,#ef4444);
}

@keyframes dbb-mic-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

.dbb-voice-action-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--dbb-text-dim);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all .15s;
    font-family: 'DM Mono', monospace;
    line-height: 1.4;
}

.dbb-voice-action-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--dbb-text);
}

/* ---- BRIEF SUMMARY PANEL ---- */
.dbb-brief-panel {
    width: var(--dbb-panel-w);
    background: var(--dbb-surface);
    border-left: 1px solid var(--dbb-border);
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.dbb-brief-panel::-webkit-scrollbar { width: 3px; }
.dbb-brief-panel::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.2); border-radius: 3px; }

.dbb-panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--dbb-border);
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .12em;
    color: var(--dbb-text-dim);
    text-transform: uppercase;
    flex-shrink: 0;
}

.dbb-panel-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dbb-panel-section-head {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 9px;
    letter-spacing: .12em;
    color: rgba(139,92,246,0.6);
    text-transform: uppercase;
    margin-top: 10px;
    margin-bottom: 4px;
    padding: 0 4px;
}

.dbb-panel-item {
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid transparent;
    transition: all .2s;
}

.dbb-panel-item.filled   { border-color: rgba(34,197,94,0.15);  background: rgba(34,197,94,0.04); }
.dbb-panel-item.accepted { border-color: rgba(245,158,11,0.2);  background: rgba(245,158,11,0.04); }
.dbb-panel-item.skipped  { border-color: rgba(71,85,105,0.2); }

.dbb-panel-label {
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    color: var(--dbb-text-mute);
    letter-spacing: .05em;
    margin-bottom: 2px;
}

.dbb-panel-value {
    font-size: 11px;
    color: var(--dbb-text-dim);
    line-height: 1.4;
}

.dbb-badge {
    display: inline-block;
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    letter-spacing: .05em;
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 3px;
}

.dbb-badge.complete { background: rgba(34,197,94,0.15);  color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.dbb-badge.accepted { background: rgba(245,158,11,0.15); color: var(--dbb-amber); border: 1px solid rgba(245,158,11,0.2); }
.dbb-badge.skipped  { background: rgba(71,85,105,0.15);  color: var(--dbb-text-mute); border: 1px solid rgba(71,85,105,0.2); }

/* ---- COMPLETION CARD ---- */
.dbb-completion-card {
    align-self: center;
    max-width: 520px;
    background: linear-gradient(135deg,rgba(99,102,241,0.08),rgba(139,92,246,0.08));
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 20px;
    padding: 32px;
    margin: 20px;
    text-align: center;
}

.dbb-completion-card h2 {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 22px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--dbb-indigo-light), #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dbb-completion-card p {
    font-size: 14px;
    color: var(--dbb-text-dim);
    line-height: 1.7;
    margin-bottom: 16px;
}

.dbb-completion-card blockquote {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: rgba(139,92,246,0.8);
    border-left: 2px solid rgba(139,92,246,0.3);
    padding-left: 12px;
    text-align: left;
    font-style: italic;
    line-height: 1.7;
    margin-bottom: 20px;
}

.dbb-completion-btns {
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

.dbb-completion-btns button {
    padding: 10px 20px;
    border-radius: 10px;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all .2s;
    border: none;
    line-height: 1.4;
}

.dbb-export-main-btn {
    background: linear-gradient(135deg, var(--dbb-indigo), var(--dbb-violet));
    color: #fff;
}

.dbb-restart-btn {
    background: rgba(255,255,255,0.06);
    color: var(--dbb-text-dim);
    border: 1px solid rgba(255,255,255,0.1) !important;
}

.dbb-restart-btn:hover { background: rgba(255,255,255,0.1); }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
    .dbb-brief-panel { display: none; }
}
