/* Reset some defaults */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f2f2f7;
    color: #222;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: #4a90e2;
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-bar {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

#searchInput {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    border: none;
    font-size: 1rem;
    outline: none;
}

.theme-toggle {
    cursor: pointer;
    font-size: 1.4rem;
    user-select: none;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    background: rgba(255 255 255 / 0.3);
    transition: background 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(255 255 255 / 0.5);
}

.adsense-banner {
    max-width: 728px;
    margin: 1rem auto;
}

.categories {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 20px;
    background: #ddd;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease, color 0.3s ease;
}

.category-btn:hover {
    background: #4a90e2;
    color: white;
}

.category-btn.active {
    background: #4a90e2;
    color: white;
}

main {
    flex-grow: 1;
    padding: 0 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.wallpaper-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.1);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.wallpaper-card:hover {
    transform: scale(1.05);
}

.wallpaper-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.wallpaper-title {
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
    flex-grow: 1;
}

footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
    color: #666;
    background: #fafafa;
    border-top: 1px solid #ddd;
}

/* Dark theme */
body.dark {
    background-color: #121212;
    color: #eee;
}

body.dark header {
    background: #222;
}

body.dark #searchInput {
    background: #222;
    color: #eee;
    border-radius: 25px;
}

body.dark .category-btn {
    background: #333;
    color: #ccc;
}

body.dark .category-btn.active,
body.dark .category-btn:hover {
    background: #4a90e2;
    color: white;
}

body.dark .wallpaper-card {
    background: #1e1e1e;
    box-shadow: 0 2px 8px rgb(255 255 255 / 0.1);
}

body.dark footer {
    background: #222;
    color: #aaa;
}

body.dark .adsense-banner div {
    background: #333;
    color: #ccc;
}