body {
    font-family: Arial, sans-serif; /* 注意手机没有微软雅黑字体，使用更通用的字体 */
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* 禁止横向滚动 */
    overflow-y: auto; /* 允许纵向滚动 */
    -webkit-overflow-scrolling: touch;
    /* 禁用弹性滚动 */
    overscroll-behavior-y: contain; 
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
    margin: 0 auto;
}

/* 顶部导航栏 */
.header {
    background: linear-gradient(135deg, #6868f5 0%, #4d4df7 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000; /* 提高 z-index 值 */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-left: 22px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    background: url("./icons/icon32.png") no-repeat left 2px / 17px 17px;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* 改进同步状态指示器 */
.status-indicator {
    font-size: 12px;
    animation: pulse 2s infinite;
}

.status-indicator.online {
    color: #6cf771;
}

.status-indicator.offline {
    color: #f44336;
}

.status-indicator.syncing {
    color: #ff9800;
}
/* 同步状态指示器呼吸灯动画 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 主要区域添加滚动空间 */
.main-content {
    flex: 1;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 80px; /* 为底部按钮留出空间 */
}

/* 键盘显示时隐藏footer */
.footer-hidden {
    display: none;
}

/* 隐藏footer时调整内容区padding */
.main-content.footer-hidden-padding {
    padding-bottom: 0;
}

/* 配置信息卡片 */
.config-info {
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin: 10px 15px 0 15px;
    overflow: hidden;
    border: 1px solid #888;
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    cursor: pointer;
}

.config-header:hover {
    background: #ccf1ff;
}

.config-header span:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
}

.toggle-config {
    background: none;
    border: none;
    color: #6868f5;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.config-content {
    padding: 20px;
    display: none;
    border-top: 1px solid #888;
}

.config-content.show {
    display: block;
}

.input-group {
    margin-bottom: 16px;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.input-group input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 14px;
    border: 1px solid #888;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    outline: none;
    border: #6868f5 solid 2px;
    box-shadow: 0 0 0 3px rgba(104, 104, 245, 0.1);
}

.input-group input[type="password"] {
    padding-right: 50px;
}

.show-password {
    position: absolute;
    right: 12px;
    top: 30px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.eye-icon {
    width: 15px;
    height: 15px;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: inline;
}

.show-password:hover {
    background: rgba(0, 0, 0, 0.05);
}

.save-config {
    background: #28a745;
    color: white;
    border: 1px solid #888;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.save-config:hover {
    background: #218838;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-left: 20px;
}

.notes-header h2 {
    color: #333;
    font-size: 12px;
    font-weight: bold;
    margin: 10px 0 0 0;
}

/* 便签列表 */
.note-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px;
    min-height: 300px;
    padding-bottom: 30px;
}

/* 隐藏滚动条但保留滚动功能 */
::-webkit-scrollbar {
    display: none !important;
}
* {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

/* 便签卡片 */
.note {
    background: #f7f8d3;
    border: 1px solid #888;
    border-radius: 10px;
    padding: 10px;
    margin: 0 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: move;
    overflow: hidden;
    touch-action: pan-y pan-x;
    transform: translateX(0);
    transition: transform 0.3s ease;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch; /* 使滚动更流畅 */
}

.note:hover {
    border-color: #6868f5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.note.dragging {
    opacity: 0.7;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.note textarea {
    width: 100%;
    border: none;
    background: transparent;
    resize: none; /* 禁用文本域的大小调整 */
    font-size: 16px;
    line-height: 1.5;
    outline: none; /* 移除默认的聚焦样式 */
    padding: 0;
    -webkit-user-select: text; /* 允许文本选择 */
    user-select: text; /* 允许文本选择 */
    -webkit-touch-callout: default; /* 允许长按弹出菜单 */
}

.note textarea::placeholder {
    color: #999;
}

.note .action-buttons {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 0 16px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.note.slide-left .action-buttons {
    transform: translateX(0);
}

.note .copy-btn,
.note .delete-btn {
    padding: 12px;
    margin: 0 4px;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    width: 60px;
    height: 40px;
    display: flex;
    align-items: center;
    color: #ffffff;
    background: rgba(99, 73, 247, 0.95);
    justify-content: center;
}

/* 底部操作栏 */
.button-group {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    margin: 10px auto;
    width: 90%;
    gap: 13px;
}

.sync-btn {
    flex: 1; 
    height: 45px;
    padding: 2px;
    border: 1px solid #666;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.sync-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.sync-btn.add {
    flex: 2;
    background: linear-gradient(135deg, #001aff 0%, #a900f7 100%);
    color: white;
}

.sync-btn.add:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(42, 40, 167, 0.4);
}

.sync-btn.upload {
    background: #28a745;
    color: white;
}

.sync-btn.upload:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.sync-btn.download {
    background: #17a2b8;
    color: white;
}

.sync-btn.download:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
}

/* 新增底部固定区域样式 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    z-index: 999; /* 提高 z-index 确保在其他内容之上 */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* 底部版权信息 */
.copyright-info {
    text-align: right;
    padding: 0 10px 5px 0;
    color: #666;
    font-size: 12px;
    max-width: 1200px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e1e8ed;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

.modal-footer {
    padding: 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid #e1e8ed;
    background: #f8f9fa;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn.cancel {
    background: #6c757d;
    color: white;
}

.modal-btn.cancel:hover {
    background: #5a6268;
}

.modal-btn.confirm {
    background: #dc3545;
    color: white;
}

.modal-btn.confirm:hover {
    background: #c82333;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    display: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    animation: toastSlideIn 0.3s ease-out;
}

.toast.show {
    display: block;
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.info {
    background: #17a2b8;
}

/* 为Toast添加warning样式 */
.toast.warning {
    background-color: #ff9800;
    color: white;
}

.toast.warning::before {
    content: "⚠️ ";
}

/* 改进Toast的其他样式 */
.toast.success::before {
    content: "✅ ";
}

.toast.error::before {
    content: "❌ ";
}

.toast.info::before {
    content: "ℹ️ ";
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 加载指示器 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1500;
}

.loading.show {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e8ed;
    border-top: 4px solid #6868f5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* 优化触摸设备体验 */
@media (pointer: coarse) {
    .note-actions {
        opacity: 1; /* 触摸设备上始终显示操作按钮 */
    }
    
    .toggle-config,
    .note-action,
    .modal-btn,
    .sync-btn {
        min-height: 45px; /* 确保触摸目标足够大 */
    }
}

/* 优化触摸目标尺寸 */
.toggle-config,
.note-action,
.modal-btn,
.sync-btn {
    min-height: 40px; /* 安卓推荐最小触摸尺寸 */
    min-width: 40px;
}

/* 增强按钮触摸反馈 */
button {
    transition: transform 0.1s, opacity 0.1s;
}

button:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* 禁用长按菜单 */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 确保输入框可以选中文本 */
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* 禁止页面缩放 */
html {
    touch-action: manipulation;
}

/* 为配置输入框添加验证状态样式 */
.input-group input.valid {
    border-color: #4caf50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.input-group input.invalid {
    border-color: #f44336;
    box-shadow: 0 0 5px rgba(244, 67, 54, 0.3);
}

/* 更新提示样式 */
.update-toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #4CAF50;
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.update-toast button {
  background: white;
  color: #4CAF50;
  border: none;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-weight: bold;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 改进按钮禁用状态 */
.sync-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc !important;
}

.sync-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* 确保安装按钮不被其他元素遮挡 */
#install-button {
  position: fixed;
  bottom: 70px; /* 高于底部按钮栏 */
  right: 20px;
  padding: 10px 15px;
  background: #4285f4;
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  z-index: 1000;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}