/* ============================================
   便签工具 - 高端毛玻璃风格
   ============================================ */

/* ========= 动画 ========= */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes float {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(10px, -18px) scale(1.05); }
    100% { transform: translate(0, 0) scale(1); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ========= 变量 ========= */
:root {
    --primary: #6366f1;
    --primary-light: #e0e7ff;
    --primary-dark: #4338ca;
    --accent: #ec4899;
    --bg: #f0f2f8;
    --card: rgba(255, 255, 255, 0.72);
    --card-solid: #ffffff;
    --text: #0f172a;
    --text-light: #475569;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.6);
    --danger: #ef4444;
    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 4px 24px -4px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, 0.12);
    --font: 'Inter', 'PingFang SC', 'Hiragino Sans GB', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
}

/* ========= 背景装饰光晕 ========= */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}
.bg-glow-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.18), transparent 70%);
    top: -120px; left: -100px;
    animation: float 18s ease-in-out infinite;
}
.bg-glow-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.12), transparent 70%);
    top: 40%; right: -80px;
    animation: float 22s ease-in-out infinite reverse;
}
.bg-glow-3 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.12), transparent 70%);
    bottom: -80px; left: 30%;
    animation: float 20s ease-in-out infinite 3s;
}

/* ========= 顶部栏 ========= */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 10px;
    color: var(--text-light);
    background: rgba(0,0,0,0.04);
    transition: all 0.3s var(--ease);
    text-decoration: none;
    flex-shrink: 0;
}
.back-btn:hover { background: var(--primary-light); color: var(--primary); }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}
.brand-icon { font-size: 24px; }
.brand-text {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text) 30%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 搜索 */
.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}
.search-input {
    padding: 9px 14px 9px 38px;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 99px;
    font-size: 14px;
    width: 200px;
    background: rgba(255,255,255,0.7);
    color: var(--text);
    outline: none;
    font-family: inherit;
    transition: all 0.3s var(--ease);
}
.search-input:focus {
    width: 260px;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: #fff;
}

/* 排序 */
.sort-select {
    padding: 9px 14px;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255,255,255,0.7);
    color: var(--text);
    outline: none;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s var(--ease);
}
.sort-select:hover { border-color: var(--primary); }

/* 新建按钮 */
.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 22px;
    border: none;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    transition: all 0.3s var(--ease);
    white-space: nowrap;
}
.btn-add:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
    transform: translateY(-2px);
}

/* ========= 分类标签栏 ========= */
.category-bar {
    position: sticky;
    top: 64px;
    z-index: 90;
    background: rgba(255,255,255,0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.category-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.cat-chip {
    padding: 6px 18px;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    background: rgba(255,255,255,0.7);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s var(--ease);
    white-space: nowrap;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* ========= 统计栏 ========= */
.stats-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* ========= 便签网格 ========= */
.notes-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px 80px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    position: relative;
    z-index: 1;
}

/* ========= 便签卡片 ========= */
.note-card {
    background: var(--card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: all 0.4s var(--ease);
    animation: fadeInUp 0.5s var(--ease) both;
    position: relative;
    overflow: hidden;
    min-height: 160px;
}
.note-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}
.note-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.2);
}
.note-card:hover::before { opacity: 1; }

.note-card .note-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.4;
    word-break: break-word;
}
.note-card .note-content {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
    word-break: break-word;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
}
.note-card .note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.04);
}
.note-card .note-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.note-cat-badge {
    padding: 2px 10px;
    border-radius: 99px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}
.note-card .note-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}
.note-card:hover .note-actions { opacity: 1; }

.note-action-btn {
    width: 32px; height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    font-size: 15px;
}
.note-action-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text);
}
.note-action-btn.delete:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* 置顶标记 */
.note-card.pinned { border-color: rgba(99,102,241,0.25); }
.note-card.pinned .pin-icon { color: var(--primary); }

.pin-icon {
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.2s;
}

/* 动画延迟 */
.note-card:nth-child(1)  { animation-delay: 0.02s; }
.note-card:nth-child(2)  { animation-delay: 0.06s; }
.note-card:nth-child(3)  { animation-delay: 0.10s; }
.note-card:nth-child(4)  { animation-delay: 0.14s; }
.note-card:nth-child(5)  { animation-delay: 0.18s; }
.note-card:nth-child(6)  { animation-delay: 0.22s; }
.note-card:nth-child(7)  { animation-delay: 0.26s; }
.note-card:nth-child(8)  { animation-delay: 0.30s; }

/* ========= 空状态 ========= */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 100px 20px;
    animation: fadeIn 0.6s var(--ease);
}
.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.08));
}
.empty-state h3 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text);
}
.empty-state p {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========= 弹窗 ========= */
.modal-overlay,
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.25s var(--ease);
}
.modal-overlay.show,
.confirm-overlay.show {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 620px;
    background: var(--card-solid);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.35s var(--ease);
    max-height: 85vh;
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    padding: 24px 24px 0;
    gap: 12px;
}
.modal-title-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 22px;
    font-weight: 800;
    font-family: inherit;
    color: var(--text);
    background: transparent;
    letter-spacing: -0.5px;
}
.modal-title-input::placeholder { color: var(--text-muted); font-weight: 500; }
.modal-close {
    width: 36px; height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(0,0,0,0.04);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    flex-shrink: 0;
}
.modal-close:hover { background: #fee2e2; color: var(--danger); }

.modal-textarea {
    margin: 16px 24px;
    flex: 1;
    min-height: 220px;
    max-height: 50vh;
    resize: vertical;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    font-size: 15px;
    line-height: 1.8;
    font-family: inherit;
    color: var(--text);
    background: #fafafa;
    outline: none;
    transition: all 0.3s var(--ease);
}
.modal-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: #fff;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.modal-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.modal-right {
    margin-left: auto;
}

/* 颜色选择器 */
.color-picker {
    display: flex;
    gap: 6px;
    align-items: center;
}
.color-dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* 分类输入 */
.cat-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.cat-input {
    padding: 6px 14px;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    width: 120px;
    outline: none;
    color: var(--text);
    background: #fafafa;
    transition: all 0.2s;
}
.cat-input:focus {
    border-color: var(--primary);
    background: #fff;
}

/* 保存按钮 */
.btn-save {
    padding: 10px 32px;
    border: none;
    border-radius: 99px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    transition: all 0.3s var(--ease);
}
.btn-save:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

/* ========= 确认删除弹窗 ========= */
.confirm-box {
    background: var(--card-solid);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0,0,0,0.15);
    animation: scaleIn 0.3s var(--ease);
    max-width: 380px;
    width: 100%;
}
.confirm-icon { font-size: 48px; margin-bottom: 16px; }
.confirm-box h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.confirm-box p { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; font-weight: 500; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; }
.btn-cancel {
    padding: 10px 28px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 99px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-cancel:hover { border-color: var(--primary); color: var(--primary); }
.btn-delete {
    padding: 10px 28px;
    border: none;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    background: linear-gradient(135deg, var(--danger), #f97316);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
    transition: all 0.3s var(--ease);
}
.btn-delete:hover { box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45); transform: translateY(-1px); }

/* ========= Toast 提示 ========= */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 14px 28px;
    background: var(--text);
    color: #fff;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    z-index: 999;
    opacity: 0;
    transition: all 0.4s var(--ease);
    pointer-events: none;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========= 响应式 ========= */
@media (max-width: 768px) {
    .topbar-inner { padding: 0 16px; gap: 10px; }
    .search-input { width: 140px; }
    .search-input:focus { width: 160px; }
    .btn-add span { display: none; }
    .btn-add { padding: 9px 14px; }
    .notes-grid { grid-template-columns: 1fr 1fr; padding: 16px 16px 60px; gap: 14px; }
    .note-card { padding: 18px; min-height: 140px; }
    .modal { margin: 12px; max-height: 90vh; }
    .modal-footer { flex-direction: column; align-items: stretch; }
    .modal-right { margin-left: 0; }
    .btn-save { width: 100%; text-align: center; }
    .category-bar-inner { padding: 10px 16px; }
    .stats-bar { padding: 12px 16px 0; }
}

@media (max-width: 480px) {
    .notes-grid { grid-template-columns: 1fr; }
    .sort-select { display: none; }
}
