/* ============================================================
   留言板插件 —— 便利贴留言墙样式 v2.0
   模糊照片背景墙 + 半透明彩色便利贴错落叠加
   配色方案通过 CSS 变量切换，由前台内联 <style> 注入
   ============================================================ */

/* ---------- 主题变量（默认暖阳，被前台内联覆盖） ---------- */
.ly-wall {
    --ly-bg-color: #7a6450;
    --ly-overlay: rgba(40, 32, 24, .18);
    --ly-accent: rgba(255, 255, 255, .92);
    --ly-accent-text: #5b4636;
    --ly-accent-hover: #fff;
    --ly-name-color: #ff46d2;
    --ly-panel-bg: rgba(255, 255, 255, .16);
    --ly-panel-border: rgba(255, 255, 255, .28);
    --ly-input-bg: rgba(255, 255, 255, .14);
    --ly-input-bg-focus: rgba(255, 255, 255, .22);
    --ly-text: #fff;
    --ly-text-muted: rgba(255, 255, 255, .72);
}

/* ---------- 背景墙容器 ---------- */
.ly-wall {
    position: relative;
    min-height: 100vh;
    margin: 0 -15px;
    background: url('../wall.jpg') center center / cover no-repeat fixed;
    background-color: var(--ly-bg-color);
    font-family: var(--ly-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif);
    font-weight: 400;
}

.ly-wall::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--ly-overlay);
    pointer-events: none;
}

/* ---------- CSS 网格背景（后台「背景墙设置」可随时切换） ----------
   复刻 JOE 的背景：白底 + 极淡深褐色发丝线细密网格
   网格线 rgba(60,10,30,.04)、间距 20px（取自该站 body::before 计算样式） */
.ly-wall-bg-css {
    --ly-overlay: transparent;
    --ly-text: #33333a;
    --ly-text-muted: rgba(0, 0, 0, .45);
    --ly-panel-bg: rgba(255, 255, 255, .78);
    --ly-panel-border: rgba(0, 0, 0, .09);
    --ly-input-bg: rgba(245, 245, 248, .72);
    --ly-input-bg-focus: #ffffff;
    --ly-accent: #4a90ff;
    --ly-accent-text: #ffffff;
    --ly-accent-hover: #3a7ff0;
    --ly-name-color: #d6339c;
    background-color: #ffffff;
    background-image:
        linear-gradient(90deg, rgba(60, 10, 30, .04) 3%, rgba(0, 0, 0, 0) 0),
        linear-gradient(180deg, rgba(60, 10, 30, .04) 3%, rgba(0, 0, 0, 0) 0);
    background-size: 20px 20px, 20px 20px;
    background-repeat: repeat, repeat;
    background-position: 0 0;
    background-attachment: scroll;
}

/* 浅色网格下：标题改为浅底深字 */
.ly-wall-bg-css .ly-wall-title {
    color: var(--ly-text);
    background: rgba(255, 255, 255, .75);
    border-color: rgba(0, 0, 0, .1);
    text-shadow: none;
}

/* 筛选输入框 / 按钮的浅色描边在白底上不可见，改为淡灰描边 */
.ly-wall-bg-css .ly-filter-input,
.ly-wall-bg-css .ly-filter-date {
    border-color: rgba(0, 0, 0, .14);
}

.ly-wall-bg-css .ly-filter-input:focus,
.ly-wall-bg-css .ly-filter-date:focus {
    border-color: rgba(0, 0, 0, .32);
}

.ly-wall-bg-css .ly-filter-clear {
    color: var(--ly-text);
    background: rgba(255, 255, 255, .6);
    border-color: rgba(0, 0, 0, .12);
}

.ly-wall-bg-css .ly-filter-clear:hover {
    background: #ffffff;
}

/* 表单输入框：淡灰描边 + 蓝色聚焦光晕 */
.ly-wall-bg-css input[type="text"],
.ly-wall-bg-css textarea {
    border-color: rgba(0, 0, 0, .14);
}

.ly-wall-bg-css input[type="text"]:focus,
.ly-wall-bg-css textarea:focus {
    border-color: rgba(0, 0, 0, .32);
    box-shadow: 0 0 0 3px rgba(74, 144, 255, .12);
}

/* 分页：淡灰描边 */
.ly-wall-bg-css .ly-pagination a,
.ly-wall-bg-css .ly-pagination span {
    border-color: rgba(0, 0, 0, .12);
}

.ly-wall-bg-css .ly-pagination a:hover {
    background: #ffffff;
}

.ly-wall-inner {
    position: relative;
    z-index: 1;
    max-width: 1080px;
    margin: 0 auto;
    padding: 40px 18px 55px;
    box-sizing: border-box;
}

/* ---------- 标题 ---------- */
.ly-wall-title {
    display: inline-block;
    margin: 0;
    padding: 10px 30px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 5px;
    color: var(--ly-text);
    background: rgba(0, 0, 0, .28);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 30px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    white-space: nowrap;
}

/* ---------- 工具栏（标题+筛选） ---------- */
.ly-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.ly-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ly-filter-input,
.ly-filter-date {
    padding: 7px 12px;
    font-size: 13px;
    color: var(--ly-text);
    background: var(--ly-input-bg);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 20px;
    outline: none;
    font-family: inherit;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: border-color .2s, background .2s;
    box-sizing: border-box;
}

.ly-filter-input {
    width: 130px;
}

.ly-filter-date {
    width: 150px;
    color-scheme: dark;
}

.ly-filter-input::placeholder {
    color: var(--ly-text-muted);
}

.ly-filter-input:focus,
.ly-filter-date:focus {
    border-color: rgba(255, 255, 255, .7);
    background: var(--ly-input-bg-focus);
}

/* ---------- 首行：返回主页导航 ---------- */
.ly-home-nav {
    display: flex;
    margin-bottom: 18px;
}

.ly-home-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.ly-home-arrow {
    font-size: 16px;
    font-weight: 700;
}

.ly-filter-btn,
.ly-home-link {
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ly-accent-text);
    background: var(--ly-accent);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background .2s, transform .15s;
}

.ly-filter-btn:hover,
.ly-home-link:hover {
    color: var(--ly-accent-text);
    background: var(--ly-accent-hover);
    transform: translateY(-1px);
}

.ly-filter-clear {
    padding: 7px 14px;
    font-size: 13px;
    color: var(--ly-text);
    text-decoration: none;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 20px;
    transition: background .2s;
}

.ly-filter-clear:hover {
    background: rgba(255, 255, 255, .24);
}

/* ---------- 提示条 ---------- */
.ly-alert {
    padding: 11px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
    animation: ly-fade-in .3s ease;
}

.ly-alert-error {
    color: #ffe9e9;
    background: rgba(214, 60, 60, .75);
    border-color: rgba(255, 255, 255, .25);
}

.ly-alert-success {
    color: #eafff2;
    background: rgba(32, 160, 95, .75);
    border-color: rgba(255, 255, 255, .25);
}

/* ---------- 留言板公告（宽度与发布留言框一致） ---------- */
.ly-announce {
    max-width: 560px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--ly-panel-bg);
    border: 1px solid var(--ly-panel-border);
    border-left: 4px solid var(--ly-accent);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 18px;
    box-sizing: border-box;
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .12);
}

.ly-announce-tag {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--ly-accent-text);
    background: var(--ly-accent);
    border-radius: 6px;
    padding: 3px 9px;
    margin-top: 2px;
}

.ly-announce-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ly-text);
    word-break: break-word;
}

/* ---------- 留言表单（点击三角箭头展开） ---------- */
.ly-form-card {
    max-width: 560px;
    background: var(--ly-panel-bg);
    border: 1px solid var(--ly-panel-border);
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 34px;
    box-sizing: border-box;
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    box-shadow: 0 12px 36px rgba(0, 0, 0, .18);
}

/* 折叠头：整条可点击 */
.ly-form-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.ly-form-toggle-text {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--ly-text);
}

/* 三角箭头（CSS 绘制，展开时顺时针旋转 90°） */
.ly-form-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 9px;
    border-color: transparent transparent transparent var(--ly-text);
    margin-right: 10px;
    transition: transform .22s ease;
}

.ly-form-card:not(.ly-collapsed) .ly-form-arrow {
    transform: rotate(90deg);
}

/* 折叠状态：隐藏表单，折叠头成为唯一可见内容 */
.ly-form-card.ly-collapsed #ly-form {
    display: none;
}

.ly-form-card:not(.ly-collapsed) .ly-form-toggle {
    margin-bottom: 18px;
}

.ly-form-row {
    margin-bottom: 14px;
}

.ly-form-row:last-child {
    margin-bottom: 0;
}

.ly-wall input[type="text"],
.ly-wall textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    color: var(--ly-text);
    background: var(--ly-input-bg);
    outline: none;
    font-family: inherit;
    transition: background .2s, border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.ly-wall input::placeholder,
.ly-wall textarea::placeholder {
    color: var(--ly-text-muted);
}

.ly-wall input[type="text"]:focus,
.ly-wall textarea:focus {
    border-color: rgba(255, 255, 255, .75);
    background: var(--ly-input-bg-focus);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .08);
}

.ly-wall textarea {
    min-height: 96px;
    resize: vertical;
    display: block;
}

.ly-counter {
    text-align: right;
    font-size: 12px;
    color: var(--ly-text-muted);
    margin-top: 5px;
}

/* 验证码 */
.ly-captcha-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ly-captcha-row input {
    flex: 1;
}

#ly-captcha-img {
    width: 110px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .9);
    transition: opacity .15s;
}

#ly-captcha-img:hover {
    opacity: .85;
}

/* 提交按钮 */
#ly-submit-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    background: var(--ly-accent);
    color: var(--ly-accent-text);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 3px;
    padding: 13px 0;
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, background .2s;
}

#ly-submit-btn:hover {
    background: var(--ly-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .22);
}

#ly-submit-btn:active {
    transform: translateY(0);
}

#ly-submit-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   便利贴区域（自由散布画布：随机分布、可重叠、可拖动）
   ============================================================ */
.ly-notes {
    position: relative;
    width: 100%;
}

.ly-empty {
    color: var(--ly-text-muted);
    font-size: 15px;
    padding: 50px 0;
    text-align: center;
}

.ly-note {
    position: absolute;
    top: 0;
    left: 0;
    width: 220px;
    margin: 0;
    cursor: grab;
    /* 触摸拖拽时不触发页面滚动 */
    touch-action: none;
    will-change: left, top;
    animation: ly-note-in .4s cubic-bezier(.2, .8, .3, 1.1) backwards;
}

/* 拖动中：抓取手势 + 置顶 + 暂停贴纸本体的放大与过渡 */
.ly-note.ly-dragging {
    cursor: grabbing;
}

.ly-note.ly-dragging .ly-note-paper {
    transform: none;
    transition: none;
    box-shadow:
        0 6px 14px rgba(0, 0, 0, .22),
        0 28px 54px rgba(0, 0, 0, .36),
        inset 0 1px 0 rgba(255, 255, 255, .32);
}

/* 按下但尚未真正拖动：轻微下压，平滑过渡，避免 hover 放大 → 拖拽缩回的跳变 */
.ly-note.ly-pressed .ly-note-paper {
    transform: scale(1.02);
    transition: transform .1s ease-out;
}

/* 拖拽期间禁止选中文本（加在 body 上） */
.ly-noselect,
.ly-noselect * {
    user-select: none;
    -webkit-user-select: none;
    cursor: grabbing;
}

.ly-note:nth-child(1) { animation-delay: .02s; }
.ly-note:nth-child(2) { animation-delay: .06s; }
.ly-note:nth-child(3) { animation-delay: .10s; }
.ly-note:nth-child(4) { animation-delay: .14s; }
.ly-note:nth-child(5) { animation-delay: .18s; }
.ly-note:nth-child(6) { animation-delay: .22s; }
.ly-note:nth-child(7) { animation-delay: .26s; }
.ly-note:nth-child(8) { animation-delay: .30s; }
.ly-note:nth-child(n+9) { animation-delay: .34s; }

@keyframes ly-note-in {
    from { opacity: 0; transform: translateY(18px) scale(.92); }
    to   { opacity: 1; }
}

/* 贴纸本体 */
.ly-note-paper {
    position: relative;
    padding: 15px 17px 14px;
    border-radius: 5px;
    color: #fff;
    backdrop-filter: blur(8px) saturate(1.25);
    -webkit-backdrop-filter: blur(8px) saturate(1.25);
    box-shadow:
        0 2px 5px rgba(0, 0, 0, .18),
        0 10px 24px rgba(0, 0, 0, .22),
        inset 0 1px 0 rgba(255, 255, 255, .3);
    transition: transform .25s cubic-bezier(.2, .8, .3, 1.3), box-shadow .25s;
    overflow: hidden;
}

.ly-note-paper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 42%;
    background: linear-gradient(rgba(255, 255, 255, .14), rgba(255, 255, 255, 0));
    pointer-events: none;
}

/* 顶部图钉装饰 */
.ly-note-paper::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, .45);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .3), inset 0 1px 1px rgba(255, 255, 255, .6);
    z-index: 1;
}

.ly-note-date {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .5px;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px dashed rgba(255, 255, 255, .75);
    opacity: .9;
}

.ly-note-text {
    font-size: 15px;
    line-height: 1.65;
    word-break: break-word;
    min-height: 20px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}

.ly-note-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 13px;
    gap: 8px;
}

.ly-note-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .28);
    flex-shrink: 0;
}

.ly-note-name {
    color: var(--ly-name-color);
    font-size: 15px;
    font-weight: 600;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.ly-note:hover {
    z-index: 20;
}

.ly-note:hover .ly-note-paper {
    transform: scale(1.07) rotate(0deg) translateY(-6px);
    box-shadow:
        0 4px 10px rgba(0, 0, 0, .2),
        0 24px 48px rgba(0, 0, 0, .34),
        inset 0 1px 0 rgba(255, 255, 255, .32);
}

/* ============================================================
   管理员回复（折叠区）
   ============================================================ */
.ly-note-reply {
    margin-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, .4);
    padding-top: 8px;
}

.ly-reply-toggle {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, .9);
    background: rgba(0, 0, 0, .2);
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s;
    outline: none;
}

.ly-reply-toggle:hover {
    background: rgba(0, 0, 0, .32);
}

.ly-reply-toggle.ly-reply-open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.ly-reply-body {
    padding: 8px 12px 6px;
    background: rgba(0, 0, 0, .18);
    border: 1px solid rgba(255, 255, 255, .2);
    border-top: none;
    border-radius: 0 0 8px 8px;
    animation: ly-fade-in .2s ease;
}

.ly-reply-text {
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255, 255, 255, .92);
    word-break: break-word;
}

.ly-reply-time {
    font-size: 11px;
    color: rgba(255, 255, 255, .6);
    text-align: right;
    margin-top: 4px;
}

/* ============================================================
   分页（磨砂胶囊）
   ============================================================ */
.ly-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding-top: 30px;
    flex-wrap: wrap;
}

.ly-pagination a,
.ly-pagination span {
    display: inline-block;
    min-width: 38px;
    padding: 8px 13px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 20px;
    font-size: 13px;
    color: var(--ly-text);
    text-decoration: none;
    background: var(--ly-input-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background .2s;
}

.ly-pagination a:hover {
    background: rgba(255, 255, 255, .32);
}

.ly-pagination .ly-current {
    background: var(--ly-accent);
    border-color: var(--ly-accent);
    color: var(--ly-accent-text);
    font-weight: 600;
}

.ly-pagination .ly-disabled {
    opacity: .45;
}

/* ============================================================
   动画
   ============================================================ */
@keyframes ly-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 600px) {
    .ly-wall {
        background-attachment: scroll;
        margin: 0 -10px;
    }

    .ly-wall-inner {
        padding: 26px 12px 38px;
    }

    .ly-wall-title {
        font-size: 20px;
        padding: 8px 22px;
        letter-spacing: 3px;
    }

    .ly-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .ly-filter {
        justify-content: center;
    }

    .ly-filter-input {
        width: 110px;
    }

    .ly-filter-date {
        width: 130px;
    }

    .ly-form-card {
        padding: 16px 14px;
        border-radius: 12px;
    }

    .ly-notes {
        width: 100%;
    }

    .ly-note {
        width: 150px;
    }

    .ly-note-paper {
        padding: 12px 13px 11px;
    }

    .ly-note-date,
    .ly-note-text,
    .ly-note-name {
        font-size: 13px;
    }
}
