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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.search-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.search-input {
    width: 100%;
    max-width: 600px;
    padding: 16px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.main-content {
    display: flex;
    gap: 24px;
}

.sidebar {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 20px;
    width: 300px;
    flex-shrink: 0;
    align-self: start;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.main {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    min-height: 500px;
    flex: 1;
    align-self: start;
}

.sidebar-section {
    margin-bottom: 16px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding: 16px 16px 8px 16px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.sidebar-item:hover {
    background-color: #f6f6f6;
}

.sidebar-item img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 12px;
    object-fit: contain;
    padding: 2px;
    flex-shrink: 0;
    background: var(--bg-color);
}

.sidebar-item-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.category-tab {
    padding: 10px 20px;
    background: var(--bg-color);
    border: 2px solid transparent;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.category-tab:hover {
    background: #e0e7ff;
    color: var(--primary-color);
}

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

.category-section {
    margin-bottom: 32px;
}

.category-section:last-child {
    margin-bottom: 0;
}

.category-header {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.category-header::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary-color);
    margin-right: 12px;
    border-radius: 2px;
}

.websites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.website-card-wrapper {
    display: contents;
}

.website-card {
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.website-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.favorite-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg-color);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    z-index: 1;
}

.website-card:hover .favorite-btn {
    opacity: 1;
    transform: scale(1);
}

.favorite-btn.active {
    opacity: 1;
}

.favorite-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.favorite-btn.active:hover {
    background: #ef4444;
}

.website-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    width: 100%;
}

.website-icon-wrapper {
    width: 50px;
    height: 48px;
    border-radius: 10px;
    background: var(--bg-color);
    margin-right: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    overflow: hidden;
}

.website-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.website-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.website-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.website-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.website-tag {
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.no-results-text {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.no-results-hint {
    font-size: 0.95rem;
    opacity: 0.7;
}

.sidebar-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 16px;
    text-align: center;
}

.category-sections {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        margin-bottom: 24px;
        width: 100%;
        max-height: none;
        overflow-y: visible;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .sidebar-section {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .search-input {
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .sidebar {
        grid-template-columns: 1fr;
    }

    .main {
        padding: 16px;
    }

    .category-tabs {
        gap: 8px;
        padding-bottom: 12px;
    }

    .category-tab {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

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

    .website-card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .header {
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .search-container {
        margin-bottom: 20px;
    }

    .search-input {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .main {
        padding: 12px;
        border-radius: 12px;
    }

    .sidebar {
        gap: 12px;
        margin-bottom: 16px;
    }

    .category-tabs {
        gap: 6px;
        padding-bottom: 10px;
    }

    .category-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .websites-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .website-card {
        padding: 14px;
    }

    .website-icon-wrapper {
        width: 40px;
        height: 40px;
        margin-right: 10px;
        padding: 5px;
    }

    .website-name {
        font-size: 1rem;
    }

    .website-description {
        font-size: 0.85rem;
    }

    .website-tags {
        margin-top: 10px;
    }

    .website-tag {
        padding: 3px 8px;
        font-size: 0.7rem;
    }

    .favorite-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 360px) {
    .header h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .category-header {
        font-size: 1.1rem;
    }

    .website-icon-wrapper {
        width: 36px;
        height: 36px;
        padding: 4px;
    }

    .website-name {
        font-size: 0.95rem;
    }
}
