/* Modern Luxe Theme Variables */
:root {
    --primary-accent: #141016;
    --primary-hover: #5b406b;
    --light-bg: #f4f2f8;
    --card-bg: #ffffff;
    --card-bg-alt: #f8f6fc;
    --primary-text: #1e1e2f;
    --secondary-text: #5f5f70;
    --border-color: rgba(142, 68, 173, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --transition: all 0.2s ease;
}

/* Dark Mode Variables */
.dark-mode {
    --light-bg: #1a1a2e;
    --card-bg: #242442;
    --card-bg-alt: #2a2a4a;
    --primary-text: #ffffff;
    --secondary-text: #a0a0b0;
    --border-color: rgba(255, 255, 255, 0.1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

html, body {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--light-bg);
    color: var(--primary-text);
    transition: var(--transition);
}

body {
    min-height: 100vh;
    position: relative;
    line-height: 1.6;
    padding-top: 72px;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 15% 50%, rgba(142, 68, 173, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(142, 68, 173, 0.05) 0%, transparent 50%);
    z-index: -1;
}

/* Header Styles */
header {
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    height: 72px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: var(--transition);
}

body:not(.dark-mode) header .logo {
    color: black;
}

body:not(.dark-mode) main section.trending-section h2,
body:not(.dark-mode) main section.images-section h2 {
    color: black;
}

.dark-mode header {
    background: rgba(26, 26, 46, 0.8);
}

.header-left .logo {
    font-size: 22px;
    font-weight: 700;
    color: rgba(245, 245, 245, 0.84);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

nav {
    display: flex;
    gap: 32px;
    align-items: center;
}

nav a {
    color: var(--secondary-text);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

nav a.active, nav a:hover {
    color: var(--primary-accent);
    border-bottom: 2px solid var(--primary-accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.nav-search-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    border-radius: 24px;
    padding: 4px 12px 4px 4px;
}

.profile-pic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

/* Search Container Styles */
.main-search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 32px 0 24px 0;
}

#search-form {
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    border-radius: 40px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    padding: 0 18px;
    height: 56px;
    position: relative;
    transition: var(--transition);
}

.search-box {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

.search-icon {
    display: flex;
    align-items: center;
    color: var(--secondary-text);
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-actions .material-icons {
    color: var(--secondary-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    font-size: 20px;
}

.search-actions .material-icons:hover {
    background-color: var(--card-bg-alt);
    color: var(--primary-accent);
}

.search-actions .material-icons:active {
    transform: scale(0.95);
}

.search-actions .clear-search {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-actions .mic-icon,
.search-actions .camera-icon {
    position: relative;
}

.search-actions .mic-icon.recording,
.search-actions .camera-icon.active {
    color: var(--primary-accent);
    background-color: var(--card-bg-alt);
}

.search-actions .mic-icon.recording::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px solid var(--primary-accent);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

#search-box {
    flex: 1;
    border: none;
    outline: none;
    padding: 0 16px;
    font-size: 16px;
    background: transparent;
    color: var(--primary-text);
}

/* Trending Section Styles */
.trending-section {
    padding: 0 40px;
    margin-bottom: 40px;
}

.trending-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: whitesmoke;
    background: linear-gradient(45deg, rgb(201, 201, 201), #bebdbf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

body:not(.dark-mode) .trending-section h2,
body:not(.dark-mode) .images-section h2 {
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    color: black !important;
}

.trending-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.trend-card {
    position: relative;
    height: 200px;
    border-radius: 16px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.trend-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.trend-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.trend-card h3 {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    font-size: 20px;
    margin: 0;
}

.trend-card p {
    position: absolute;
    bottom: 10px;
    left: 20px;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin: 0;
}

.images-section h2{
    font-size: 24px;
    margin-bottom: 20px;
    padding-left: 50px;
    color: whitesmoke;
    background: linear-gradient(45deg, rgb(201, 201, 201), #bebdbf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Categories Section Styles */
.categories-section {
    padding: 0 40px;
    margin-bottom: 40px;
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--card-bg);
    border-radius: 20px;
    text-decoration: none;
    color: var(--primary-text);
    font-size: 14px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.category-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--card-bg-alt);
}

/* Image Grid Styles */
#image-container {
    column-count: 4;
    column-gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 16px;
    position: relative;
    min-height: 200px;
}

.images-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #AA0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.image-item {
    display: block;
    margin-bottom: 16px;
    width: 100%;
    break-inside: avoid;
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.image-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: 16px;
    transition: transform 0.3s;
}

.image-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

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

/* View Button Styles */
.view-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 20px;
}

.image-item:hover .view-btn {
    opacity: 1;
    visibility: visible;
}

.view-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.view-btn:active {
    transform: scale(0.95);
}

/* Full Screen Modal Styles */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        var(--card-bg-alt) 25%,
        var(--card-bg) 50%,
        var(--card-bg-alt) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.image-item {
    display: block;
    margin-bottom: 16px;
    width: 100%;
    break-inside: avoid;
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.image-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: 16px;
    transition: transform 0.3s;
}

.image-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

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

.image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        var(--card-bg-alt) 25%,
        var(--card-bg) 50%,
        var(--card-bg-alt) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.image-item {
    display: block;
    margin-bottom: 16px;
    width: 100%;
    break-inside: avoid;
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative; /* Added for placeholder absolute positioning */
}

.image-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: 16px;
    transition: transform 0.3s, opacity 0.6s ease;
    opacity: 0;
    transform: scale(0.95);
    position: relative;
    z-index: 0;
}

.image-item.loaded img {
    opacity: 1;
    transform: scale(1);
    transition: transform 0.5s ease, opacity 0.8s ease;
}

.image-item.loaded .image-placeholder {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Load More Button Styles */
.load-more-container {
    text-align: center;
    margin: 40px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
}

.load-more-btn {
    padding: 12px 32px;
    background: var(--primary-accent);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.load-more-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.load-more-btn .loading-spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
    display: none;
}

.load-more-btn.loading .loading-spinner {
    display: block;
}

.load-more-btn.loading .btn-text {
    display: none;
}

.load-more-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Footer Styles */
footer {
    padding: 20px 40px;
    background: #f8f9fa;
    margin-top: 40px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #70757a;
    text-decoration: none;
    font-size: 14px;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Cookie Consent Banner */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border-color);
}

.dark-mode .cookie-consent-banner {
    background: rgba(26, 26, 46, 0.95);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.cookie-content p {
    margin: 0;
    color: #333;
    font-size: 14px;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
}

.cookie-buttons button {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.accept-cookies {
    background: var(--primary-accent);
    color: white;
}

.accept-cookies:hover {
    background: var(--primary-hover);
}

.reject-cookies {
    background: #f0f0f0;
    color: #333;
}

.reject-cookies:hover {
    background: #e0e0e0;
}

/* Scroll to Top Button */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: var(--primary-accent);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Responsive Styles */
@media (max-width: 1200px) {
    #image-container {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0 20px;
    }

    nav {
        display: none;
    }

    .trending-section,
    .categories-section {
        padding: 0 20px;
    }

    #image-container {
        column-count: 2;
    }
}

@media (max-width: 480px) {
    .header-right {
        gap: 12px;
    }

    .profile-name {
        display: none;
    }

    .user-profile {
        padding: 4px;
    }

    #image-container {
        column-count: 2;
    }
}
