* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4cc9f0;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --gray-color: #64748b;
    --border-radius: 10px;
    --box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
    --transition: all 0.25s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    color: var(--dark-color);
    line-height: 1.5;
    padding: 12px;
    min-height: 100vh;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 16px;
    padding: 10px 0;
}


/* 隐藏整个页面的滚动条 */
html {
    /* 隐藏IE/Edge滚动条 */
    -ms-overflow-style: none;
    /* 隐藏Firefox滚动条 */
    scrollbar-width: none;
}

/* 隐藏Chrome/Safari/Opera滚动条 */
html::-webkit-scrollbar {
    display: none;
}

/* 确保滚动功能正常 */
body {
    /* 允许滚动 */
    overflow-y: scroll;
    /* 防止内容抖动，保持滚动条空间 */
    overflow-x: hidden;
    /* 兼容WebKit内核浏览器 */
    -webkit-overflow-scrolling: touch;
}




h1 {
    font-size: 2.1rem;
    margin-bottom: 6px;
    background: linear-gradient(45deg, var(--primary-color), var(--success-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--gray-color);
    font-size: 1rem;
    margin-top: 6px;
}

.add-site-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 9px 18px;
    font-size: 0.95rem;
    border-radius: 50px;
    cursor: pointer;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.28);
    transition: var(--transition);
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.add-site-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(67, 97, 238, 0.4);
}

.add-site-btn:active {
    transform: translateY(0);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    width: 92%;
    max-width: 560px;
    box-shadow: var(--box-shadow);
    animation: modalOpen 0.35s ease-out;
    overflow: hidden;
}

@keyframes modalOpen {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 16px 20px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-modal:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 18px 20px 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.18);
}

.form-group textarea {
    min-height: 70px;
    resize: vertical;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.submit-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 11px 18px;
    font-size: 0.98rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: var(--transition);
    margin-top: 6px;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.25);
}

.categories-container {
    display: grid;
    gap: 16px;
}

.category-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 16px;
    transition: var(--transition);
}

.category-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

.category-title {
    font-size: 1.2rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    align-items: center;
    color: var(--dark-color);
    font-weight: 700;
}

.category-title::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 4px;
    margin-right: 10px;
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.site-card {
    background: white;
    border-radius: 12px;
    padding: 10px 8px 12px;
    text-align: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 96px;
    text-decoration: none;
    color: var(--dark-color);
}

.site-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    border-color: rgba(67, 97, 238, 0.2);
}

.site-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.site-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.site-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
}

.site-description {
    font-size: 0.72rem;
    color: var(--gray-color);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
    margin-top: 2px;
    min-height: 16px;
}

.site-tags {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.tag {
    background: #eef2ff;
    color: var(--primary-color);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--gray-color);
}

.empty-state p {
    margin-top: 8px;
    font-size: 1rem;
}

.empty-state button {
    margin-top: 12px;
}

.top-bar {
    background: white;
    border-radius: var(--border-radius);
    padding: 8px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--box-shadow);
}

.stats-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.search-container {
    max-width: 560px;
    margin: 0 auto 16px;
    position: relative;
}

.search-container.compact {
    margin: 0;
    max-width: 500px;
    flex: 1;
}

.search-container input {
    width: 100%;
    padding: 9px 16px 9px 36px;
    border-radius: 50px;
    border: 1px solid #ddd;
    font-size: 0.93rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.search-container input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.18);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
    font-size: 1.1rem;
}



.stats-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.stats-item span {
    font-weight: 700;
    color: var(--primary-color);
}

@media (max-width: 1024px) {
    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 1.85rem;
    }

    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .top-bar {
        flex-direction: column;
        gap: 10px;
    }

    .stats-group {
        width: 100%;
        justify-content: space-around;
        flex-wrap: wrap;
        gap: 8px;
    }

    .search-container.compact {
        width: 100%;
        max-width: none;
    }

    .add-site-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
        gap: 8px;
    }

    .site-card {
        padding: 8px 6px 10px;
        min-height: 88px;
    }

    .site-icon {
        width: 32px;
        height: 32px;
    }

    .site-icon img {
        width: 22px;
        height: 22px;
    }

    .site-name {
        font-size: 0.82rem;
    }

    .modal-content {
        width: 96%;
        margin: 16px;
    }

    .add-site-btn {
        padding: 8px 16px;
        font-size: 0.92rem;
    }
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    color: var(--dark-color);
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    transform: translateX(320px);
    transition: transform 0.25s ease;
    font-weight: 500;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid #f72585;
}

.toast-icon {
    font-size: 1.2rem;
}

.category-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    justify-content: flex-start;
}

.category-filter {
    padding: 5px 12px;
    border-radius: 30px;
    background: white;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.85rem;
}

.category-filter.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.category-filter:hover:not(.active) {
    background: #f8fafc;
    border-color: var(--primary-color);
}

.no-results {
    text-align: center;
    padding: 30px 20px;
    color: var(--gray-color);
    grid-column: 1 / -1;
}

.no-results p {
    font-size: 1.05rem;
    margin-top: 12px;
}

.favicon-placeholder {
    background: linear-gradient(45deg, #4361ee, #3f37c9);
    color: white;
    font-weight: bold;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
