/**
 * Post-mortem Writer block styles
 */
.pmw-tool { padding: var(--wp--preset--spacing--60, 4rem) 0; }
.pmw-tool .container { max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; }

.pmw-header { text-align: center; margin-bottom: 2rem; }
.pmw-header h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); margin: 0 0 0.75rem; line-height: 1.2; }
.pmw-header p { color: var(--wp--preset--color--text-muted, #6b7280); margin: 0 auto; }

.pmw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }

.pmw-form {
    display: flex; flex-direction: column; gap: 1.25rem;
}
.pmw-section {
    background: var(--wp--preset--color--surface, #ffffff);
    border: 1px solid var(--wp--preset--color--border, #e5e7eb);
    border-radius: 12px; padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    margin: 0;
    display: flex; flex-direction: column; gap: 0.875rem;
}
.pmw-section legend {
    padding: 0 0.5rem; margin-left: -0.5rem;
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--wp--preset--color--primary, #4f46e5);
}

.pmw-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
.pmw-field { display: flex; flex-direction: column; gap: 0.375rem; }
.pmw-field label { font-size: 0.8125rem; font-weight: 600; color: var(--wp--preset--color--text, #111827); }
.pmw-optional { font-weight: 400; color: var(--wp--preset--color--text-muted, #6b7280); font-size: 0.75rem; }
.pmw-field input, .pmw-field select, .pmw-field textarea {
    padding: 0.55rem 0.75rem; border: 1px solid var(--wp--preset--color--border, #d1d5db);
    border-radius: 6px; font: inherit; font-size: 0.875rem;
    background: #fff; color: var(--wp--preset--color--text, #111827);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.pmw-field textarea { resize: vertical; font-family: inherit; min-height: 4rem; }
.pmw-field select {
    padding-right: 2rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 10px;
    -webkit-appearance: none; -moz-appearance: none; appearance: none; cursor: pointer;
}
.pmw-field input:focus, .pmw-field select:focus, .pmw-field textarea:focus {
    outline: none; border-color: var(--wp--preset--color--primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.pmw-repeater { display: flex; flex-direction: column; gap: 0.5rem; }
.pmw-repeater__row { display: grid; gap: 0.5rem; align-items: center; }
.pmw-repeater[data-repeater="timeline"] .pmw-repeater__row { grid-template-columns: 120px 1fr auto; }
.pmw-repeater[data-repeater="actions"]  .pmw-repeater__row { grid-template-columns: 2fr 1fr 1fr auto; }
.pmw-repeater__row input {
    padding: 0.5rem 0.75rem; border: 1px solid var(--wp--preset--color--border, #d1d5db);
    border-radius: 6px; font: inherit; font-size: 0.875rem;
}
.pmw-repeater__row input:focus {
    outline: none; border-color: var(--wp--preset--color--primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.pmw-remove {
    width: 28px; height: 28px; border-radius: 6px;
    border: 1px solid var(--wp--preset--color--border, #d1d5db);
    background: #fff; color: var(--wp--preset--color--text-muted, #6b7280);
    font-size: 1.125rem; line-height: 1; cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.pmw-remove:hover { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.pmw-add {
    align-self: flex-start;
    padding: 0.5rem 0.875rem; border-radius: 8px;
    border: 1px dashed var(--wp--preset--color--border, #d1d5db);
    background: transparent; color: var(--wp--preset--color--primary, #4f46e5);
    font: inherit; font-size: 0.8125rem; font-weight: 600;
    cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.pmw-add:hover {
    background: var(--wp--preset--color--primary-50, #eef2ff);
    border-color: var(--wp--preset--color--primary, #4f46e5);
    border-style: solid;
}

.pmw-preview {
    position: sticky; top: 1rem;
    background: var(--wp--preset--color--surface, #ffffff);
    border: 1px solid var(--wp--preset--color--border, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    display: flex; flex-direction: column;
    max-height: calc(100vh - 2rem);
}
.pmw-preview__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--wp--preset--color--border, #e5e7eb);
    gap: 0.75rem; flex-wrap: wrap;
}
.pmw-preview__head h2 { margin: 0; font-size: 1rem; }
.pmw-preview__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pmw-copy, .pmw-reset {
    padding: 0.5rem 0.875rem; border-radius: 8px;
    border: 1px solid var(--wp--preset--color--border, #d1d5db);
    background: #fff; color: var(--wp--preset--color--text, #111827);
    font: inherit; font-size: 0.8125rem; font-weight: 600;
    cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pmw-copy:hover {
    background: var(--wp--preset--color--background-muted, #f9fafb);
    border-color: var(--wp--preset--color--primary, #4f46e5);
    color: var(--wp--preset--color--primary, #4f46e5);
}
.pmw-copy.is-copied { background: #ecfdf5; border-color: #10b981; color: #047857; }
.pmw-reset:hover { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.pmw-preview__body {
    margin: 0; padding: 1.25rem 1.5rem;
    background: var(--wp--preset--color--background-muted, #f9fafb);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8125rem; line-height: 1.6;
    color: var(--wp--preset--color--text, #111827);
    white-space: pre-wrap; word-break: break-word;
    border-radius: 0 0 12px 12px;
    overflow-y: auto; flex: 1;
}

/* Upsell */
.pmw-upsell {
    position: relative; margin-top: 2rem; display: grid;
    grid-template-columns: auto 1fr auto; gap: 1.5rem; align-items: center;
    padding: 1.75rem 2rem;
    background: linear-gradient(135deg, var(--wp--preset--color--primary, #4f46e5) 0%, var(--wp--preset--color--primary-hover, #4338ca) 100%);
    border-radius: 14px;
    box-shadow: 0 10px 30px -10px rgba(79, 70, 229, 0.45), 0 4px 12px -4px rgba(79, 70, 229, 0.25);
    color: #fff; overflow: hidden;
}
.pmw-upsell::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle at 85% 30%, rgba(255, 255, 255, 0.15), transparent 50%); pointer-events: none; }
.pmw-upsell > * { position: relative; }
.pmw-upsell__icon { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: rgba(255, 255, 255, 0.18); color: #fff; flex-shrink: 0; }
.pmw-upsell__eyebrow { display: inline-block; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.85); margin-bottom: 0.35rem; }
.pmw-upsell__body h3 { margin: 0 0 0.4rem; font-size: 1.375rem; line-height: 1.25; color: #fff; font-weight: 700; }
.pmw-upsell__body h3 em { font-style: italic; color: #fef08a; text-decoration: underline; text-decoration-color: rgba(254, 240, 138, 0.5); text-underline-offset: 3px; }
.pmw-upsell__body p { margin: 0; font-size: 0.9375rem; color: rgba(255, 255, 255, 0.92); line-height: 1.5; max-width: 62ch; }
.pmw-upsell__cta {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.875rem 1.375rem; border-radius: 10px; background: #fff;
    color: var(--wp--preset--color--primary, #4f46e5); font-size: 0.9375rem; font-weight: 700;
    text-decoration: none; white-space: nowrap;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s, box-shadow 0.15s;
}
.pmw-upsell__cta:hover { color: var(--wp--preset--color--primary, #4f46e5); transform: translateY(-1px); box-shadow: 0 8px 18px -4px rgba(0, 0, 0, 0.2); }

/* Reference */
.pmw-reference {
    margin-top: 2.5rem; padding: 1.75rem;
    background: var(--wp--preset--color--surface, #ffffff);
    border: 1px solid var(--wp--preset--color--border, #e5e7eb);
    border-radius: 12px;
}
.pmw-reference h2 { margin: 0 0 0.75rem; font-size: 1.125rem; }
.pmw-reference p { margin: 0; color: var(--wp--preset--color--text, #111827); font-size: 0.9375rem; line-height: 1.6; }
.pmw-reference a { color: var(--wp--preset--color--primary, #4f46e5); }

@media (max-width: 1000px) {
    .pmw-grid { grid-template-columns: 1fr; }
    .pmw-preview { position: static; max-height: none; }
}
@media (max-width: 720px) {
    .pmw-row { grid-template-columns: 1fr; }
    .pmw-repeater[data-repeater="timeline"] .pmw-repeater__row { grid-template-columns: 1fr auto; }
    .pmw-repeater[data-repeater="timeline"] .pmw-repeater__row .pmw-event { grid-column: 1 / -1; }
    .pmw-repeater[data-repeater="actions"]  .pmw-repeater__row { grid-template-columns: 1fr auto; }
    .pmw-repeater[data-repeater="actions"]  .pmw-repeater__row .pmw-ai-owner,
    .pmw-repeater[data-repeater="actions"]  .pmw-repeater__row .pmw-ai-due { grid-column: 1 / -1; }
    .pmw-upsell { grid-template-columns: 1fr; text-align: center; padding: 1.5rem; }
    .pmw-upsell__icon { margin: 0 auto; }
    .pmw-upsell__cta { justify-content: center; }
    .pmw-reference { padding: 1.25rem; }
}
