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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f0f0f;
    color: #fff;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin: 20px 0 30px;
    padding: 0 15px;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
}

header h1 span {
    color: #3b82f6;
}

.search-wrapper {
    margin-bottom: 20px;
    padding: 0 15px;
}

.search-box {
    display: flex;
    align-items: center;
    background: #1a1a1a;
    border-radius: 50px;
    border: 1px solid #2a2a2a;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.search-icon {
    color: #888;
    margin-left: 15px;
    flex-shrink: 0;
}

#searchInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 15px;
    padding: 14px 10px;
    min-width: 0;
}

#searchInput::placeholder {
    color: #666;
}

#searchBtn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    margin: 4px;
    flex-shrink: 0;
}

#searchBtn:hover {
    background: #2563eb;
}

.categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 15px 25px;
    justify-content: flex-start;
}

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

@media (min-width: 768px) {
    .categories {
        justify-content: center;
    }
}

.cat-btn {
    background: #1a1a1a;
    color: #aaa;
    border: 1px solid #2a2a2a;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
    flex-shrink: 0;
}

.cat-btn.active, .cat-btn:hover {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.loading, .error {
    text-align: center;
    padding: 40px 20px;
    display: none;
    color: #888;
}

.error {
    color: #ef4444;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 30px;
    padding: 0 15px;
}

@media (min-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }
}

.image-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #1a1a1a;
    aspect-ratio: 3/4;
    cursor: pointer;
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: 0.3s;
}

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

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    padding: 40px 12px 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.image-author {
    font-size: 13px;
    color: #fff;
    font-weight: 500;
}

.download-btn {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    color: white;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: 0.2s;
    display: inline-block;
}

.download-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.load-more {
    display: none;
    margin: 0 auto;
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #2a2a2a;
    padding: 12px 40px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
}

.load-more:hover {
    background: #2a2a2a;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    overflow: auto;
}

.modal-img {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    margin-top: 60px;
    border-radius: 12px;
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.close:hover {
    color: #3b82f6;
}

.modal-info {
    text-align: center;
    padding: 20px;
    color: #fff;
}

.modal-title {
    font-size: 18px;
    margin-bottom: 8px;
}

.modal-author {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 16px;
}

.modal-download {
    padding: 10px 24px;
    font-size: 14px;
}
