/* Font Styling */
h1, h2, h3, h4, h5 {
    font-family: "DM Serif Text", serif;
    font-weight: 400;
    font-style: normal;
}

.navbar .navbar-brand.site-logo {
    font-family: "DM Serif Text", serif;
    font-weight: 400;
}

h1 {
    font-size: 40px;
}

/* General Styling */
html, body {
    height: 100%;
}

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

.container {
    flex: 1;
}

footer {
    flex-shrink: 0;
}

/* Report button on cards (scoped – only when inside card wrap) */
.shelf-card-wrap { display: inline-block; position: relative; }
.shelf-card-wrap .report-btn { position: absolute; top: 4px; right: 4px; z-index: 5; padding: 2px 6px; font-size: 0.75rem; }
.report-btn:hover { background: rgba(220,53,69,0.15); }

/* Request marker (shows where a request is placed) */
.request-marker {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid #dc3545;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.15);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%) scale(calc(1 / var(--zoom-scale, 1)));
    transform-origin: center center;
    pointer-events: none;
    z-index: 12;
}

.request-preview {
    position: relative;
    width: 100%;
    max-height: 220px;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f9fa;
}
.request-preview img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 220px;
}
.request-preview .request-marker {
    transform: translate(-50%, -50%);
}

/* ISBN scan button (compact, next to ISBN inputs) */
.btn-isbn-scan { padding-left: 0.5rem; padding-right: 0.5rem; flex-shrink: 0; }

/* Language picker modal */
.language-picker-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.language-picker-section { margin-bottom: 1rem; }
.language-picker-section:last-child { margin-bottom: 0; }
.language-picker-label { font-weight: 600; }

/* Specific Elements Styling */
.shelf-section {
    height: 200px;
    width: auto;
    object-fit: contain;
    margin-top: -5px;
    margin-left: -5px;
    border: 5px solid #fff;
}

.editBookButton {
    margin-left:15.5px;
    margin-top:15.5px;
}

#imageContainer img {
    max-width: 100vw;
    max-height: 80vh;
}

.modal-body {
    max-height: 80vh;
    overflow-x: auto;
}

#modalImage {
    max-height: 70vh;
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

#magnifier {
    position: absolute;
    border: 2px solid #000;
    border-radius: 50%;
    pointer-events: none;
    display: none;
    overflow: hidden;
    width: 200px;
    height: 200px;
}

#shelfMagnifier {
    position: absolute;
    border: 2px solid #000;
    border-radius: 50%;
    pointer-events: none;
    display: none;
    overflow: hidden;
    width: 200px;
    height: 200px;
    z-index: 9;
}

#shelfMiniMap {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 160px;
    height: 100px;
    border: 1px solid rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(2px);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 10;
    overflow: hidden;
    pointer-events: none;
}

#shelfMiniViewport {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

@media (max-width: 767px) {
    #shelfMiniMap {
        width: 120px;
        height: 80px;
    }
}

.scrollable-container {
    white-space: nowrap;
    overflow-x: auto;
}

.scrollable-container img,
.scrollable-container .profile-picture {
    display: inline-block;
    vertical-align: top;
    margin-right: 10px;
}

.profile-picture {
    border-radius: 50%;
    height: 100px;
    width: 100px;
}

.profile-picture-sm {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.liked-shelf-thumb {
    width: 150px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#mostLikedUsersContainer,
#mostLikedShelvesContainer,
#mostLikedBooksContainer {
    min-height: 110px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.liked-book-link {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: inherit;
}

.book-shelf {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    align-content: flex-end;
    gap: 6px;
    padding: 12px;
    background: #c49a6c;
    border-radius: 6px;
    min-height: 120px;
}

.book-shelf-compact {
    padding: 10px;
    min-height: 110px;
}

.book-spine {
    display: inline-flex;
    flex-shrink: 0;
    align-items: flex-end;
    justify-content: center;
    width: 26px;
    min-width: 26px;
    min-height: 90px;
    padding: 6px 2px;
    color: #fff;
    font-size: 10px;
    text-decoration: none;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    border-radius: 4px;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
    max-height: 140px;
    overflow: hidden;
}

.book-spine:hover {
    filter: brightness(1.05);
    color: #fff;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.like-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.shelf-wrap .like-btn,
#likeShelfContainer .like-btn,
.browse-shelf-wrap .like-btn {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(2px);
}

.shelf-wrap .like-btn:hover,
#likeShelfContainer .like-btn:hover {
    background: rgba(255, 255, 255, 0.95);
}

.shelf-modal-actions {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
}

.shelf-modal-actions .btn {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(2px);
}

.shelf-modal-actions .btn:hover {
    background: rgba(255, 255, 255, 0.95);
}

.shelf-comment-box,
.book-comment-box {
    max-width: 100%;
    margin-top: 12px;
}

#imageModal .modal-body {
    position: relative;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

#imageModal #zoomPanWrap {
    height: 70vh;
}

#imageModal #zoomPanInner {
    height: auto;
}

#imageModal #modalImage {
    height: auto;
    width: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.shelf-comments,
.book-comments {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.book-comment-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.book-comment-row.is-owner { justify-content: flex-start; }
.book-comment-row.is-other { justify-content: flex-end; }

.book-comment-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    min-width: 140px;
}

.book-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 32px;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.book-comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.book-comment-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.book-comment-bubble {
    border: 1px solid #cfe2ff;
    border-radius: 14px;
    padding: 8px 12px;
    flex: 1 1 auto;
    max-width: 100%;
    text-align: center;
    background: #fff;
    font-size: 0.9rem;
}

.book-comment-row.is-other .book-comment-bubble {
    border-color: #f5c2c7;
}

.book-comment-time {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #6c757d;
}

.additional-book-image {
    width: 100%;
    height: 120px !important;
    object-fit: cover !important;
}

#shelfImage {
    max-height: 55vh;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.glow-header {
    margin-top: 10px;
    font-size: 1.2em;
}

.shelf-container {
    overflow-x: auto;
    white-space: nowrap;
    width: 100%;
}

.shelf-image {
    height: 70vh;
    width: auto;
    display: inline-block;
}

.marker {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: red;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.seller-info {
    margin-top: 20px;
}

.seller-info img {
    max-width: 100px;
}

.profile-card .profile-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    padding: 16px;
    position: relative;
}

.profile-card .profile-header-left {
    display: flex;
    gap: 16px;
    align-items: center;
    flex: 1 1 260px;
}

.profile-card .profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.profile-card .profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-card .profile-meta {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.profile-card .profile-meta h1 {
    color: #fff;
}

.profile-card .profile-country {
    font-size: 0.9rem;
    opacity: 0.85;
}

.profile-header-country {
    position: absolute;
    top: 10px;
    left: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 8px;
    border-radius: 12px;
}

.profile-header-like {
    position: absolute;
    top: 10px;
    right: 12px;
}

.profile-header-like .like-btn {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.15);
}

.profile-card .profile-header-right {
    flex: 1 1 320px;
}

.profile-card .profile-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

@media (max-width: 767px) {
    .profile-card .profile-avatar {
        width: 90px;
        height: 90px;
    }

    .profile-card .profile-meta h1 {
        font-size: 28px;
    }
}

.profile-card .profile-gallery .library-img-wrapper {
    width: 110px;
    height: 80px;
}

#libraryCarousel .carousel-item img {
    max-height: 70vh;
    object-fit: contain;
}

.card-unanswered {
    background-color: rgba(255, 0, 0, 0.1);
}

#highlightCoordinates {
    border: 2px solid red;
    width: 32px;  /* Adjust based on visibility */
    height: 32px; /* Adjust based on visibility */
}


/* Book dimensions diagram (A=width, B=height, C=spine) */
.book-dimensions-diagram {
    flex-shrink: 0;
    opacity: 0.9;
}

/* Responsive Styling */
@media (max-width: 767px) {
    .shelf-section {
        height: 100px;
    }
}