/* ===== BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}
a {
    text-decoration: none;
    color: inherit;
}
button {
    cursor: pointer;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
}

/* ===== THEMES ===== */
:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-card-hover: #242836;
    --border: #2e3342;
    --text: #e8edf5;
    --text-secondary: #9aa4b8;
    --accent: #6c8cff;
    --accent-hover: #5270e6;
    --shadow: 0 8px 24px rgba(0,0,0,0.5);
    --radius: 16px;
    --transition: 0.25s ease;
}
[data-theme="light"] {
    --bg: #f2f5fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f3f8;
    --border: #d0d7e2;
    --text: #1e2430;
    --text-secondary: #4a5366;
    --accent: #4a6cf7;
    --accent-hover: #3a56d4;
    --shadow: 0 8px 24px rgba(0,0,0,0.08);
}
[data-theme="blue"] {
    --bg: #0b1729;
    --bg-card: #10213a;
    --bg-card-hover: #1a2d4a;
    --border: #2a4466;
    --text: #d6e6ff;
    --text-secondary: #8aa4cc;
    --accent: #3d8cff;
    --accent-hover: #2a72e6;
}
[data-theme="purple"] {
    --bg: #150f1f;
    --bg-card: #231a33;
    --bg-card-hover: #2f2345;
    --border: #3d2e57;
    --text: #e8dfff;
    --text-secondary: #b09ac9;
    --accent: #a77cff;
    --accent-hover: #8c5ee6;
}
[data-theme="green"] {
    --bg: #0d1f14;
    --bg-card: #163021;
    --bg-card-hover: #1f3f2b;
    --border: #2a4d38;
    --text: #daf5e0;
    --text-secondary: #8bb89a;
    --accent: #4cdb7a;
    --accent-hover: #34be62;
}

/* ===== HEADER ===== */
.header {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    background: rgba(var(--bg-rgb, 15,17,23), 0.75);
    transition: background 0.3s;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.3rem;
}
.logo-icon {
    font-size: 1.8rem;
    line-height: 1;
}
.logo-text {
    letter-spacing: 0.5px;
}
.logo-sub {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.6;
    letter-spacing: 1px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.lang-switch {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: 30px;
    padding: 4px;
    border: 1px solid var(--border);
}
.lang-btn {
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: 0.2s;
    background: transparent;
}
.lang-btn.active {
    background: var(--accent);
    color: #fff;
}
.theme-btn {
    font-size: 1.2rem;
    padding: 6px 10px;
    border-radius: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: 0.2s;
}
.theme-btn:hover {
    background: var(--bg-card-hover);
}
.theme-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    box-shadow: var(--shadow);
    min-width: 140px;
    flex-direction: column;
    gap: 4px;
    z-index: 60;
}
.theme-dropdown.open {
    display: flex;
}
.theme-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 100%;
    background: transparent;
    transition: 0.15s;
}
.theme-dropdown button:hover {
    background: var(--bg-card-hover);
}
.theme-dropdown button .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--border);
}
.dot.dark { background: #1a1d27; }
.dot.light { background: #f0f3f8; }
.dot.blue { background: #10213a; }
.dot.purple { background: #231a33; }
.dot.green { background: #163021; }
.theme-dropdown button.active .dot {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== HERO ===== */
.hero {
    padding: 48px 0 32px;
    text-align: center;
}
.hero-title {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.hero-sub {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
}
.search-box {
    position: relative;
    max-width: 560px;
    margin: 0 auto;
}
.search-box input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    border-radius: 60px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: 0.2s;
}
.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.2);
}
.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}
.search-clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1rem;
    display: none;
}
.search-clear.visible {
    display: block;
}

/* ===== CATEGORIES ===== */
.categories {
    padding: 8px 0 24px;
}
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.cat-tab {
    padding: 8px 20px;
    border-radius: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
}
.cat-tab:hover {
    background: var(--bg-card-hover);
}
.cat-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ===== SITE GRID ===== */
.sites {
    flex: 1;
    padding-bottom: 48px;
}
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.site-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.site-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    background: var(--bg-card-hover);
    border-color: var(--accent);
}
.site-card .card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 4px;
}
.site-card .card-name {
    font-weight: 600;
    font-size: 1.05rem;
}
.site-card .card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    flex: 1;
}
.site-card .card-link {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    transition: 0.2s;
}
.site-card .card-link i {
    font-size: 0.75rem;
}
.site-card .card-link:hover {
    color: var(--accent-hover);
    gap: 10px;
}
.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-secondary);
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ===== FOOTER ===== */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 16px;
    background: var(--bg);
    transition: background 0.3s;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.footer-ver {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .hero-title { font-size: 1.8rem; }
    .site-grid { grid-template-columns: 1fr 1fr; }
    .header-inner { flex-direction: column; align-items: stretch; }
    .header-actions { justify-content: flex-end; }
    .logo { justify-content: center; }
    .theme-dropdown { right: auto; left: 0; }
}
@media (max-width: 480px) {
    .site-grid { grid-template-columns: 1fr; }
}