/* 基本重置和全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #e0e0e0; /* 浅色文字以适应深色背景 */
    line-height: 1.6;
    background-color: #121212; /* 默认深色背景 */
    background-image: url('https://i.postimg.cc/Jz6HvGjS/2153816044722978816.jpg'); /* 更新为用户提供的背景图片URL */
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* 固定背景图，滚动时不移动 */
    overflow-x: hidden; /* 防止水平滚动条 */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* 顶部栏 */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    position: fixed; /* 固定在顶部 */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.2); /* 轻微的背景，增加对比 */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#time-weather-container {
    font-size: 16px;
    font-weight: 500;
}

#current-time {
    /* 样式可以按需调整 */
}

#top-navigation a {
    margin-left: 20px;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s ease;
}

#top-navigation a:hover {
    color: #ffffff;
}

/* 主要内容包装器和主要内容区域 */
.main-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1; /* 使其占据剩余空间，将书签部分推到底部（如果内容不足）或中部 */
    padding-top: 100px; /* 为固定的 top-bar 留出空间 */
    padding-bottom: 50px;
    width: 100%;
}

.main-content {
    text-align: center;
    max-width: 700px; /* 限制搜索区域的最大宽度 */
    width: 90%;
    padding: 30px;
    background: rgba(20, 20, 20, 0.6); /* 半透明背景 */
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.main-title {
    font-size: 36px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 18px;
    color: #b0b0b0;
    margin-top: 10px;
    margin-bottom: 35px;
}

/* 搜索容器 */
.search-container {
    margin-top: 20px;
}

.search-engine-buttons {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.search-engine-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: transparent;
    color: #e0e0e0;
    border-radius: 20px; /* 胶囊形状 */
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.search-engine-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.search-engine-btn.active {
    background-color: #007aff; /* 苹果蓝，或根据主题调整 */
    color: #ffffff;
    border-color: #007aff;
}

#search-form {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 25px; /* 更圆的搜索框 */
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#search-input {
    flex-grow: 1;
    padding: 10px 15px;
    font-size: 16px;
    border: none;
    background-color: transparent;
    color: #ffffff;
    outline: none;
}

#search-input::placeholder {
    color: #a0a0a0;
}

#search-button {
    background-color: transparent;
    border: none;
    color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 0 20px 20px 0; /* 配合搜索框圆角 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-button svg {
    stroke: #e0e0e0; /* SVG 搜索图标颜色 */
}

#search-button:hover svg {
    stroke: #ffffff;
}


/* 书签区容器 */
#site-sections-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* 使内部的 site-section 居中 */
    gap: 30px; /* 分类之间的间距 */
    padding: 0 20px 50px 20px; /* 底部和左右留白 */
    width: 100%;
    max-width: 1200px; /* 限制书签区域最大宽度 */
    margin: 0 auto; /* 水平居中 */
}

.site-section {
    background: rgba(20, 20, 20, 0.6); /* 半透明背景 */
    border-radius: 16px;
    padding: 25px;
    width: 100%; /* 宽度由 site-sections-container 的 max-width 控制 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards;
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    flex-grow: 1; /* Allow title to take available space if in flex container */
}

.section-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px; /* Replaces margin from .section-title */
}

.add-bookmark-to-section-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%; /* Circular button */
    width: 28px;
    height: 28px;
    font-size: 18px;
    font-weight: bold; /* Make plus bolder */
    line-height: 26px; /* Adjust for vertical centering of plus */
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    padding: 0;
    margin-left: 10px; /* Space from title */
    flex-shrink: 0; /* Prevent button from shrinking */
}

.add-bookmark-to-section-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

/* Ensure site-icon container doesn't mess up flex alignment if it's also flex */
.site-link .site-icon-container { /* Assuming iconContainer gets this class, or just use span */
    display: flex; /* Or inline-flex, to center its content (the icon itself) */
    justify-content: center;
    align-items: center;
    width: 32px; /* Match .site-icon explicit size */
    height: 32px; /* Match .site-icon explicit size */
    margin-bottom: 8px;
}

.site-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
}

.sites-grid {
    display: grid;
    /* 根据图标大小和期望的密度调整列数和最小宽度 */
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); /* 示例：每项最小100px */
    gap: 20px; /* 书签之间的间距 */
}

.site-link {
    display: flex;
    flex-direction: column; /* 图标在上，文字在下 */
    align-items: center; /* 水平居中 */
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* 用于定位子元素 */
    overflow: hidden;
}

.site-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.site-name {
    font-size: 13px;
    color: #c0c0c0;
    /* 多行文字处理，如果需要 */
    /* white-space: nowrap; */
    /* overflow: hidden; */
    /* text-overflow: ellipsis; */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 最多显示两行 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all; /* 对于长单词或URL，允许换行 */
}

.bookmark-hover-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.site-link:hover .bookmark-hover-btn {
    opacity: 1;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .main-content-wrapper {
        padding-top: 80px; /* 调整 top-bar 的高度 */
    }
    .main-title {
        font-size: 30px;
    }
    .subtitle {
        font-size: 14px;
    }
    #search-input {
        font-size: 15px;
    }
    .sites-grid {
        /* 在较小屏幕上，可能需要调整列数或最小宽度 */
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 15px;
    }
    .site-icon {
        width: 28px;
        height: 28px;
    }
    .site-name {
        font-size: 12px;
    }
    .top-bar {
        padding: 10px 15px;
    }
    #time-weather-container, #top-navigation a {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 24px;
    }
    .subtitle {
        font-size: 13px;
    }
    .search-engine-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    #search-input {
        padding: 8px 12px;
        font-size: 14px;
    }
    .site-section {
        padding: 20px;
    }
    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); /* 允许更多列或调整 */
        gap: 10px;
    }
    .site-icon {
        width: 24px;
        height: 24px;
    }
}

/* 移除旧的、不再需要的样式 (如果之前有的话) */
/* 例如 .bookmarks-grid, .bookmark-card, .category-button 等 */
/* 由于是全量替换，这里不需要特别删除，但如果是增量修改则需要注意 */

/* Add Bookmark Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 2000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity for backdrop */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    align-items: center; /* Vertical center */
    justify-content: center; /* Horizontal center */
}

.modal-content {
    background-color: rgba(30, 30, 30, 0.9); /* Dark, slightly transparent */
    margin: auto; /* Auto margins for centering, works with flex on .modal */
    padding: 25px 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    width: 90%;
    max-width: 500px; /* Max width of the modal */
    color: #e0e0e0;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.close-modal-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal-btn:hover,
.close-modal-btn:focus {
    color: #fff;
    text-decoration: none;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #ffffff;
    text-align: center;
    font-weight: 600;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #c0c0c0;
}

.form-group input[type="text"],
.form-group input[type="url"] {
    width: 100%;
    padding: 10px 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 15px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus {
    outline: none;
    border-color: #007aff;
    background-color: rgba(255, 255, 255, 0.08);
}

.form-actions {
    margin-top: 25px;
    display: flex;
    justify-content: flex-end; /* Align buttons to the right */
    gap: 10px;
}

.form-action-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.form-action-btn.submit-btn {
    background-color: #007aff;
    color: white;
}

.form-action-btn.submit-btn:hover {
    background-color: #0056b3;
}

.form-action-btn.cancel-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

.form-action-btn.cancel-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.form-action-btn.fetch-logo-btn {
    background-color: rgba(255, 255, 255, 0.08);
    color: #b0b0b0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 10px;
    font-size: 13px;
    margin-top: 8px;
}
.form-action-btn.fetch-logo-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #d0d0d0;
}

/* 书签过滤输入框 */
.bookmark-filter-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 20px auto;
    padding: 0 20px;
}
#bookmark-filter-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background-color: rgba(255,255,255,0.05);
    color: #ffffff;
    outline: none;
}
#bookmark-filter-input:focus {
    border-color: #007aff;
    background-color: rgba(255,255,255,0.08);
}

/* filter 输入框包装 */
.filter-input-wrapper {
    position: relative;
}

/* 清除过滤按钮 */
.clear-filter-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #a0a0a0;
    font-size: 16px;
    cursor: pointer;
    display: none;
    padding: 0;
}
.clear-filter-btn:hover {
    color: #ffffff;
}

/* 无结果消息 */
.no-bookmarks-message {
    color: #c0c0c0;
    font-size: 16px;
    text-align: center;
    margin: 40px 0;
}

/* 折叠/展开分组按钮 */
.collapse-section-btn {
    background: transparent;
    border: none;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    margin-right: 8px;
    transition: color 0.2s ease;
}
.collapse-section-btn:hover {
    color: #ffffff;
}

/* 编辑/删除按钮容器 */
.bookmark-action-container {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.bookmark-action-container button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #c0c0c0;
    transition: color 0.2s ease;
}
.bookmark-action-container button:hover {
    color: #ffffff;
} 