/* Photo page styles */

body {
    display: flex;
    flex-direction: column;
}

.navbar {
    border-bottom: 1px solid #333;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #888;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #d0d0d0;
}

.photo-container {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.photo-frame {
    position: relative;
    max-width: 90vw;
    max-height: calc(100vh - 180px);
}

.close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3a3a3a;
    border: 2px solid #555;
    color: #d0d0d0;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
    z-index: 10;
}

.close-btn:hover {
    background: #4a4a4a;
    border-color: #777;
    color: #fff;
}

.photo-frame img {
    max-width: 100%;
    max-height: calc(100vh - 180px);
    object-fit: contain;
    border: 20px solid #d8d8d8;
    outline: 5px solid #5a5a5a;
    outline-offset: 3px;
    background: #5a5a5a;
    padding: 5px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8),
                inset 0 0 12px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(0, 0, 0, 0.3);
}

/* Fragment overlays on photo */
.fragment-highlight {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.2s ease;
}

.fragment-highlight.rect {
    border: 2px solid rgba(255, 180, 50, 0.9);
    background: rgba(255, 180, 50, 0.15);
}

.fragment-highlight.point {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 180, 50, 0.9);
    background: rgba(255, 180, 50, 0.25);
    transform: translate(-50%, -50%);
}

.fragment-tooltip {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 6px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    max-width: 260px;
    min-width: 100px;
    z-index: 7;
    pointer-events: none;
}

.fragment-tooltip-author {
    color: #a0a0a0;
    font-size: 0.7rem;
    margin-bottom: 0.15rem;
}

.fragment-tooltip-text {
    color: #ccc;
    font-size: 0.8rem;
    line-height: 1.4;
    word-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fragment-highlight.point .fragment-tooltip {
    left: 50%;
    transform: translateX(-50%);
}

/* Selection preview while drawing */
.fragment-preview {
    position: absolute;
    border: 2px dashed rgba(255, 180, 50, 0.8);
    background: rgba(255, 180, 50, 0.1);
    pointer-events: none;
    z-index: 6;
    display: none;
}

.fragment-pin-preview {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 180, 50, 0.9);
    background: rgba(255, 180, 50, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 6;
    display: none;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(60, 60, 60, 0.8);
    border: 2px solid #555;
    color: #d0d0d0;
    font-size: 2rem;
    width: 60px;
    height: 80px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
    z-index: 10;
}

.nav-arrow:hover {
    background: rgba(80, 80, 80, 0.9);
    border-color: #777;
    color: #fff;
}

.nav-arrow.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.nav-prev {
    left: 1rem;
}

.nav-next {
    right: 1rem;
}

.photo-footer {
    background: #1a1a1a;
    border-top: 1px solid #333;
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.photo-info {
    color: #888;
    font-size: 0.9rem;
}

.photo-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.photo-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background: #3a3a3a;
    border: 2px solid #555;
    color: #d0d0d0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.photo-nav a:hover {
    background: #4a4a4a;
    border-color: #666;
    color: #fff;
}

.photo-nav a.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.photo-nav .current {
    color: #888;
    font-size: 0.9rem;
}

.share-section {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #888;
    text-decoration: none;
    font-size: 0.8rem;
    font-family: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
}

.share-btn:hover {
    border-color: #666;
    color: #ccc;
}

.share-btn.facebook:hover { border-color: #1877f2; color: #1877f2; }
.share-btn.twitter:hover { border-color: #888; color: #fff; }
.share-btn.pinterest:hover { border-color: #e60023; color: #e60023; }
.share-btn.copy:hover { border-color: #666; color: #ccc; }
.share-btn.copy.copied { border-color: #4a4; color: #6a6; }
.share-btn.favorited { border-color: #c44; color: #e25555; }
.share-btn.favorited:hover { border-color: #e25555; color: #e25555; }
.fav-count { font-size: 0.75rem; opacity: 0.8; }

.share-label {
    display: none;
}

@media (min-width: 480px) {
    .share-label {
        display: inline;
    }
}

.photo-description {
    max-width: 800px;
    margin: 0 auto 1rem;
    padding: 1rem 2rem;
    text-align: center;
    color: #a0a0a0;
    font-size: 1rem;
    line-height: 1.6;
    font-style: italic;
}

.photo-description:empty {
    display: none;
}

.photo-metadata {
    max-width: 800px;
    margin: 0 auto 1rem;
    padding: 0 2rem;
    text-align: center;
}

.meta-item {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: #888;
}

.meta-label {
    color: #666;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    margin-right: 0.5rem;
}

.meta-value {
    color: #a0a0a0;
}

.meta-range {
    color: #777;
    font-size: 0.85rem;
}

.meta-tags {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
}

.tag-pill {
    display: inline-block;
    color: #555;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.tag-pill::before {
    content: '#';
    color: #444;
}

.size-toggle {
    position: fixed;
    bottom: 5rem;
    right: 1rem;
    background: rgba(60, 60, 60, 0.9);
    border: 2px solid #555;
    color: #d0d0d0;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    z-index: 20;
    transition: all 0.2s ease;
}

.size-toggle:hover {
    background: rgba(80, 80, 80, 0.95);
    border-color: #777;
    color: #fff;
}

.photo-container.original-size {
    overflow: auto;
    align-items: flex-start;
}

.photo-container.original-size .photo-frame {
    max-width: none;
    max-height: none;
}

.photo-container.original-size .photo-frame img {
    max-width: none;
    max-height: none;
}

.zoom-lens {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    border: 3px solid #d8d8d8;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 100;
    background-repeat: no-repeat;
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .zoom-lens {
        display: block;
    }
}

@media (max-width: 768px) {
    .photo-container {
        padding: 1rem;
    }

    .photo-frame img {
        border-width: 12px;
        outline-width: 3px;
    }

    .nav-arrow {
        width: 40px;
        height: 60px;
        font-size: 1.5rem;
    }

    .nav-prev {
        left: 0.5rem;
    }

    .nav-next {
        right: 0.5rem;
    }

    .photo-footer {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
}

.photo-map-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 1rem;
    padding: 0 2rem;
}

#photoMap {
    height: 250px;
    border: 1px solid #3a3a3a;
}

.admin-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1rem auto;
}

.admin-btn {
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-family: "Georgia", "Times New Roman", serif;
    background: rgba(255,255,255,0.06);
    border: 1px solid #444;
    color: #999;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.admin-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #d0d0d0;
    border-color: #666;
}

.admin-btn.danger {
    border-color: #633;
    color: #c66;
}

.admin-btn.danger:hover {
    background: rgba(200,60,60,0.15);
    border-color: #944;
}

/* Comments section */
.comments-section {
    max-width: 800px;
    margin: 1rem auto 2rem;
    padding: 0 2rem;
}

.comments-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #888;
    font-size: 0.95rem;
}

.comments-header .count {
    color: #666;
    font-size: 0.85rem;
}

.comment-form {
    margin-top: 1rem;
    border-top: 1px solid #2a2a2a;
    padding-top: 1rem;
}

.comment-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.comment-form textarea {
    flex: 1;
    height: 38px;
    min-height: 38px;
    max-height: 200px;
    padding: 0.5rem 0.75rem;
    background: #222;
    border: 1px solid #333;
    border-radius: 4px;
    color: #b8b8b8;
    font-family: inherit;
    font-size: 0.85rem;
    resize: none;
    overflow: hidden;
    transition: border-color 0.2s ease;
    line-height: 1.5;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #555;
}

.comment-form textarea::placeholder {
    color: #555;
}

.comment-form-btns {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.comment-submit {
    padding: 0.45rem 0.75rem;
    background: #333;
    border: 1px solid #444;
    border-radius: 4px;
    color: #888;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.comment-submit:hover {
    background: #444;
    color: #d0d0d0;
    border-color: #555;
}

.comment-submit:disabled {
    opacity: 0.4;
    cursor: default;
}

.annotate-btn {
    padding: 0.45rem 0.5rem;
    background: transparent;
    border: 1px solid #333;
    border-radius: 4px;
    color: #555;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.annotate-btn:hover {
    color: #999;
    border-color: #555;
}

.annotate-btn.active {
    border-color: #b87333;
    color: #d4a054;
}

.annotate-toolbar {
    display: none;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0 0;
}

.annotate-toolbar.visible {
    display: flex;
}

.annotate-mode-btn {
    padding: 0.3rem 0.6rem;
    background: transparent;
    border: 1px solid #333;
    border-radius: 3px;
    color: #666;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.annotate-mode-btn:hover {
    color: #aaa;
    border-color: #555;
}

.annotate-mode-btn.active {
    background: rgba(184, 115, 51, 0.15);
    border-color: #b87333;
    color: #d4a054;
}

.annotate-info {
    color: #555;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.fragment-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b87333;
    margin-right: 0.3rem;
    vertical-align: middle;
}

.comment-card {
    padding: 0.75rem 0;
    border-bottom: 1px solid #2a2a2a;
}

.comment-card:last-child {
    border-bottom: none;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
}

.comment-author {
    color: #a0a0a0;
    font-weight: normal;
}

.comment-time {
    color: #555;
}

.comment-fragment-btn {
    background: none;
    border: 1px solid #444;
    color: #b87333;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.comment-fragment-btn:hover {
    border-color: #b87333;
    color: #d4a054;
}

.comment-actions {
    margin-left: auto;
    display: flex;
    gap: 0.4rem;
}

.comment-edit, .comment-delete {
    background: none;
    border: none;
    color: #555;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
}

.comment-edit:hover {
    color: #aaa;
}

.comment-delete:hover {
    color: #c66;
}

.comment-edited {
    color: #555;
    font-size: 0.7rem;
    font-style: italic;
}

.comment-edit-area {
    width: 100%;
    min-height: 38px;
    max-height: 200px;
    padding: 0.5rem 0.75rem;
    background: #222;
    border: 1px solid #555;
    border-radius: 4px;
    color: #b8b8b8;
    font-family: inherit;
    font-size: 0.85rem;
    resize: none;
    overflow: hidden;
    line-height: 1.5;
}

.comment-edit-area:focus {
    outline: none;
    border-color: #777;
}

.comment-edit-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.comment-edit-actions button {
    padding: 0.25rem 0.6rem;
    background: #333;
    border: 1px solid #444;
    border-radius: 3px;
    color: #888;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.comment-edit-actions button:hover {
    background: #444;
    color: #ccc;
}

.comment-edit-actions .cancel-edit:hover {
    color: #999;
}

.comment-body {
    color: #999;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.comment-body a {
    color: #8899aa;
    text-decoration: none;
    border-bottom: 1px solid #445;
}

.comment-body a:hover {
    color: #aabbcc;
    border-color: #668;
}

.comment-card.deleted .comment-body {
    color: #555;
    font-style: italic;
}

.comments-empty {
    color: #555;
    font-size: 0.85rem;
    font-style: italic;
}

/* Related photos */
.related-section {
    max-width: 800px;
    margin: 0 auto 2rem;
    padding: 0 2rem;
}

.related-header {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.related-strip {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.related-strip::-webkit-scrollbar {
    height: 4px;
}

.related-strip::-webkit-scrollbar-thumb {
    background: #444;
}

.related-thumb {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border: 2px solid #444;
    display: block;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.related-thumb:hover {
    border-color: #888;
}

/* Investigation mode */
.investigate-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #888;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.investigate-toggle:hover {
    border-color: #666;
    color: #ccc;
}

.investigate-toggle.active {
    border-color: #b87333;
    color: #d4a054;
    background: #2a2a2a;
}

.investigate-toggle.active:hover {
    border-color: #d4a054;
    color: #e8c080;
}

.investigation-fragment {
    pointer-events: auto;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.investigation-fragment:hover {
    opacity: 1;
}

.investigation-fragment.dimmed {
    opacity: 0.1;
}

.investigation-fragment.selected {
    opacity: 1;
    z-index: 8;
}

.investigation-fragment .fragment-tooltip {
    pointer-events: auto;
    cursor: pointer;
}

.investigation-fragment.selected .fragment-tooltip {
    display: block !important;
}

.fragment-label {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: #1a1a1a;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 6;
}

.fragment-highlight.point .fragment-label {
    top: -8px;
    left: 8px;
}

.comment-inv-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: #1a1a1a;
    font-size: 0.65rem;
    font-weight: bold;
    flex-shrink: 0;
}

.comment-card.selected-comment {
    border-left: 2px solid #b87333;
}

.comment-card.flash {
    background: rgba(184, 115, 51, 0.1);
    transition: background 0.3s ease;
}

@media (max-width: 768px) {
    .investigation-fragment.point {
        width: 28px;
        height: 28px;
    }

    .fragment-label {
        width: 22px;
        height: 22px;
        font-size: 0.75rem;
    }
}