/* =========================================================================
   摇小树 · 画报 —— Astra 主题纯布局版
   只写：grid / gap / display / position / z-index / aspect-ratio / object-fit / max-height
   颜色 / 字号 / 字重 / 圆角 / 背景 / 阴影 / 边框 —— 全部调用 Astra 主题
   PHP 输出时直接加 .button.button-primary / .wp-block-group.is-layout-constrained / has-ast-global-color-4-background-color
   ========================================================================= */

/* ---- 详情页 ---- */
/* 关键：Astra .ast-container 是 display:flex，但没给子元素 flex-grow:1
   所以我们的 MAIN 只有内容宽度（~600px）而不是充满容器（~960px）
   必须显式让它占满！ */
.yxs-huabao-single {
    width: 100% !important;
    max-width: none !important;
    flex-grow: 1 !important;
    flex-basis: 0 !important;
    margin-bottom: 2.5em;
}
/* 正文与上方 Astra 标题/封面区拉开间距 */
.yxs-huabao-content { margin-top: 2.5em; }
.yxs-huabao-related-products { margin: 3em 0 2em; }
.yxs-huabao-related-products h3 { margin-bottom: 1em; }
/* 商品详情页：相关画报区块（走 Astra 字号/颜色/边框，无内联样式） */
.yxs-huabao-on-product { margin-top: 2.5em; padding-top: 1.5em; border-top: 1px solid var(--ast-border-color); }
.yxs-huabao-on-product-title { margin: 0 0 1em; }
.yxs-huabao-nav { display: flex; justify-content: space-between; gap: 1.5em; margin: 2.5em 0; }
.yxs-huabao-nav-prev, .yxs-huabao-nav-next { flex: 1; }
.yxs-huabao-nav-next { text-align: right; }

/* ---- 商品页相关画报 ---- */
.yxs-huabao-on-product { margin-top: 2.5em; padding-top: 1.5em; border-top: 1px solid var(--ast-border-color); }
.yxs-huabao-related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1em; }
@media (max-width: 768px) { .yxs-huabao-related-grid { grid-template-columns: repeat(2, 1fr); } }
.yxs-huabao-related-item { display: block; overflow: hidden; text-decoration: none; }
.yxs-huabao-related-thumb { aspect-ratio: 4/3; overflow: hidden; }
.yxs-huabao-related-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yxs-huabao-related-info { padding: .6em .75em; }
.yxs-huabao-related-info h4 { margin: 0 0 .3em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yxs-huabao-author img { width: 16px; height: 16px; border-radius: 50%; vertical-align: middle; margin-right: .3em; }

/* ---- 投稿表单（Astra body typography 自动接管字体/字号/颜色） ---- */
.yxs-huabao-form { max-width: 640px; margin: 2em auto; }
/* 移动端底部留白：避免"存草稿/提交审核"被底部固定栏或安全区遮挡 */
@media (max-width: 768px) {
    .yxs-huabao-form { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
/* 页面标题行 —— 左标题 + 右侧「我的画报」入口 */
.yxs-huabao-form-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; margin: 0 0 1.2em; }
.yxs-huabao-form-heading h2 { margin: 0; }
.yxs-huabao-form-heading-link { white-space: nowrap; }
.yxs-huabao-form-row { margin-bottom: 1.8em; }
.yxs-huabao-form-row-product { border-top: 1px solid var(--ast-border-color); padding-top: 1.8em; }
/* label —— Astra button 会给 button 元素的 color 但这里是 label，直接 inherit body color */
.yxs-huabao-form-label { display: block; margin-bottom: .4em; font-weight: var(--font-weight-strong); color: inherit; }
.yxs-huabao-form-hint { margin-top: .5em; opacity: .6; }
.yxs-huabao-form-hint-inline { opacity: .6; }

.yxs-huabao-form input[type="text"],
.yxs-huabao-form textarea { display: block; width: 100%; box-sizing: border-box; }
.yxs-huabao-form textarea { min-height: 240px; resize: vertical; }

.yxs-huabao-form-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1em;
    margin-top: 1.5em; padding-top: 1em; border-top: 1px solid var(--ast-border-color);
    justify-content: center;
}
/* 按钮层级：
   .yxs-huabao-submit-btn —— 主按钮：继承 Astra .button-primary（黑底白字）
   .yxs-huabao-draft-btn  —— 次按钮：透明底 + 黑边 + 黑字描边
   .yxs-mine-goto-draft   —— 次按钮（我的投稿 Header 的草稿入口）：描边
*/
.yxs-huabao-draft-btn,
button.yxs-huabao-draft-btn,
.yxs-mine-goto-draft,
button.yxs-mine-goto-draft {
    background: transparent !important;
    color: var(--ast-global-color-1) !important;
    border: 1px solid var(--ast-global-color-1) !important;
}
/* 搜索结果底部"添加选中/取消"也是描边 */
.yxs-product-search-actions .button-secondary,
.yxs-product-search-actions .yxs-product-cancel {
    background: transparent !important;
    color: var(--ast-global-color-1) !important;
    border: 1px solid var(--ast-global-color-1) !important;
}

.yxs-huabao-form-status { margin-bottom: 1em; text-align: center; }
.yxs-huabao-status-badge { display: inline-block; padding: .1em .6em; border-radius: 1em; margin-left: .3em; }
.yxs-huabao-reject-notice { border-left: 3px solid #c33; padding: .75em 1em; margin-bottom: 1.5em; }

/* 登录提示 */
.yxs-huabao-login-notice { text-align: center; padding: 3em 1em; margin: 2em auto; max-width: 480px; }
.yxs-huabao-login-notice .button { margin-top: 1em; }

/* 封面图 —— 宽度占满，高度按原图比例 */
.yxs-huabao-thumb-uploader { display: block; }
.yxs-huabao-thumb-preview {
    width: 100%;
    min-height: 180px;
    border: 1px dashed var(--ast-border-color);
    border-radius: 6px;
    background: #fafaf8;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.yxs-huabao-thumb-preview.has-image {
    min-height: 0;
    border-style: solid;
    background: #fff;
}
.yxs-huabao-thumb-preview img {
    display: block;
    width: 100%;
    height: auto;
}
.yxs-huabao-thumb-remove { display: inline-block; margin-top: .6em; border: none; background: none; cursor: pointer; padding: 0; text-decoration: underline; opacity: .6; }

/* 标签 chip */
.yxs-huabao-tags-selected { display: flex; flex-wrap: wrap; gap: .4em; margin-top: .4em; }
.yxs-huabao-tag-chip { display: inline-flex; align-items: center; gap: .3em; padding: .15em .7em; }
.yxs-huabao-tag-x { cursor: pointer; opacity: .6; }

/* ---- 商品选择器 ---- */
.yxs-huabao-product-selector { position: relative; }

.yxs-product-search-results {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 50;
    margin-top: .25em; max-height: 320px; overflow-y: auto;
    display: none;
    border: 1px solid var(--ast-border-color);
    /* 关键：必须有背景！不然底下表单内容透出来 */
    background: var(--ast-global-color-5);
}
.yxs-product-row { display: flex; align-items: center; gap: .6em; padding: .55em .8em; cursor: pointer; border-bottom: 1px solid var(--ast-border-color); background: var(--ast-global-color-5); }
.yxs-product-row:last-child { border-bottom: none; }
.yxs-product-row.is-disabled { opacity: .45; cursor: default; }
.yxs-product-row.is-selected { background: var(--ast-global-color-4); }
.yxs-product-row img { flex-shrink: 0; }
.yxs-product-row-thumb-empty { width: 40px; height: 40px; flex-shrink: 0; background: var(--ast-global-color-4); }
.yxs-product-row-info { flex: 1; min-width: 0; }
.yxs-product-row-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yxs-product-row-sku { display: block; opacity: .55; }
.yxs-product-empty { padding: 1em; text-align: center; opacity: .55; }

/* 搜索结果底部操作条（JS 控制 display） */
.yxs-product-search-actions {
    padding: .75em 1em;
    display: flex; gap: .5em; align-items: center; justify-content: space-between;
    border-top: 1px solid var(--ast-border-color);
    background: var(--ast-global-color-4);
}
.yxs-product-selected-count { opacity: .7; font-size: var(--font-size-md); }
.yxs-product-search-actions-buttons { display: flex; gap: .5em; }

.yxs-product-selected {
    display: flex; flex-wrap: wrap; gap: .4em; margin-top: .7em;
    padding: .6em;
    border: 1px dashed var(--ast-border-color);
    min-height: 40px;
    background: var(--ast-global-color-4);
}
.yxs-product-selected:empty::before { content: '搜索并选择商品，这里会出现已关联的商品'; opacity: .55; line-height: 28px; padding-left: .3em; }
.yxs-product-chip {
    display: inline-flex; align-items: center; gap: .4em;
    padding: .2em .6em .2em .2em;
    border: 1px solid var(--ast-border-color);
}
.yxs-product-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.yxs-product-chip-name { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yxs-product-chip-remove { border: none; background: none; cursor: pointer; padding: 0 .2em; opacity: .5; }

/* ---- 我的投稿 ---- */
/* 我的画报：不设自定义宽/左右内边距，直接沿用 Astra 容器间距，与其他页面一致 */
.yxs-huabao-mine { margin: 2.5em 0; }
@media (max-width: 768px) {
    .yxs-huabao-mine { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
.yxs-huabao-mine-header { display: flex; align-items: center; justify-content: space-between; gap: 1em; margin-bottom: 1.5em; }
.yxs-huabao-mine-header-actions { display: flex; align-items: center; gap: .5em; }
.yxs-huabao-empty { text-align: center; padding: 5em 1em; }

/* Tabs —— 切点下划线（::after currentColor 继承 Astra）
   关键：Astra 全局 .button, button { color:#fff } 会匹配 .yxs-mine-tab
   必须显式覆写颜色！ */
.yxs-huabao-mine-tabs { display: flex; justify-content: center; gap: 2.5em; margin-bottom: 2em; padding-bottom: 0; }
@media (max-width: 560px) {
    .yxs-huabao-mine-tabs { flex-wrap: nowrap; gap: 1.5em; overflow-x: auto; -webkit-overflow-scrolling: touch; justify-content: flex-start; }
}
.yxs-mine-tab, .yxs-mine-tab:hover, .yxs-mine-tab.active,
button.yxs-mine-tab {
    color: var(--ast-global-color-1) !important;
    background: transparent !important;
    border: none !important;
}
.yxs-mine-tab {
    cursor: pointer;
    padding: .5em 0; display: inline-flex; align-items: center; gap: .4em;
    white-space: nowrap; position: relative;
    opacity: .5; transition: opacity .15s ease, font-weight .15s ease;
}
.yxs-mine-tab::after {
    content: ''; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
    height: 2px; width: 0; background: currentColor; transition: width .2s ease;
}
.yxs-mine-tab:hover { opacity: .7; font-weight: var(--font-weight-strong); }
.yxs-mine-tab:hover::after { width: 60%; }
.yxs-mine-tab.active { opacity: 1; font-weight: var(--font-weight-strong); }
.yxs-mine-tab.active::after { width: 100%; }
.yxs-mine-tab-count { padding: 0 .5em; border-radius: 999px; min-width: 1.5em; text-align: center; }

/* 卡片网格 */
.yxs-huabao-mine-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) { .yxs-huabao-mine-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .yxs-huabao-mine-grid { grid-template-columns: 1fr; } }

.yxs-huabao-mine-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--ast-border-color); }
.yxs-huabao-mine-card[hidden] { display: none; }
.yxs-huabao-mine-card-thumb { position: relative; aspect-ratio: 3/4; overflow: hidden; }
.yxs-huabao-mine-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yxs-thumb-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

.yxs-card-status-badge {
    position: absolute; top: 10px; right: 10px;
    display: inline-flex; align-items: center; padding: 2px 10px;
    border-radius: 999px; line-height: 1.5; white-space: nowrap;
}

.yxs-huabao-mine-card-main { display: block; flex: 1; color: inherit; text-decoration: none; }
.yxs-huabao-mine-card-body { padding: 1em; display: flex; flex-direction: column; gap: .35em; }
/* 卡片标题必须压 Astra 默认 h4 */
.yxs-huabao-mine-card-title, h4.yxs-huabao-mine-card-title {
    margin: 0 !important; font-size: var(--font-size-base) !important;
    font-weight: var(--font-weight-medium) !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4;
}
.yxs-huabao-mine-card-meta { opacity: .6; font-size: var(--font-size-md); }
.yxs-huabao-mine-card-reject { padding: 6px 10px; line-height: 1.4; }
.yxs-huabao-mine-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding: 0 1em 1em; }
/* 查看奖励 —— 文字链样式，跟日期 meta 一样小
   覆盖 Astra .button 默认黑底 */
.yxs-huabao-mine-card-actions .yxs-huabao-reward-btn,
.yxs-huabao-reward-btn {
    background: transparent !important;
    color: var(--ast-global-color-1) !important;
    border: none !important;
    padding: 0 !important;
    font-size: var(--font-size-md) !important;  /* 跟日期 meta 一样小 */
    font-weight: 400 !important;
    text-decoration: underline !important;
    border-radius: 0 !important;
}

/* ---- 奖励弹窗 ---- */
.yxs-reward-modal { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; padding: 16px; }
.yxs-reward-modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.yxs-reward-modal-box {
    position: relative; z-index: 1;
    width: 100%; max-width: 420px; margin: 0;
    padding: 2.5em 2em 2em; text-align: center;
    background: var(--ast-global-color-5);
    border: 1px solid var(--ast-border-color);
    border-radius: 8px;
    max-height: calc(100vh - 32px); overflow-y: auto;
}
.yxs-reward-modal-close { position: absolute; top: 12px; right: 14px; border: none; background: none; cursor: pointer; font-size: 22px; line-height: 1; color: var(--ast-global-color-1); }
.yxs-reward-modal-box h3 { margin: 0 0 .5em; }
.yxs-reward-desc { margin: 0 0 1em; line-height: 1.6; opacity: .8; }
.yxs-reward-code {
    padding: 1.2em 1em; letter-spacing: 3px; margin: 1em 0 .5em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    border-radius: 8px;
    background: var(--ast-global-color-1);
    color: var(--ast-global-color-5);
    word-break: break-all;
}
.yxs-reward-expire { opacity: .5; margin-bottom: 1.25em; }
.yxs-reward-copy-btn { width: 100%; }
.yxs-reward-copied { margin-top: 12px; font-weight: var(--font-weight-medium); }

/* ---- FAB（画报首页专用，点击直接跳转投稿页）
   背景/颜色/圆角全部走 Astra .button，这里只补定位和尺寸
   注意：Astra 的 .button 自带 position:relative，必须 !important 压回 fixed ---- */
.yxs-huabao-fab {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: 70px !important;
    transform: translateX(-50%) !important;
    margin: 0 !important;
    z-index: 9998;
    padding: 1em 2.6em !important;
    font-size: var(--font-size-lg) !important;
    border-radius: 999px !important;
    text-decoration: none !important;
}
@media (max-width: 768px) {
    .yxs-huabao-fab { bottom: calc(102px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ---- 投稿类型：晒作品 / 晒情绪 ---- */
.yxs-huabao-types { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.yxs-huabao-type {
    position: relative;
    -webkit-appearance: none;
    appearance: none;
    text-align: left;
    cursor: pointer;
    padding: 14px 16px 12px;
    border: 1px solid var(--ast-border-color, #dcdcdc);
    border-radius: 6px;
    color: #111;
    font: inherit;
    line-height: 1.5;
    box-shadow: none;
    transition: border-color .15s, background .15s;
    background-color: #fff;
}
/* 主题按钮样式（Astra）会在 hover/active 把文字改成白色，这里明确锁定颜色 */
.yxs-huabao-type:hover,
.yxs-huabao-type:focus,
.yxs-huabao-type:active {
    color: #111;
    background-color: #fff;
    border-color: #aaa;
    box-shadow: none;
}
.yxs-huabao-type.is-active,
.yxs-huabao-type.is-active:hover,
.yxs-huabao-type.is-active:focus,
.yxs-huabao-type.is-active:active {
    color: #111;
    background-color: #fcfcfa;
    border-color: #111;
}
.yxs-huabao-type.is-active::after {
    content: "";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #111;
    box-shadow: inset 0 0 0 3px #fff;
}
.yxs-huabao-type-title { display: block; font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.yxs-huabao-type-desc { display: block; font-size: 13px; opacity: .65; line-height: 1.5; }
.yxs-huabao-type-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 1px 8px;
    border: 1px solid var(--ast-border-color, #dcdcdc);
    border-radius: 999px;
    font-size: 12px;
    opacity: .7;
}
.yxs-huabao-type-badge.is-req { border-color: #111; opacity: 1; }
@media (max-width: 480px) {
    .yxs-huabao-types { grid-template-columns: 1fr; }
}
