/* Modern CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #3C93C0 0%, #17AA8F 100%);
    min-height: 100vh;
    color: #333;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.icon {
    font-size: 1.2em;
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
}

/* Search Section */
.search-section {
    margin-bottom: 3rem;
}

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

.search-input-wrapper {
    display: flex;
    gap: 0.5rem;
    background: white;
    border-radius: 1rem;
    padding: 0.25rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.search-input {
    flex: 1;
    border: none;
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
    border-radius: 0.75rem;
    outline: none;
    font-family: inherit;
}

.search-button {
    background: linear-gradient(135deg, #3C93C0 0%, #17AA8F 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.search-button:active {
    transform: translateY(0);
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem 0;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

/* Results Info */
.results-info {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.results-stats {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.provider-info {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.provider-badge {
    background: linear-gradient(135deg, #3C93C0 0%, #17AA8F 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.provider-badge.skipped {
    background: #6c757d;
    opacity: 0.7;
}

/* Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.image-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.image-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.image-wrapper {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

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

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

.source-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
    backdrop-filter: blur(4px);
}

.image-info {
    padding: 1rem;
}

.image-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.image-author {
    color: #666;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-button {
    background: transparent;
    border: none;
    padding: 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
    color: #999;
    font-size: 0.8rem;
    transition: all 0.2s;
    opacity: 0.7;
}

.copy-button:hover {
    background: rgba(60, 147, 192, 0.1);
    color: #3C93C0;
    opacity: 1;
}

.copy-button.copied {
    color: #17AA8F;
    background: rgba(23, 170, 143, 0.1);
}

.author-with-copy {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.image-dimensions {
    color: #888;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Load More */
.load-more-section {
    text-align: center;
}

.load-more-button {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 2px solid transparent;
    padding: 1rem 2rem;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.load-more-button:hover {
    background: white;
    border-color: rgba(60, 147, 192, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 1rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.modal-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.modal-info {
    padding: 1.5rem;
    border-top: 1px solid #eee;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-author {
    color: #666;
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-download,
.modal-source {
    background: linear-gradient(135deg, #3C93C0 0%, #17AA8F 100%);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-download:hover,
.modal-source:hover {
    transform: translateY(-2px);
}

.modal-attribution {
    font-size: 0.9rem;
    color: #666;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .search-input-wrapper {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-button {
        justify-content: center;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .provider-info {
        justify-content: center;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }
}