* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --bg-color: #0f0f23;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-color: rgba(99, 102, 241, 0.3);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.theme-bg,
.theme-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.theme-bg {
    background: var(--bg-color);
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    background: rgba(15, 15, 35, 0.8);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 4px;
    width: auto;
    height: auto;
}

.logo:hover {
    transform: scale(1.1);
}

.logo-img {
    width: auto;
    height: auto;
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.search-theme-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    padding: 0.5rem;
    width: 200px;
    font-size: 0.9rem;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.search-btn:hover {
    color: var(--primary-color);
}

.theme-switcher {
    position: relative;
}

.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    border-color: var(--primary-color);
    color: var(--text-color);
    transform: rotate(180deg);
}

.theme-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: rgba(15, 15, 35, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    backdrop-filter: blur(20px);
}

.theme-switcher:hover .theme-dropdown,
.theme-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-left: 0.25rem;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.theme-option:hover {
    background: var(--hover-color);
}

.theme-option span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.theme-preview {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.theme-option:hover .theme-preview {
    border-color: var(--primary-color);
}

.main-content {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.hero-section {
    text-align: center;
    padding: 4rem 0;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    animation: fadeInUp 0.6s ease;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    animation: fadeInUp 0.6s ease 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.categories-section {
    animation: fadeInUp 0.6s ease 0.4s both;
}

.category-selector {
    position: relative;
    margin-bottom: 2rem;
    z-index: 1000;
}

.category-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.category-trigger:hover {
    border-color: var(--primary-color);
    color: var(--text-color);
}

.category-trigger.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.category-label {
    font-weight: 500;
}

.category-arrow {
    transition: transform 0.3s ease;
}

.category-trigger.active .category-arrow {
    transform: rotate(180deg);
}

.category-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 200px;
    max-width: 90vw;
    background: rgba(15, 15, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999;
    backdrop-filter: blur(20px);
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.category-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.category-dropdown::-webkit-scrollbar {
    width: 6px;
}

.category-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.category-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--hover-color);
    color: var(--text-color);
}

.dropdown-item.active {
    background: var(--primary-color);
    color: white;
}

.websites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    overflow-x: hidden;
    max-width: 100%;
}

.website-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.website-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.15);
}

.website-card img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.website-info {
    flex: 1;
    min-width: 0;
}

.website-name {
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.website-name:hover {
    color: var(--primary-color);
}

.website-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem;
}

.pagination button {
    min-width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--text-color);
}

.pagination button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0 1rem;
}

.footer {
    position: relative;
    z-index: 1;
    margin-top: 4rem;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--primary-color);
}

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    z-index: 100;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.6);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem 1rem;
    }
    
    .logo-section {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        gap: 1rem;
    }
    
    .logo {
        padding: 4px;
    }
    
    .logo-img {
        max-width: 60px;
        max-height: 60px;
    }
    
    .main-nav {
        gap: 1rem;
    }
    
    .nav-link {
        font-size: 0.875rem;
    }
    
    .search-theme-section {
        width: 100%;
        flex-direction: row;
        gap: 1rem;
        justify-content: space-between;
    }
    
    .search-box {
        flex: 1;
        min-width: 0;
    }
    
    .search-input {
        width: 100%;
        font-size: 0.875rem;
    }
    
    .category-selector {
        margin-bottom: 1.5rem;
    }
    
    .category-trigger {
        padding: 0.6rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .category-dropdown {
        min-width: 180px;
        max-height: 300px;
    }
    
    .websites-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }
    
    .website-card {
        padding: 1rem;
        min-width: 0;
    }
    
    .website-card img {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    .website-name,
    .website-desc {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}