/* ═══════════════════════════════════════════════════════════════════════════
   Write — AI Content Writer
   Accent: #3b82f6 (blue-500)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page shell ─────────────────────────────────────────────────────────── */
.write-page {
    background: #010d1f;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
    margin-bottom: -96px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.write-header {
    background: linear-gradient(140deg, #010d1f 0%, #071940 55%, #030f28 100%);
    border-bottom: 1px solid rgba(59, 130, 246, 0.18);
    position: relative;
    margin: -60px 0 -110px 0;
}

.write-header .back-to-store-btn {
    display: inline-flex !important;
    width: auto;
    align-self: flex-start;
}

/* Glow orb */
.write-header::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -120px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.09) 0%, transparent 65%);
    pointer-events: none;
}

.write-header__body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    /* padding: 16px 0 20px; */
}

.write-header__badge {
    display: inline-flex;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.30);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 12px;
    margin-bottom: 10px;
}

.write-header__title {
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.write-header__subtitle {
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.50);
    margin: 0;
    max-width: 560px;
    line-height: 1.6;
}

.write-header__chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.write-chip {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.70);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 14px;
}

.write-chip--types {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.28);
    color: #60a5fa;
}

.write-chip--ai {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.28);
    color: #60a5fa;
}

.write-hiw-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.50);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.write-hiw-btn:hover {
    background: rgba(59, 130, 246, 0.14);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.35);
}

/* ── Light mode header ──────────────────────────────────────────────────── */
html[data-theme="light"] .write-page { background: #eff6ff; }
html[data-theme="light"] .write-header {
    background: linear-gradient(140deg, #eff6ff 0%, #dbeafe 55%, #e0f2fe 100%);
    border-bottom: 1px solid rgba(59, 130, 246, 0.20);
}
html[data-theme="light"] .write-header::before {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 65%);
}
html[data-theme="light"] .write-header__badge { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; border-color: rgba(59, 130, 246, 0.35); }
html[data-theme="light"] .write-header__title   { color: #0a1a3a; }
html[data-theme="light"] .write-header__subtitle { color: rgba(0,0,0,0.50); }
html[data-theme="light"] .write-chip { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.10); color: rgba(0,0,0,0.65); }
html[data-theme="light"] .write-hiw-btn { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); color: rgba(0,0,0,0.50); }
html[data-theme="light"] .write-hiw-btn:hover { background: rgba(59,130,246,0.10); color: #1d4ed8; border-color: rgba(59,130,246,0.30); }

/* ── Body ───────────────────────────────────────────────────────────────── */
.write-body.container {
    padding-top: 80px;
    padding-bottom: 80px;
    min-height: 0;
}

/* ── 2-col form grid ─────────────────────────────────────────────────────── */
.write-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.write-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}
.write-card:last-child { margin-bottom: 0; }

.write-card__head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.write-step {
    font-size: 0.70rem;
    font-weight: 800;
    letter-spacing: 0.10em;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 999px;
    padding: 2px 9px;
}
.write-card__title {
    font-size: 0.92rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

/* Light mode cards */
html[data-theme="light"] .write-card { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.07); }
html[data-theme="light"] .write-card__title { color: rgba(0,0,0,0.80); }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.write-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    padding: 9px 13px;
    outline: none;
    width: 100%;
    transition: border-color 0.15s;
    font-family: inherit;
}
.write-input:focus { border-color: rgba(59, 130, 246, 0.50); }
.write-input::placeholder { color: rgba(255,255,255,0.25); }

.write-textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    padding: 10px 13px;
    outline: none;
    resize: vertical;
    width: 100%;
    transition: border-color 0.15s;
    font-family: inherit;
    line-height: 1.5;
}
.write-textarea:focus { border-color: rgba(59, 130, 246, 0.50); }
.write-textarea::placeholder { color: rgba(255,255,255,0.25); }
.write-textarea--topic { min-height: 80px; }

html[data-theme="light"] .write-input,
html[data-theme="light"] .write-textarea {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.10);
    color: rgba(0,0,0,0.85);
}
html[data-theme="light"] .write-input::placeholder,
html[data-theme="light"] .write-textarea::placeholder { color: rgba(0,0,0,0.28); }

/* ── Topic presets ───────────────────────────────────────────────────────── */
.write-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.write-preset-pill {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    color: rgba(255,255,255,0.45);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-align: left;
}
.write-preset-pill:hover,
.write-preset-pill.active {
    background: rgba(59,130,246,0.12);
    border-color: rgba(59,130,246,0.30);
    color: #60a5fa;
}

html[data-theme="light"] .write-preset-pill { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: rgba(0,0,0,0.45); }
html[data-theme="light"] .write-preset-pill:hover,
html[data-theme="light"] .write-preset-pill.active { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.25); color: #1d4ed8; }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.write-divider {
    font-size: 0.74rem;
    color: rgba(255,255,255,0.25);
    text-align: center;
    position: relative;
}
.write-divider::before,
.write-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 22%;
    height: 1px;
    background: rgba(255,255,255,0.08);
}
.write-divider::before { left: 0; }
.write-divider::after  { right: 0; }

html[data-theme="light"] .write-divider { color: rgba(0,0,0,0.28); }
html[data-theme="light"] .write-divider::before,
html[data-theme="light"] .write-divider::after { background: rgba(0,0,0,0.08); }

/* ── Labels ──────────────────────────────────────────────────────────────── */
.write-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.30);
    margin: 0;
}
html[data-theme="light"] .write-label { color: rgba(0,0,0,0.35); }

/* ── Pill groups ─────────────────────────────────────────────────────────── */
.write-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.write-pill {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.50);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.write-pill.active {
    background: rgba(59,130,246,0.15);
    border-color: rgba(59,130,246,0.40);
    color: #60a5fa;
}
.write-pill:not(.active):hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75);
}
.write-pill--length { min-width: 72px; text-align: center; }

html[data-theme="light"] .write-pill { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.10); color: rgba(0,0,0,0.50); }
html[data-theme="light"] .write-pill.active { background: rgba(59,130,246,0.10); border-color: rgba(59,130,246,0.30); color: #1d4ed8; }
html[data-theme="light"] .write-pill:not(.active):hover { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.75); }

/* ── Error ───────────────────────────────────────────────────────────────── */
.write-error {
    font-size: 0.83rem;
    color: #f87171;
    margin: 0;
}

/* ── Generate button ─────────────────────────────────────────────────────── */
.write-generate-btn {
    width: 100%;
    padding: 13px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
    letter-spacing: 0.01em;
}
.write-generate-btn:hover:not(:disabled) { opacity: 0.88; }
.write-generate-btn:disabled { opacity: 0.60; cursor: not-allowed; }
.write-generate-btn--loading { opacity: 0.70; }

/* ── Result panel ────────────────────────────────────────────────────────── */
.write-result {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(59,130,246,0.18);
    border-radius: 14px;
    overflow: hidden;
}

.write-result__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.write-result__meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.write-result__label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #60a5fa;
}
.write-result__counts {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.35);
}

.write-result__actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.write-copy-btn {
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.30);
    color: #60a5fa;
    border-radius: 999px;
    padding: 6px 18px;
    font-size: 0.80rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    min-width: 80px;
}
.write-copy-btn:hover { background: rgba(59,130,246,0.25); }
.write-copy-btn.copied {
    background: rgba(16,185,129,0.15);
    border-color: rgba(16,185,129,0.30);
    color: #10b981;
}

.write-regen-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.45);
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 0.80rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.write-regen-btn:hover:not(:disabled) {
    background: rgba(59,130,246,0.12);
    color: #60a5fa;
    border-color: rgba(59,130,246,0.28);
}
.write-regen-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.write-result__body {
    padding: 22px;
    font-size: 0.90rem;
    line-height: 1.75;
    color: rgba(255,255,255,0.82);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    margin: 0;
}

.write-result__notes {
    padding: 14px 22px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.82rem;
    color: rgba(255,255,255,0.42);
    line-height: 1.55;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.write-result__notes-label {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #60a5fa;
    background: rgba(59,130,246,0.10);
    border: 1px solid rgba(59,130,246,0.22);
    border-radius: 999px;
    padding: 2px 8px;
}

/* Light mode result */
html[data-theme="light"] .write-result { background: rgba(0,0,0,0.025); border-color: rgba(59,130,246,0.15); }
html[data-theme="light"] .write-result__head { border-bottom-color: rgba(0,0,0,0.07); }
html[data-theme="light"] .write-result__counts { color: rgba(0,0,0,0.35); }
html[data-theme="light"] .write-result__body { color: rgba(0,0,0,0.80); }
html[data-theme="light"] .write-result__notes { border-top-color: rgba(0,0,0,0.06); color: rgba(0,0,0,0.45); }
html[data-theme="light"] .write-regen-btn { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.10); color: rgba(0,0,0,0.45); }

/* ── How It Works modal ──────────────────────────────────────────────────── */
.write-hiw-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.write-hiw-modal {
    background: #040f22;
    border: 1px solid rgba(59, 130, 246, 0.20);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.write-hiw-modal__close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.40);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.15s;
}
.write-hiw-modal__close:hover { color: #fff; }

.write-hiw-modal__header { border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 20px; }
.write-hiw-modal__eyebrow {
    font-size: 0.70rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #60a5fa;
    margin: 0 0 8px;
}
.write-hiw-modal__title { font-size: 1.4rem; font-weight: 800; color: #fff; margin: 0 0 10px; }
.write-hiw-modal__subtitle { font-size: 0.9rem; color: rgba(255,255,255,0.50); margin: 0; line-height: 1.6; }

.write-hiw-section { display: flex; flex-direction: column; gap: 8px; }
.write-hiw-section__head { display: flex; align-items: center; gap: 10px; }
.write-hiw-section__icon { font-size: 1.1rem; }
.write-hiw-section__title { font-size: 0.95rem; font-weight: 700; color: rgba(255,255,255,0.88); margin: 0; }
.write-hiw-section__body { font-size: 0.88rem; color: rgba(255,255,255,0.50); line-height: 1.65; margin: 0; }

html[data-theme="light"] .write-hiw-modal { background: #fff; border-color: rgba(59,130,246,0.18); }
html[data-theme="light"] .write-hiw-modal__close { color: rgba(0,0,0,0.40); }
html[data-theme="light"] .write-hiw-modal__close:hover { color: #000; }
html[data-theme="light"] .write-hiw-modal__header { border-bottom-color: rgba(0,0,0,0.08); }
html[data-theme="light"] .write-hiw-modal__title { color: #0a1a3a; }
html[data-theme="light"] .write-hiw-modal__subtitle { color: rgba(0,0,0,0.50); }
html[data-theme="light"] .write-hiw-section__title { color: rgba(0,0,0,0.80); }
html[data-theme="light"] .write-hiw-section__body { color: rgba(0,0,0,0.50); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .write-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .write-header__body { flex-direction: column; align-items: flex-start; gap: 12px; }
    .write-result__head { flex-direction: column; align-items: flex-start; }
}
