:root {
    --bg-light: #ffffff;
    --text-light: #333333;
    --text-secondary-light: #666666;
    --bg-dark: #1a1a1a;
    --text-dark: #e9e9e9;
    --text-secondary-dark: #b0b0b0;
    --button-bg-light: rgba(255, 255, 255, 0.8);
    --button-bg-dark: rgba(50, 50, 50, 0.7);
    --button-hover-shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --button-hover-shadow-dark: 0 2px 8px rgba(0, 0, 0, 0.4);
    --transition-speed: 0.3s;
}

html,
body,
.photo-container,
.photo-detail img,
.photo-caption,
.photo-metadata,
.theme-toggle,
.gallery-button {
    transition:
        background-color var(--transition-speed) ease,
        color var(--transition-speed) ease,
        border-color var(--transition-speed) ease,
        box-shadow var(--transition-speed) ease;
}

html,
body {
    background-color: var(--bg-light);
    color: var(--text-light);
    min-height: 100vh;
    /* Ensure full viewport height coverage */
}

html.dark-mode,
html.dark-mode body {
    background-color: var(--bg-dark);
    color: var(--text-dark);
}

.photo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 100px);
    padding: 2rem;
    transition: background-color var(--transition-speed) ease;
}

html.dark-mode .photo-container {
    background-color: var(--bg-dark);
}

html:not(.dark-mode) .photo-container {
    background-color: var(--bg-light);
}

.photo-detail {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-detail img {
    max-width: 100%;
    max-height: 80vh;
    height: auto;
    border-radius: 4px;
    transition: all var(--transition-speed) ease;
    display: block;
    object-fit: cover;
}

html.dark-mode .photo-detail img {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

html:not(.dark-mode) .photo-detail img {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.photo-caption {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 1.2rem;
    transition: color var(--transition-speed) ease;
}

html.dark-mode .photo-caption {
    color: var(--text-dark);
}

html:not(.dark-mode) .photo-caption {
    color: var(--text-light);
}

.photo-metadata {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    transition: color var(--transition-speed) ease;
}

html.dark-mode .photo-metadata {
    color: var(--text-secondary-dark);
}

html:not(.dark-mode) .photo-metadata {
    color: var(--text-secondary-light);
}

.photo-metadata .camera,
.photo-metadata .date {
    display: inline-block;
    margin: 0 5px;
}

.photo-metadata i {
    margin-right: 5px;
    opacity: 0.8;
}

.photo-tech-details {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.tech-detail {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

html.dark-mode .tech-detail {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary-dark);
}

html:not(.dark-mode) .tech-detail {
    background-color: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary-light);
}

.photo-dimensions {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.7;
}

.navigation-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    width: 100%;
}

.nav-button {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid;
    border-radius: 2rem;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

html.dark-mode .nav-button {
    background-color: var(--button-bg-dark);
    color: var(--text-dark);
    border-color: #444;
}

html:not(.dark-mode) .nav-button {
    background-color: var(--button-bg-light);
    color: var(--text-light);
    border-color: #ddd;
}

html.dark-mode .nav-button:hover {
    background-color: rgba(70, 70, 70, 0.9);
    box-shadow: var(--button-hover-shadow-dark);
    transform: translateY(-2px);
}

html:not(.dark-mode) .nav-button:hover {
    background-color: #fff;
    box-shadow: var(--button-hover-shadow-light);
    transform: translateY(-2px);
}

.nav-button i {
    margin: 0 8px;
}

.back-to-gallery {
    margin-top: 2rem;
    text-align: center;
}

/* Style for the options toggle and gallery button */
.options-toggle,
.gallery-button {
    position: fixed !important;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    outline: none;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.options-toggle {
    top: 20px;
    right: 20px;
}

.gallery-button {
    top: 20px;
    left: 20px;
}

/* Common styles for both buttons in dark/light mode */
html.dark-mode .options-toggle,
html.dark-mode .gallery-button {
    background-color: var(--button-bg-dark);
    color: var(--text-dark);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

html:not(.dark-mode) .options-toggle,
html:not(.dark-mode) .gallery-button {
    background-color: var(--button-bg-light);
    color: var(--text-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.options-toggle:hover,
.gallery-button:hover {
    transform: scale(1.1);
}

html.dark-mode .options-toggle:hover,
html.dark-mode .gallery-button:hover {
    background-color: rgba(70, 70, 70, 0.9);
}

html:not(.dark-mode) .options-toggle:hover,
html:not(.dark-mode) .gallery-button:hover {
    background-color: #fff;
}

/* Options Dialog Styles */
.options-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.options-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.options-dialog {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 320px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 100px);
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.options-dialog.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.options-dialog-content {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    max-height: inherit;
}

html.dark-mode .options-dialog-content {
    background-color: #2a2a2a;
    border: 1px solid #444;
}

html:not(.dark-mode) .options-dialog-content {
    background-color: #ffffff;
    border: 1px solid #ddd;
}

.options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid;
}

html.dark-mode .options-header {
    border-bottom-color: #444;
}

html:not(.dark-mode) .options-header {
    border-bottom-color: #e0e0e0;
}

.options-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.options-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

html.dark-mode .options-close {
    color: var(--text-dark);
}

html:not(.dark-mode) .options-close {
    color: var(--text-light);
}

html.dark-mode .options-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

html:not(.dark-mode) .options-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.options-body {
    padding: 0.5rem 0;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

.option-section {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid;
}

html.dark-mode .option-section {
    border-bottom-color: #333;
}

html:not(.dark-mode) .option-section {
    border-bottom-color: #f0f0f0;
}

.option-section:last-child {
    border-bottom: none;
}

.option-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

html.dark-mode .option-header {
    color: var(--text-secondary-dark);
}

html:not(.dark-mode) .option-header {
    color: var(--text-secondary-light);
}

.option-header i {
    opacity: 0.7;
}

/* Theme Toggle Button in Dialog */
.theme-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

html.dark-mode .theme-toggle-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: #444;
    color: var(--text-dark);
}

html:not(.dark-mode) .theme-toggle-btn {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: #ddd;
    color: var(--text-light);
}

html.dark-mode .theme-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #555;
}

html:not(.dark-mode) .theme-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    border-color: #ccc;
}

.theme-icon {
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-label {
    font-weight: 500;
}

/* EXIF Metadata Styles */
.exif-metadata {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.exif-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    font-size: 0.9rem;
}

.exif-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    min-width: 100px;
}

html.dark-mode .exif-label {
    color: var(--text-secondary-dark);
}

html:not(.dark-mode) .exif-label {
    color: var(--text-secondary-light);
}

.exif-label i {
    opacity: 0.7;
    width: 16px;
    text-align: center;
}

.exif-value {
    text-align: right;
    word-break: break-word;
}

html.dark-mode .exif-value {
    color: var(--text-dark);
}

html:not(.dark-mode) .exif-value {
    color: var(--text-light);
}

.exif-tech-details {
    margin-top: 0.5rem;
}

.exif-tech-details .photo-tech-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.exif-tech-details .tech-detail {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

html.dark-mode .exif-tech-details .tech-detail {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary-dark);
}

html:not(.dark-mode) .exif-tech-details .tech-detail {
    background-color: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary-light);
}

.exif-dimensions-item {
    margin-top: 0.75rem;
}

.exif-dimensions-item .photo-dimensions {
    font-size: 0.9rem;
    margin: 0;
}

html.dark-mode .exif-dimensions-item .photo-dimensions {
    color: var(--text-secondary-dark);
}

html:not(.dark-mode) .exif-dimensions-item .photo-dimensions {
    color: var(--text-secondary-light);
}

@media (max-width: 768px) {
    .photo-container {
        padding: 1rem;
        padding-top: 75px;
        /* Increased space for the fixed buttons */
    }

    .photo-caption {
        font-size: 1rem;
        margin-top: 1rem;
    }

    .photo-metadata {
        font-size: 0.8rem;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .photo-tech-details {
        gap: 0.3rem;
        margin-top: 0.3rem;
    }

    .tech-detail {
        font-size: 0.7rem;
        padding: 0.1rem 0.4rem;
    }

    .nav-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    /* Make sure buttons have the same size and proper positioning on mobile */
    .options-toggle,
    .gallery-button {
        width: 40px;
        height: 40px;
        position: fixed !important;
        top: 12px;
        /* Align both buttons at the same level */
    }

    .options-toggle {
        right: 12px;
    }

    .gallery-button {
        left: 12px;
    }

    /* Mobile-specific options dialog styles */
    .options-dialog {
        top: 60px;
        right: 12px;
        width: calc(100vw - 24px);
    }
}

/* Header styles to support dark mode */
header {
    transition: background-color var(--transition-speed) ease;
    position: relative;
}

html.dark-mode header {
    background-color: var(--bg-dark);
}

html.dark-mode .back-link {
    color: var(--text-dark);
}

html:not(.dark-mode) .back-link {
    color: var(--text-light);
}

/* Photo Tags Styling */
.photo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tag-enhanced {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background-color: rgba(0, 145, 255, 0.1);
  color: #0091ff;
  border-radius: 12px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 145, 255, 0.2);
}

.tag-enhanced:hover {
  background-color: #0091ff;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 145, 255, 0.3);
}

.tag-enhanced::before {
  content: "#";
  opacity: 0.7;
  margin-right: 0.25rem;
}

html.dark-mode .tag-enhanced {
  background-color: rgba(0, 145, 255, 0.15);
  color: #4db8ff;
  border-color: rgba(0, 145, 255, 0.3);
}

html.dark-mode .tag-enhanced:hover {
  background-color: #0091ff;
  color: white;
}

/* Tag section in options dialog */
.option-section .photo-tags {
  padding: 0.5rem 0;
}
