/*
Theme Name: Free Image Gallery
Theme URI: https://yoursite.com
Author: Your Name
Author URI: https://yoursite.com
Description: A modern image gallery theme with search, filters, and download functionality
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: image-gallery
*/

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

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

/* Header Styles */
.site-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-title {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    text-decoration: none;
    display: inline-block;
}

.site-title:hover {
    color: #3498db;
}

/* Search Bar */
.search-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 60px 20px;
    text-align: center;
    color: white;
}

.search-section h1 {
    font-size: 42px;
    margin-bottom: 20px;
    font-weight: 700;
}

.search-section p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.95;
}

.search-form {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 18px 120px 18px 20px;
    font-size: 16px;
    border: none;
    border-radius: 50px;
    outline: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.search-button {
    position: absolute;
    right: 5px;
    top: 5px;
    padding: 13px 35px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.search-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

/* Main Content Layout */
.main-content {
    display: flex;
    gap: 30px;
    padding: 40px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Sidebar Filters */
.sidebar {
    flex: 0 0 280px;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #2c3e50;
    font-weight: 700;
}

.filter-group {
    margin-bottom: 30px;
}

.filter-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.filter-group select,
.filter-group input[type="radio"] {
    margin-right: 8px;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-option:hover {
    background: #f0f2f5;
}

.filter-option input[type="radio"] {
    cursor: pointer;
}

.filter-option label {
    margin: 0;
    cursor: pointer;
    flex: 1;
}

.category-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-btn {
    padding: 10px 15px;
    background: #f0f2f5;
    border: none;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    font-weight: 500;
}

.category-btn:hover {
    background: #e4e6eb;
}

.category-btn.active {
    background: #667eea;
    color: white;
}

/* Image Gallery */
.gallery-container {
    flex: 1;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.gallery-item {
    position: relative;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.3s;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.gallery-item:hover .image-overlay {
    opacity: 1;
}

.image-info {
    color: white;
    width: 100%;
}

.image-category {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    opacity: 0.9;
}

.download-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 10px 20px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.gallery-item:hover .download-btn {
    opacity: 1;
}

.download-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

/* Image Popup/Modal */
.image-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.image-popup.active {
    display: block;
}

.popup-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    padding: 60px 0;
}

.popup-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 30px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.popup-close:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.popup-image-container {
    text-align: center;
    margin-bottom: 40px;
}

.popup-image-container img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.popup-download-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 15px 40px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.popup-download-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Related Images */
.related-images {
    margin-top: 50px;
}

.related-images h3 {
    color: white;
    font-size: 24px;
    margin-bottom: 25px;
    text-align: center;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.related-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.related-item:hover {
    transform: scale(1.05);
}

.related-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
}

.loading:after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* No Results */
.no-results {
    text-align: center;
    padding: 80px 20px;
    color: #666;
}

.no-results h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

/* Footer */
.site-footer {
    background: #2c3e50;
    color: white;
    padding: 40px 20px;
    text-align: center;
    margin-top: 60px;
}

/* Responsive Design */
@media (max-width: 968px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        flex: 1;
        position: static;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 640px) {
    .search-section h1 {
        font-size: 32px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .related-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
