/* ============================================================
   memo.css —— 「备忘录」独立组件样式（深色主题：炭黑标题栏 + 深灰便签列表）
   - 看板卡片：深灰圆角卡，顶部炭黑标题条、浅色居中小标题；
   - 条目为浅灰大字、暗色细分隔线，右侧悬停显示删除 ×；
   - 无备忘时显示可点击的空态提示，点击新建；
   - 便签内容由 js/memo.js 读写 localStorage（键 widgets_data_memo）。
   ============================================================ */

/* ===== 看板卡片外壳：宽度撑满 4 格组件区，高度 = 两排网址图标 ===== */
.widget-card[data-widget="memo"] {
    width: 100%;
    max-width: 100%;
    background: #1c1f26;
    border: none;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    padding: 0;
    height: var(--widget-h);
    margin-bottom: 0;
    color: #c8ccd6;
    /* 可见：卡片下方的 .memo-card-name 探出卡片外显示；圆角裁切由内部 .memo 负责 */
    overflow: visible;
}
.widget-card[data-widget="memo"]:hover {
    border: none;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.55);
}

/* 卡片内不显示默认标题：标题栏透明覆盖在卡片顶部，仅作拖拽区与移除按钮容器 */
.widget-card[data-widget="memo"] .widget-head {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    margin-bottom: 0;
    z-index: 5;
}
.widget-card[data-widget="memo"] .widget-title { visibility: hidden; }
.widget-card[data-widget="memo"] .widget-remove {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}
.widget-card[data-widget="memo"] .widget-remove:hover { background: rgba(255, 95, 109, 0.92); color: #fff; }
.widget-card[data-widget="memo"] .widget-body {
    overflow: hidden;
    padding: 0;
    display: flex;
}

/* 卡片下方的组件名称（与网站快捷方式名称同款：白字 + 阴影，适配壁纸背景） */
.memo-card-name {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--icon-gap);
    height: var(--icon-name-h);
    line-height: var(--icon-name-h);
    text-align: center;
    font-size: var(--icon-name-size, 12px);
    font-weight: 600;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

/* ===== 整体布局：标题条固定，列表区填满剩余高度 ===== */
.memo {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: #1c1f26;
    user-select: none;
}
.memo-head {
    flex: none;
    height: 35px;
    line-height: 35px;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #f2f3f6;
    background: linear-gradient(150deg, #2b2f3a 0%, #15171d 100%);
}
.memo-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 18px;
}

/* ===== 便签列表（超出在列表内滚动，滚动条隐藏） ===== */
.memo-list {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.memo-list::-webkit-scrollbar { width: 0; height: 0; display: none; }

.memo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 26px;
    border-bottom: 1px solid #2c303a;
}
.memo-item:last-child { border-bottom: none; }
.memo-text {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 26px;
    color: #9aa1b0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.memo-text:hover { color: #dfe3ec; }
.memo-del {
    flex: none;
    width: 18px;
    height: 18px;
    line-height: 16px;
    padding: 0;
    border: none;
    border-radius: 50%;
    font-size: 13px;
    text-align: center;
    color: #7a8190;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.15s ease, transform 0.15s var(--ease-out), color 0.15s ease, background 0.15s ease;
}
.memo-item:hover .memo-del { opacity: 1; transform: scale(1); }
.memo-del:hover { color: #fff; background: rgba(255, 95, 109, 0.9); }

/* 行内编辑输入框 */
.memo-input {
    flex: 1;
    min-width: 0;
    height: 24px;
    margin: 0;
    padding: 0 2px;
    border: none;
    outline: none;
    background: #2a2e38;
    border-radius: 5px;
    font-size: 13.5px;
    font-weight: 500;
    color: #e6e9f0;
    font-family: inherit;
}

/* ===== 空状态：可点击新建（[hidden] 时必须真正隐藏：作者样式 display 会覆盖属性默认值） ===== */
.memo-empty[hidden] { display: none; }
.memo-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    color: #6f7686;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: color 0.12s ease;
}
.memo-empty:hover { color: #b9bfcc; }

/* ===== 小屏适配：收敛标题与行高，避免溢出 ===== */
@media (max-width: 420px) {
    .memo-head { height: 36px; line-height: 36px; font-size: 15px; }
    .memo-item { height: 24px; }
    .memo-text { line-height: 24px; font-size: 12px; }
}

/* ============================================================
   详情 / 编辑弹窗（点击卡片条目或空态提示打开）
   左：浅灰目录栏（标题 + 时间戳 / 新建按钮）
   右：大标题输入 + 带行分隔线的正文编辑区 + 底部时间
   ============================================================ */
body.mm-open { overflow: hidden; }
.mm-mask {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    background: rgba(8, 10, 14, 0.6);
}
.mm-dialog {
    position: relative;
    width: 1080px;
    max-width: 100%;
    height: 760px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1a1d24;
    border: 1px solid #2c303a;
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    color: #e6e9f0;
    animation: mm-in 0.2s ease;
}
@keyframes mm-in {
    from { opacity: 0; transform: translateY(12px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

/* 顶部：左上标题 + 右上 × */
.mm-titlebar {
    flex: none;
    padding: 22px 60px 16px 26px;
    font-size: 22px;
    font-weight: 800;
    color: #f2f3f6;
    line-height: 1.3;
}
.mm-close {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border: none;
    background: none;
    color: #8b93a3;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}
.mm-close:hover { color: #f2f3f6; background: #2a2e38; }

/* ===== 主体：左目录 + 右编辑 ===== */
.mm-main {
    flex: 1;
    min-height: 0;
    display: flex;
    padding: 0 22px 18px;
}

/* 左侧目录栏 */
.mm-side {
    flex: none;
    width: 290px;
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    background: #22262f;
    border: 1px solid #2c303a;
    border-radius: 10px;
}
.mm-side-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 6px 12px;
}
.mm-side-label {
    font-size: 20px;
    font-weight: 800;
    color: #d7dbe4;
    letter-spacing: 1px;
}
.mm-side-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    width: 26px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    color: #8b93a3;
}
.mm-side-toggle:hover { color: #e6e9f0; background: #2c303a; }
.mm-caret {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}
.mm-caret-up { border-bottom: 7px solid currentColor; margin-top: 7px; }
.mm-caret-down { border-top: 7px solid currentColor; margin-top: 5px; opacity: 0.55; }

/* 目录条目列表 */
.mm-cat {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: flex 0.2s ease;
}
.mm-side.collapsed .mm-cat { display: none; }
.mm-side:has(.mm-cat-empty:not([hidden])) .mm-cat { display: none; }
.mm-cat-empty {
    padding: 24px 8px;
    text-align: center;
    font-size: 13px;
    color: #6f7686;
}
.mm-cat-empty:not([hidden]) {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mm-cat-empty[hidden] { display: none; }
.mm-cat-item {
    position: relative;
    flex: none;
    padding: 14px 16px;
    background: #2a2e38;
    border-radius: 10px;
    border-left: 5px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.mm-cat-del {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #8b93a7;
    font-size: 16px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.mm-cat-item:hover .mm-cat-del,
.mm-cat-item.active .mm-cat-del { opacity: 1; }
.mm-cat-del:hover { color: #f1f3f8; background: rgba(255, 255, 255, 0.14); }
.mm-cat-item:hover { background: #30353f; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }
.mm-cat-item.active {
    border-left-color: #8b93a7;
    background: #323742;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.mm-cat-title {
    font-size: 15px;
    font-weight: 700;
    color: #d7dbe4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}
.mm-cat-time {
    margin-top: 8px;
    font-size: 12.5px;
    color: #7f8696;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}

/* 左下新建按钮 */
.mm-new {
    flex: none;
    margin-top: 14px;
    height: 46px;
    border: none;
    border-radius: 23px;
    background: linear-gradient(150deg, #4a4f5e 0%, #2f333d 100%);
    color: #f2f3f6;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    transition: transform 0.12s var(--ease-out), box-shadow 0.12s ease;
}
.mm-new:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 20px rgba(0, 0, 0, 0.5);
}
.mm-new:active { transform: none; }

/* 右侧编辑区 */
.mm-editor {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: 20px;
}
.mm-editor-empty[hidden] { display: none; }
.mm-editor-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #6f7686;
}
.mm-editor-inner {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.mm-editor-inner[hidden] { display: none; }
.mm-title-input {
    flex: none;
    width: 100%;
    margin: 0 0 10px;
    padding: 6px 4px 12px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 26px;
    font-weight: 800;
    color: #f2f3f6;
    font-family: inherit;
}
.mm-title-input::placeholder { color: #5b6270; }

/* 正文：每行文字压在分隔线上，行高 = 背景线周期（42px） */
.mm-body-input {
    flex: 1;
    min-height: 0;
    width: 100%;
    margin: 0;
    padding: 0 4px 0;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 41px,
        #2c303a 41px,
        #2c303a 42px
    );
    background-attachment: local;
    font-size: 16px;
    line-height: 42px;
    color: #c8ccd6;
    font-family: inherit;
    overflow-y: auto;
}
.mm-body-input::placeholder { color: #5b6270; }

/* 底部时间 */
.mm-foot {
    flex: none;
    padding-top: 12px;
    font-size: 13px;
    color: #7f8696;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 窄屏：收窄目录栏、缩小标题 ===== */
@media (max-width: 720px) {
    .mm-side { width: 220px; }
    .mm-title-input { font-size: 21px; }
    .mm-body-input { font-size: 15px; }
}
