/* ===== CSS Variables & Reset ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-bg: #0f0f1a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --border-radius-xl: 28px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background decoration */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(79, 172, 254, 0.1) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* ===== App Container ===== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--text-primary);
    background: var(--primary-gradient);
    padding: 8px;
    border-radius: var(--border-radius-md);
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* ===== Search Section ===== */
.search-section {
    padding: 1rem 1.5rem 2.5rem;
}

.search-container {
    max-width: 700px;
    margin: 0 auto;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-xl);
    padding: 0.5rem;
    backdrop-filter: blur(20px);
    transition: var(--transition-medium);
    box-shadow: var(--shadow-glow);
}

.search-wrapper:focus-within {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 60px rgba(102, 126, 234, 0.4);
}

.search-icon {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    margin-left: 1rem;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.search-wrapper:focus-within .search-icon {
    color: var(--text-secondary);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    padding: 1rem;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--border-radius-lg);
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    cursor: pointer;
    transition: var(--transition-medium);
    white-space: nowrap;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

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

.btn-arrow {
    width: 18px;
    height: 18px;
    transition: var(--transition-fast);
}

.search-btn:hover .btn-arrow {
    transform: translateX(3px);
}

/* Popular Tags */
.popular-tags {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.tag-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.tag {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 100px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tag:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 0 1.5rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.results-header {
    margin-bottom: 1.5rem;
}

.results-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.results-count {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--card-bg);
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
}

/* ===== States ===== */
.loading-container,
.empty-state,
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    min-height: 400px;
}

.empty-icon,
.no-results-icon {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3,
.no-results h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p,
.no-results p {
    color: var(--text-secondary);
    max-width: 300px;
}

/* Loader */
.loader {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.loader-dot {
    width: 12px;
    height: 12px;
    background: var(--primary-gradient);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }
.loader-dot:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== Photos Grid ===== */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Photo Card */
.photo-card {
    position: relative;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    background: var(--card-bg);
    transition: var(--transition-medium);
}

.photo-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0) 60%
    );
    opacity: 0;
    transition: var(--transition-medium);
    z-index: 1;
}

.photo-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.photo-card:hover::before {
    opacity: 1;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.photo-card:hover img {
    transform: scale(1.1);
}

.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem;
    z-index: 2;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition-medium);
}

.photo-card:hover .photo-overlay {
    opacity: 1;
    transform: translateY(0);
}

.photo-photographer {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.photo-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.photo-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-alt {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.375rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-medium);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    max-width: 1000px;
    max-height: 90vh;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition-medium);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    z-index: 10;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.modal-close svg {
    width: 24px;
    height: 24px;
}

.modal-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.3);
}

.modal-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--card-bg);
    border-top: 1px solid var(--card-border);
}

.photographer-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.photographer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
}

.photographer-details {
    display: flex;
    flex-direction: column;
}

.photographer-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.photographer-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.photographer-name:hover {
    color: #667eea;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-gradient);
    border-radius: var(--border-radius-md);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    transition: var(--transition-medium);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.download-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== Footer ===== */
.footer {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

.footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.footer a:hover {
    color: #764ba2;
}

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

    .logo-text {
        font-size: 1.5rem;
    }

    .search-section {
        padding: 0.5rem 1rem 2rem;
    }

    .search-wrapper {
        flex-direction: column;
        padding: 0.75rem;
        gap: 0.75rem;
        border-radius: var(--border-radius-lg);
    }

    .search-icon {
        display: none;
    }

    .search-input {
        width: 100%;
        padding: 0.75rem;
        text-align: center;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem;
    }

    .popular-tags {
        gap: 0.375rem;
    }

    .tag {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .main-content {
        padding: 0 1rem 2rem;
    }

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

    .modal-overlay {
        padding: 1rem;
    }

    .modal-info {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .photographer-info {
        flex-direction: column;
    }

    .download-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .photos-grid {
        grid-template-columns: 1fr;
    }

    .photo-card {
        aspect-ratio: 16 / 10;
    }
}

/* Animation for cards appearing */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.photo-card {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.photo-card:nth-child(1) { animation-delay: 0.05s; }
.photo-card:nth-child(2) { animation-delay: 0.1s; }
.photo-card:nth-child(3) { animation-delay: 0.15s; }
.photo-card:nth-child(4) { animation-delay: 0.2s; }
.photo-card:nth-child(5) { animation-delay: 0.25s; }
.photo-card:nth-child(6) { animation-delay: 0.3s; }
.photo-card:nth-child(7) { animation-delay: 0.35s; }
.photo-card:nth-child(8) { animation-delay: 0.4s; }
.photo-card:nth-child(9) { animation-delay: 0.45s; }
.photo-card:nth-child(10) { animation-delay: 0.5s; }
.photo-card:nth-child(11) { animation-delay: 0.55s; }
.photo-card:nth-child(12) { animation-delay: 0.6s; }
.photo-card:nth-child(13) { animation-delay: 0.65s; }
.photo-card:nth-child(14) { animation-delay: 0.7s; }
.photo-card:nth-child(15) { animation-delay: 0.75s; }
