/* ===================================================
   Prompt Recipe — app.css
   =================================================== */

/* ─ Design tokens ─────────────────────────────────────────── */

:root {
    --color-accent:         #4c51bf;
    --color-accent-hover:   #434190;
    --color-accent-light:   #ebf4ff;
    --color-accent-dark:    #3c366b;
    --color-accent-focus:   rgba(76, 81, 191, 0.1);

    --color-success:        #48bb78;
    --color-success-hover:  #38a169;

    --color-bg:             #f0f2f5;
    --color-surface:        #fff;
    --color-surface-muted:  #f7fafc;
    --color-surface-subtle: #edf2f7;
    --color-header:         #1a1a2e;

    --color-border:         #e2e8f0;
    --color-border-muted:   #cbd5e0;

    --color-text:           #1a1a2e;
    --color-text-heading:   #2d3748;
    --color-text-body:      #4a5568;
    --color-text-muted:     #718096;
    --color-text-subtle:    #a0aec0;
}

/* ─ Reset & base ──────────────────────────────────────────── */

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ─ Layout ─────────────────────────────────────────────── */

.layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: var(--color-header);
    color: var(--color-surface);
    padding: 1.5rem 2rem;
    text-align: center;
}

.app-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.app-tagline {
    margin-top: 0.25rem;
    color: var(--color-text-subtle);
    font-size: 0.9rem;
}

.app-content {
    flex: 1;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ─ Step indicator ───────────────────────────────────────── */

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2.5rem;
    padding: 1.25rem 0;
    list-style: none;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
    transition: all 0.2s;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--color-border-muted);
    color: var(--color-text-body);
    font-size: 0.75rem;
    font-weight: 700;
}

.step--active .step-number {
    background: var(--color-accent);
    color: var(--color-surface);
}

.step--active .step-name {
    color: var(--color-accent);
    font-weight: 600;
}

.step--done .step-number {
    background: var(--color-success);
    color: var(--color-surface);
}

.step--done .step-name { color: var(--color-success); }

.step-connector {
    flex: 0 0 2.5rem;
    height: 2px;
    background: var(--color-border-muted);
    margin: 0 0.25rem;
}

/* ─ Recipe form ──────────────────────────────────────────── */

.recipe-form {
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
    padding: 2rem;
}

.question-block {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-surface-subtle);
}

.question-block:last-of-type { border-bottom: none; }

.question-label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text-heading);
}

.question-sublabel {
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-body);
}

/* ─ Option lists ──────────────────────────────────────────── */

.options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.option-radio,
.option-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-body);
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.option-radio:hover,
.option-checkbox:hover {
    border-color: var(--color-text-subtle);
    background: var(--color-surface-muted);
}

.option-radio input,
.option-checkbox input {
    accent-color: var(--color-accent);
    cursor: pointer;
}

.option-recommended {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
    color: var(--color-accent-dark);
}

.badge-recommended {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--color-accent);
    color: var(--color-surface);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.25rem;
}

/* ─ Text inputs ──────────────────────────────────────────── */

.input-text {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-text-heading);
    resize: vertical;
    transition: border-color 0.15s;
}

.input-text:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-focus);
}

.other-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
}

.other-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.input-other {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--color-text-heading);
}

.input-other:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-focus);
}

.companion-text { margin-top: 1.25rem; }

/* ─ Buttons ─────────────────────────────────────────────── */

.btn-primary,
.btn-secondary,
.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.925rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-surface);
}

.btn-primary:hover:not(:disabled) { background: var(--color-accent-hover); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-surface-subtle);
    color: var(--color-text-body);
}

.btn-secondary:hover { background: var(--color-border); }

.btn-copy {
    background: var(--color-accent);
    color: var(--color-surface);
    min-width: 160px;
    justify-content: center;
}

.btn-copy:hover { background: var(--color-accent-hover); }

.btn-copy--done {
    background: var(--color-success);
}

.btn-copy--done:hover { background: var(--color-success-hover); }

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-surface-subtle);
}

/* ─ Shopping cart ────────────────────────────────────────── */

.shopping-cart {
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
    padding: 2rem;
}

.cart-header { margin-bottom: 1.5rem; }

.cart-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text-heading);
}

.cart-subtitle {
    margin-top: 0.35rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.cart-body {
    background: var(--color-surface-muted);
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.cart-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--color-text-heading);
    white-space: pre-wrap;
    word-break: break-word;
}

.cart-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ─ Done view ────────────────────────────────────────────── */

.done-view {
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
    padding: 3rem 2rem;
    text-align: center;
}

.done-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--color-success);
    color: var(--color-surface);
    font-size: 1.75rem;
    line-height: 3.5rem;
    margin: 0 auto 1.25rem;
}

.done-view h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--color-text-heading);
}

.done-steps {
    list-style: none;
    counter-reset: steps;
    text-align: left;
    max-width: 460px;
    margin: 0 auto 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.done-steps li {
    counter-increment: steps;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    font-size: 0.925rem;
    color: var(--color-text-body);
}

.done-steps li::before {
    content: counter(steps);
    flex-shrink: 0;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--color-accent-light);
    color: var(--color-accent);
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ─ D-badge (4D framework indicator) ────────────────────── */

.d-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: var(--color-accent-light);
    border: 1.5px solid var(--color-accent);
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.d-number {
    font-weight: 800;
    color: var(--color-accent);
    font-size: 0.85rem;
}

.d-label {
    font-weight: 700;
    color: var(--color-accent-dark);
}

.d-desc {
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

/* ─ Diligence checklist ──────────────────────────────────── */

.diligence-checklist {
    list-style: none;
    max-width: 520px;
    margin: 0 auto 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.checklist-item label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1.5px solid var(--color-border);
    font-size: 0.9rem;
    color: var(--color-text-body);
    transition: background 0.15s, border-color 0.15s;
}

.checklist-item label:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-text-subtle);
}

.checklist-item input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-success);
    cursor: pointer;
}

.done-subtitle {
    color: var(--color-text-body);
    font-size: 0.925rem;
    margin-bottom: 1.25rem;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

.done-progress {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.optional-label {
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* ─ Loading ──────────────────────────────────────────────── */

.loading {
    display: flex;
    justify-content: center;
    padding: 4rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* ─ Responsive ──────────────────────────────────────────── */

@media (max-width: 600px) {
    .app-header { padding: 1.25rem 1rem; }
    .app-content { padding: 1.25rem 1rem 3rem; }
    .recipe-form,
    .shopping-cart,
    .done-view { padding: 1.25rem; }
    .step-name { display: none; }
    .step { padding: 0.4rem; }
    .cart-actions { flex-direction: column; }
    .btn-copy { width: 100%; }
}
