/* ==========================================================================
   forms.css — full-page Add / Edit forms (admin/products/add.js + future pages).
   ========================================================================== */

.form-page {
    max-width: 100%;
}

/* The Add/Edit form is a plain page — no card chrome around the inputs. */
.form-page .panel-box {
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.form-page .section-label {
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
}

/* "?" help badge (uses the shared .tip tooltip, but wrapping + wider). */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
    margin-left: 5px;
}
.help-tip:hover {
    color: var(--brand-2);
    border-color: var(--brand);
}
.help-tip.tip::after {
    left: 0;
    right: auto;
    white-space: normal;
    width: 260px;
    line-height: 1.5;
    /* This tooltip is descriptive prose. Undo the uppercase it inherits from the
       .section-label and the base tooltip's heavier weight. */
    text-transform: none;
    font-weight: 400;
}

/* Fields stack full-width by default; on wide screens (PC) lay them out 2-up
   with a small gap so the inputs aren't stretched across the whole page.
   Textarea + image fields (.ff-wide) always span the full row. */
@media (min-width: 1280px) {
    .form-page .ff-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 2px 22px;
    }
    .form-page .ff-grid .ff {
        flex: 1 1 calc(50% - 22px);
        min-width: 240px;
    }
    .form-page .ff-grid .ff-wide {
        flex-basis: 100%;
    }
    .form-page .ff-grid .ff-3 {
        flex: 1 1 calc(33.333% - 15px);
        min-width: 200px;
    }
    .form-page .ff-grid .ff label {
        margin-top: 10px;
    }
}

/* Action bar under the form. */
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 16px;
}
.form-actions .btn-primary,
.form-actions .btn-ghost {
    min-width: 130px;
    justify-content: center;
    text-align: center;
}

@media (max-width: 560px) {
    .form-actions {
        flex-direction: column-reverse;
    }
    .form-actions .btn-primary,
    .form-actions .btn-ghost {
        width: 100%;
    }
}

/* Variant matrix — colour/type photo cell shows a 100×100 preview once uploaded. */
.vphoto {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.vthumb {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex: 0 0 auto;
}

/* ==========================================================================
   Coupon add — Larkon-style stacked cards (header bar + divider + body),
   centred column, with selectable brand "coupon type" cards.
   ========================================================================== */
.cp-add {
    max-width: 820px;
    margin: 0 auto;
}
.cp-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 20px;
}
.cp-card-hd {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 15px;
}
.cp-card-bd {
    padding: 18px;
}
.cp-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 560px) {
    .cp-types {
        grid-template-columns: 1fr;
    }
}
.cp-type {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s;
}
.cp-type:hover {
    border-color: var(--brand);
}
.cp-type.sel {
    border-color: var(--brand);
    background: rgba(43, 110, 240, 0.08);
}
.cp-type-ic {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 800;
    color: var(--brand-2);
    background: rgba(43, 110, 240, 0.12);
}
.cp-type.sel .cp-type-ic {
    background: var(--brand);
    color: #fff;
}
.cp-type-tx b {
    display: block;
    font-size: 14px;
}
.cp-type-tx small {
    color: var(--muted);
    font-size: 12px;
}
/* "Applies to" badge in the coupon list */
.cp-scope-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-2);
    background: rgba(43, 110, 240, 0.12);
    white-space: nowrap;
}

/* ==========================================================================
   Multi-image gallery uploader (Premium products / dishes).
   ========================================================================== */
.gal-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.gal-item {
    position: relative;
    width: 92px;
    height: 92px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--panel-2);
    flex: 0 0 auto;
}
.gal-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gal-cover {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 1;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    border-radius: 5px;
    padding: 1px 6px;
}
.gal-x {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(16, 24, 40, 0.72);
    color: #fff;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gal-add {
    width: 92px;
    height: 92px;
    border-radius: 10px;
    border: 1.5px dashed var(--border);
    background: var(--panel-2);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    cursor: pointer;
    flex: 0 0 auto;
}
.gal-add:hover {
    border-color: var(--brand);
    color: var(--brand-2);
}

/* ==========================================================================
   Store policies — clean list; each row opens its own plain-text edit page.
   ========================================================================== */
.pol-page,
.pol-edit {
    /* max-width: 680px; */
}
.pol-intro {
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.55;
    margin: 0 0 16px;
    text-align: left;
}
.pol-list {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2,1fr);
}
@media screen and (max-width:768px) {
    .pol-list{
        grid-template-columns: repeat(1,1fr);
    }
}
.pol-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    text-align: left;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s;
}
.pol-row:hover {
    border-color: var(--brand);
    background: var(--panel-2);
}
.pol-row-tx {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    text-align: left;
}
.pol-row-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
}
.pol-row-sub {
    font-size: 12.5px;
}
.pol-set {
    color: var(--ok);
    font-weight: 600;
}
.pol-empty {
    color: var(--muted);
}
.pol-row-arr {
    color: var(--muted);
    font-size: 22px;
    font-weight: 700;
    flex: 0 0 auto;
}
.pol-textarea {
    width: 100%;
    min-height: 340px;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    font-family: inherit;
    resize: vertical;
}
.pol-textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(43, 110, 240, 0.12);
}

/* Simple rich text editor (store policies) */
.rich-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--panel);
}
.rich-wrap:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(43, 110, 240, 0.12);
}
.rich-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-2);
}
.rich-btn {
    min-width: 32px;
    height: 30px;
    padding: 0 9px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    border-radius: 7px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.rich-btn:hover {
    background: var(--panel);
    border-color: var(--border);
}
.rich-btn.on {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.rich-btn svg {
    display: block;
    width: 1em;
    height: 1em;
}
/* Toolbar block-format dropdown — override the global full-width select. */
.rich-select {
    width: auto;
    height: 30px;
    margin: 0;
    padding: 0 8px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel);
    color: var(--text);
}
.rich-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}
.rich-editor {
    min-height: 300px;
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    text-align: left;
    outline: none;
    overflow-y: auto;
}
.rich-editor:empty::before {
    content: attr(data-ph);
    color: var(--muted);
}
.rich-editor ul,
.rich-editor ol {
    padding-left: 22px;
    margin: 8px 0;
}
.rich-editor h3 {
    font-size: 17px;
    margin: 12px 0 6px;
}
