/* LUB Shakthi — the feed composer.
 *
 * Two states. At rest it is one line plus three shortcuts, so it costs almost
 * no vertical space above the feed. Open, it becomes a proper sheet with the
 * audience, the type, the spec fields and a live preview of the card.
 */

.composer {
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl);
    box-shadow: var(--shadow); margin-bottom: 16px;
    transition: box-shadow .25s, border-color .25s;
}
.composer.is-open { box-shadow: 0 12px 34px rgba(17,24,39,.13); border-color: var(--line-2); }

/* ── resting state ─────────────────────────────────────────── */

.comp-rest { padding: 12px 14px; }
.composer.is-open .comp-rest { display: none; }

.comp-rest-top { display: flex; align-items: center; gap: 11px; }
.comp-trigger {
    flex: 1; text-align: left; border: 0; cursor: pointer;
    background: var(--bg); border-radius: 999px; padding: 11px 18px;
    color: var(--ink-3); font-size: 14.5px; font-family: inherit;
    transition: background .18s, color .18s;
}
.comp-trigger:hover { background: var(--brand-50); color: var(--brand-deep); }

.comp-quick {
    display: flex; gap: 4px; margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--line);
}
.comp-quick button {
    flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center;
    gap: 7px; border: 0; background: 0; cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 600; color: var(--ink-2);
    padding: 9px 6px; border-radius: 10px; white-space: nowrap;
    transition: background .15s, color .15s;
}
.comp-quick button:hover { background: var(--bg); }
.comp-quick .material-symbols-outlined { font-size: 20px; }
.comp-quick .qp { color: #2563EB; }
.comp-quick .qr { color: #7C3AED; }
.comp-quick .qo { color: #059669; }

/* ── open state ────────────────────────────────────────────── */

/* 0fr → 1fr animates to the content's own height without measuring it. */
.comp-body {
    display: grid; grid-template-rows: 0fr; opacity: 0;
    transition: grid-template-rows .34s cubic-bezier(.22,1,.36,1), opacity .24s;
}
.comp-body > .comp-inner { min-height: 0; overflow: hidden; }
.composer.is-open .comp-body { grid-template-rows: 1fr; opacity: 1; }
.composer.is-open .comp-body > .comp-inner { overflow: visible; }

.comp-top { display: flex; align-items: flex-start; gap: 11px; padding: 14px 14px 10px; }
.comp-id { flex: 1; min-width: 0; }
.comp-id .n { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }

/* The audience reads as a chip, not a form control. */
.aud {
    display: inline-flex; align-items: center; gap: 5px; margin-top: 3px;
    background: var(--bg); border: 1px solid var(--line-2); border-radius: 999px;
    padding: 2px 4px 2px 9px; transition: border-color .15s, background .15s;
}
.aud:hover, .aud:focus-within { border-color: var(--brand-200); background: var(--brand-50); }
.aud .material-symbols-outlined { font-size: 15px; color: var(--ink-3); }
.aud select {
    border: 0; background: 0; padding: 2px 22px 2px 2px; min-height: 0;
    font-family: inherit; font-size: 11.5px; font-weight: 700; color: var(--ink-2);
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 5px center; background-size: 11px;
}
.aud select:focus { outline: 0; }

.comp-close {
    width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--bg); color: var(--ink-3); display: grid; place-items: center;
    transition: background .15s, color .15s, transform .15s;
}
.comp-close:hover { background: var(--red-bg); color: var(--red); transform: rotate(90deg); }
.comp-close .material-symbols-outlined { font-size: 19px; }

/* ── type segmented control ────────────────────────────────── */

.comp-seg {
    display: flex; gap: 3px; margin: 0 14px 12px;
    background: var(--bg); border-radius: 12px; padding: 4px;
}
.comp-type {
    flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; border: 0; background: 0; cursor: pointer; font-family: inherit;
    font-size: 12.5px; font-weight: 700; color: var(--ink-3);
    padding: 8px 6px; border-radius: 9px; white-space: nowrap;
    transition: background .2s, color .2s, box-shadow .2s;
}
.comp-type .material-symbols-outlined { font-size: 17px; }
.comp-type:hover { color: var(--ink-2); }
.comp-type.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(17,24,39,.1); }
.composer[data-type="requirement"] .comp-type.is-on { color: #1D4ED8; }
.composer[data-type="offer"] .comp-type.is-on { color: #047857; }

/* ── body ──────────────────────────────────────────────────── */

.composer textarea {
    width: 100%; border: 0; resize: none; padding: 0 16px 10px;
    font-family: inherit; font-size: 15.5px; line-height: 1.55;
    background: transparent; min-height: 54px; overflow: hidden;
}
.composer textarea:focus { outline: 0; }
.comp-err { padding: 0 16px 8px; }

/* ── goods or service ──────────────────────────────────────── */

.kind-switch {
    display: flex; gap: 6px; margin: 0 0 12px;
}
.kind-opt {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 600; color: var(--ink-2);
    padding: 10px 8px; border-radius: 11px;
    transition: background .16s, border-color .16s, color .16s, box-shadow .16s;
}
.kind-opt .material-symbols-outlined { font-size: 18px; }
.kind-opt:hover { border-color: var(--brand-200); color: var(--brand-deep); }
.kind-opt.is-on {
    background: var(--ink); border-color: var(--ink); color: #fff;
    box-shadow: 0 3px 10px rgba(17,24,39,.2);
}

/* ── spec fields ───────────────────────────────────────────── */

.comp-spec { padding: 2px 14px 4px; }
.spec-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Floating label: the placeholder is a single space, so :placeholder-shown
 * tells us whether the field is empty without any JavaScript. */
.spec-field { position: relative; margin-bottom: 10px; }
.spec-field input {
    width: 100%; padding: 19px 13px 7px; font-size: 14px; font-family: inherit;
    border: 1px solid var(--line-2); border-radius: 11px; background: #fff;
    min-height: 0; transition: border-color .15s, box-shadow .15s;
}
.spec-field input:focus {
    outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249,115,22,.14);
}
.spec-field label {
    position: absolute; left: 14px; top: 13px; pointer-events: none;
    font-size: 13.5px; color: var(--ink-3); font-weight: 500;
    transition: transform .16s cubic-bezier(.22,1,.36,1), font-size .16s, color .16s;
    transform-origin: left top;
}
.spec-field input:focus + label,
.spec-field input:not(:placeholder-shown) + label {
    transform: translateY(-8px) scale(.82); color: var(--ink-2); font-weight: 700;
}
.spec-field input:focus + label { color: var(--brand-deep); }
.spec-field label i { color: var(--red); font-style: normal; }
.spec-field .hint { padding-left: 2px; }

/* ── needed-by ─────────────────────────────────────────────── */

.spec-when {
    display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
    padding: 2px 0 10px;
}
.when-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.when-chips { display: flex; gap: 5px; }
.when-chips button {
    border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-family: inherit;
    font-size: 11.5px; font-weight: 600; color: var(--ink-2);
    padding: 5px 11px; border-radius: 999px; transition: all .15s;
}
.when-chips button:hover { border-color: var(--brand-200); color: var(--brand-deep); }
.when-chips button.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.spec-when input[type="date"] {
    font-size: 12.5px; padding: 5px 9px; min-height: 0; border-radius: 9px;
    border: 1px solid var(--line-2); font-family: inherit; color: var(--ink-2);
}

/* ── live preview ──────────────────────────────────────────── */

.comp-preview {
    position: relative; margin: 4px 0 12px; padding: 20px 10px 10px;
    border: 1px dashed var(--line-2); border-radius: 14px; background: #FCFCFD;
    animation: previewIn .28s cubic-bezier(.22,1,.36,1);
}
@keyframes previewIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.cp-tag {
    position: absolute; top: 7px; left: 12px;
    font-size: 9.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
    color: var(--ink-3);
}
.comp-preview .trade { margin: 0; }

/* ── previews of attachments ───────────────────────────────── */

.comp-previews { display: flex; gap: 8px; padding: 4px 14px 12px; overflow-x: auto; }
.comp-preview-cell {
    position: relative; width: 88px; height: 88px; flex: none;
    border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2);
    background: var(--bg); animation: popIn .3s cubic-bezier(.22,1,.36,1);
}
.comp-preview-cell img, .comp-preview-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-tag {
    position: absolute; left: 6px; top: 6px; background: rgba(17,24,39,.75);
    color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px;
}
@keyframes popIn { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }

/* Shrinking, on the thumbnail of the thing being shrunk.
 *
 * The member picked a 140 MB video and is now writing a caption while it is
 * re-encoded. A bar on the tile says which file is busy without a dialog in
 * the way of the words they are typing. */
.pv-meter {
    position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
    background: rgba(17,24,39,.35);
}
.pv-meter span {
    display: block; height: 100%; width: 0;
    background: var(--brand); transition: width .25s ease;
}

/* "8.2 MB → 0.4 MB", once it is done. */
.pv-note {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: rgba(17,24,39,.78); color: #fff;
    font-size: 9.5px; font-weight: 600; line-height: 1.25;
    padding: 3px 5px; text-align: center;
}

/* ── footer bar ────────────────────────────────────────────── */

.comp-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 12px 12px; border-top: 1px solid var(--line);
}
.comp-bar .grow { flex: 1; }

.comp-icon {
    width: 38px; height: 38px; flex: none; border-radius: 11px; cursor: pointer;
    display: grid; place-items: center; color: var(--ink-2); background: 0;
    border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s;
}
.comp-icon:hover, .comp-icon:focus-visible {
    background: var(--brand-50); color: var(--brand-deep); border-color: var(--brand-200);
}
.comp-icon .material-symbols-outlined { font-size: 21px; }

/* Arriving from the camera button on the reels tab: the composer opens and
   this is what the member is being pointed at. The picker itself cannot be
   opened from a page load — a browser wants a click of their own. */
.comp-icon.is-asked {
    background: var(--brand-50); color: var(--brand-deep);
    box-shadow: 0 0 0 3px var(--brand-200);
    animation: askPulse 1.1s ease-in-out 2;
}
@keyframes askPulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--brand-200); }
    50% { box-shadow: 0 0 0 7px rgba(249,115,22,.16); }
}
@media (prefers-reduced-motion: reduce) {
    .comp-icon.is-asked { animation: none; }
}

.comp-count { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.comp-count.is-near { color: var(--amber); font-weight: 700; }

.comp-post {
    gap: 7px; padding-left: 20px; padding-right: 18px;
    transition: opacity .2s, transform .15s, box-shadow .2s;
}
.comp-post .material-symbols-outlined { font-size: 17px; }
.comp-post:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.comp-post:not(:disabled) { box-shadow: 0 4px 14px rgba(249,115,22,.34); }

/* ── "as chapter" switch ───────────────────────────────────── */

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
    width: 38px; height: 22px; border-radius: 999px; background: var(--line-2);
    position: relative; flex: none; transition: background .2s;
}
.switch .knob {
    position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(17,24,39,.3);
    transition: transform .22s cubic-bezier(.22,1,.36,1);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track .knob { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(249,115,22,.25); }
.switch-lbl { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.switch input:checked ~ .switch-lbl { color: var(--brand-deep); }

@media (max-width: 460px) {
    .comp-quick button { font-size: 12px; gap: 5px; }
    .comp-type .lbl { display: none; }
    .comp-type { padding: 9px 4px; }
    .spec-row { grid-template-columns: 1fr; gap: 0; }
    .comp-bar { gap: 8px; }
    .switch-lbl { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .comp-body, .spec-field label, .switch .knob, .comp-post { transition: none; }
    .comp-preview, .comp-preview-cell { animation: none; }
}
