:root {
    /* Light theme */
    --bg-color: #f0f0f0;
    --text-color: #333;
    --header-bg: #333;
    --header-text: #fff;
    --thumbnail-shadow: rgba(0,0,0,0.2);
    --button-bg: rgba(255,255,255,0.2);
    --button-hover: rgba(255,255,255,0.3);
    --lightbox-bg: rgba(0,0,0,0.9);
    --lightbox-text: #fff;
}

:root[data-theme='dark'] {
    --bg-color: #1a1a1a;
    --text-color: #fff;
    --header-bg: #2d2d2d;
    --header-text: #fff;
    --thumbnail-shadow: rgba(0,0,0,0.4);
    --button-bg: rgba(255,255,255,0.1);
    --button-hover: rgba(255,255,255,0.2);
    --lightbox-bg: rgba(0,0,0,0.95);
    --lightbox-text: #fff;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

header {
    background-color: var(--header-bg);
    color: var(--header-text);
    text-align: center;
    padding: 2rem;
    margin-bottom: 2rem;
}

.tag-nav {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.nav-link {
    color: var(--header-text);
    text-decoration: none;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    background-color: var(--button-bg);
    transition: background-color 0.3s ease;
    font-size: 0.9rem;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--button-hover);
}

.tag-title {
    text-align: center;
    color: var(--text-color);
    margin: 0 0 2rem 0;
    font-size: 1.5rem;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
}

footer {
    background-color: var(--header-bg);
    color: var(--header-text);
    text-align: center;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.social-links {
    margin-bottom: 1.5rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s ease;
}

.social-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.flickr-icon {
    margin-right: 8px;
}

.copyright {
    margin: 0;
    opacity: 0.8;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    padding: 0 25px;
    margin-bottom: 2rem;
}

.thumbnail {
    cursor: pointer;
    transition: transform 0.3s;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--thumbnail-shadow);
    position: relative;
}

.thumbnail:hover {
    transform: scale(1.05);
}

.thumbnail img {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.photo-tags {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbnail:hover .photo-tags {
    opacity: 1;
}

.tag {
    color: white;
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    background-color: rgba(0,0,0,0.5);
    transition: background-color 0.3s ease;
}

.tag:hover {
    background-color: rgba(0,0,0,0.8);
}

#photo-tags {
    margin-top: 1rem;
}

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--lightbox-bg);
    z-index: 1000;
}

.lightbox.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    max-width: 95%;
    max-height: 95vh;
    position: relative;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

#lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: zoom-in;
    transition: transform 0.3s ease;
    transform-origin: center center;
}

#lightbox-img.zoomed {
    max-height: none;
    max-width: none;
    transform: scale(1);
    cursor: zoom-out;
}

.lightbox.zoomed .nav-button,
.lightbox.zoomed .photo-info {
    display: none;
}

.lightbox.zoomed .lightbox-content {
    overflow: auto;
    cursor: move;
}

.photo-info {
    color: white;
    margin-top: 20px;
    max-width: 800px;
}

.share-container {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.share-button, .theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--button-bg);
    border: none;
    color: var(--header-text);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.share-button:hover, .theme-toggle:hover {
    background: var(--button-hover);
}

.share-button svg {
    stroke: currentColor;
}

.share-feedback {
    color: #4CAF50;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.share-feedback.visible {
    opacity: 1;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 20px;
    cursor: pointer;
    font-size: 32px;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.prev {
    left: 30px;
}

.next {
    right: 30px;
}

.close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

.nav-button:hover, .close:hover {
    background: rgba(255,255,255,0.3);
}
