/* ==================================================
   Global Reset & Layout
================================================== */
html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #ecddae;
    font-family: Copperplate, 'Palatino Linotype', serif;
    font-size: 16px;
    width: 100vw;
}

#content {
    flex: 1;
}

.logo {
    width: 128px;
    height: auto;
}

/* ==================================================
     Footer
================================================== */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #810000;
    color: #ecd2ae;
    margin-top: auto;
    flex-wrap: wrap;
}

.developer-info {
    text-align: right;
    font-size: 0.9rem;
}

@media screen and (max-width: 600px) {
    footer {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .developer-info {
        text-align: center;
    }
}

/* ==================================================
     Header & Navigation
================================================== */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.top-nav {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 80%;
    margin: 0 auto;
    flex-wrap: wrap;
}

.top-nav>.logo-container,
.top-nav>.search-section,
.top-nav>.profile-container {
    flex: 1;
    padding: 5px;
}

.top-nav>.logo-container {
    text-align: left;
    min-width: 120px;
}

.top-nav>.search-section {
    display: flex;
    justify-content: center;
    flex: 2;
}

.top-nav>.profile-container {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    min-width: 120px;
}

#add-book-button {
    display: none;
}

.search-input {
    padding: 8px;
    font-size: 0.9rem;
    border: 1px solid #810000;
    border-radius: 5px 0 0 5px;
    flex: 1;
    max-width: 250px;
}

.search-button {
    padding: 8px 15px;
    font-size: 0.9rem;
    background-color: #810000;
    color: white;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}

.search-bar {
    display: flex;
    width: 80%;
    max-width: 300px;
    align-items: center;
}

@media screen and (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        gap: 15px;
    }

    .top-nav>.logo-container,
    .top-nav>.search-section,
    .top-nav>.profile-container {
        width: 100%;
        justify-content: center;
        text-align: center;
        height: 80%;
    }

    .search-bar {
        width: 80%;
        max-width: 80%;
    }

    .search-input {
        max-width: none;
    }
}

/* ==================================================
     Titles & Headings
================================================== */
.title {
    display: flex;
    width: 100%;
    max-width: 700px;
    justify-content: center;
    text-align: center;
    margin: 0 auto;
}

h1 {
    font-size: 5em;
    font-family: Copperplate, 'Palatino Linotype', serif;
    margin: 15px 0;
    text-align: center;
}

.description {
    display: flex;
    justify-content: center;
    width: 80%;
    max-width: 750px;
    font-size: 1.5em;
    font-family: Copperplate, 'Palatino Linotype', serif;
    text-align: center;
    margin: 0 auto;
    padding: 0 15px;
}

@media screen and (max-width: 768px) {
    h1 {
        font-size: 3em;
    }

    .description {
        font-size: 1.2em;
        max-width: 80%;
    }
}

@media screen and (max-width: 480px) {
    h1 {
        font-size: 2.5em;
    }

    .description {
        font-size: 1em;
        max-width: 80%;
    }


}

/* ==================================================
     Main Content
================================================== */
.title-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 15px;
}

#content .search-section {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 0 15px;
}

.buttons-section {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
    padding: 0 15px;
}

/* ==================================================
     Books Table
================================================== */
.book_table {
    border-collapse: collapse;
    width: 95%;
    max-width: 600px;
    margin: 20px auto;
    font-family: Arial, sans-serif;
    margin-bottom: 20px;
    background-color: #eccfae;
    height: 280px;
}

.book_table td {
    border: 1px solid #810000;
    padding: 10px;
}

.book_title {
    font-weight: bold;
    font-size: 1.2em;
}

.book_picture {
    width: 157px;
    height: auto;
    object-fit: cover;
    cursor: pointer;
}

.book_author {
    font-size: 1em;
    width: 80%;
}

.book_resume {
    font-size: 0.9em;
    width: 421px;
    height: 200px;
    vertical-align: top;
}

.book_score {
    font-size: 0.9em;
    text-align: center;
    width: 20%;
}

@media screen and (max-width: 600px) {
    .book_table td {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        box-sizing: border-box;
    }

    .book_table td:first-child {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .book_picture {
        width: auto;
        max-width: 157px;
    }

    .book_title,
    .book_author,
    .book_score {
        text-align: center;
    }

    .book_title {
        font-size: 1.1em;
    }

    .book_score {
        font-weight: bold;
    }
}

/* ==================================================
     Book Table Detail
================================================== */
#book_table_detail {
    width: 95%;
    max-width: 1200px;
    margin: 20px auto;
    font-family: Arial, sans-serif;
    background-color: #eccfae;
    padding: 15px;
    box-sizing: border-box;
}

.book-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.book-text {
    flex: 1;
    border: 1px solid #810000;
    padding: 10px;
    min-width: 300px;
}

.book-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

#book_title_detail {
    font-weight: bold;
    font-size: 1.6em;
    padding-bottom: 10px;
}

#book_author_detail,
#book_avgscore_detail {
    font-size: 1.2em;
}

#book_resume_detail {
    font-size: 1em;
    border-top: 2px solid #810000;
    border-bottom: 2px solid #810000;
    padding: 10px 5px;
}

.book-image-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid #810000;
    padding: 10px;
    min-width: 270px;
    align-items: center;
}

.book-image img {
    width: 250px;
    height: auto;
    object-fit: cover;
    cursor: pointer;
    border: 3px solid #810000;
    border-radius: 4px;
}

.book-interactions {
    display: none;
    justify-content: center;
    flex-direction: row;
    gap: 20px;
    padding: 10px;
}

#book_score_detail,
#book_fav_detail {
    font-size: 1em;
}

@media screen and (max-width: 768px) {
    .book-container {
        flex-direction: column;
    }

    .book-text,
    .book-image-container {
        width: 95%;
    }
}

/* ==================================================
     Comments Section
================================================== */
#add-comment-container {
    width: 80%;
    max-width: 600px;
    margin: 20px auto;
    padding: 15px;
    background-color: #eccfae;
    border: 1px solid #810000;
    border-radius: 10px;
    box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#add-comment-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#add-comment-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    resize: none;
    font-family: Copperplate, 'Palatino Linotype', serif;
    margin-bottom: 10px;
    font-size: 1em;
    box-sizing: border-box;
}

#add-comment-form button {
    background-color: #810000;
    color: #ecd2ae;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#add-comment-form button:hover {
    background-color: #420e07;
}

.comment-block {
    width: 75%;
    max-width: 700px;
    margin: 20px auto;
    background-color: #f7e1c2;
    border: 1px solid #810000;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.commenter-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.commenter {
    font-weight: bold;
    color: #810000;
}

.comment {
    color: #333;
    margin-top: 5px;
}

.comment-block hr {
    border: 0;
    border-top: 1px solid #810000;
    margin: 10px 0;
}

@media screen and (max-width: 600px) {
    .comment-block {
        padding: 15px;
        margin: 15px auto;
    }
}

#commentsTablesContainer p {
    text-align: center;
    font-size: 1em;
    font-weight: bold;
    color: #810000;
    padding: 10px;
    background-color: #eccfae;
    max-width: 600px;
    margin: 20px auto;
    border: 1px solid #810000;
    width: 95%;
}

/* ==================================================
     Buttons & Modals
================================================== */
button,
.search-button {
    background-color: #810000;
    color: #ecd2ae;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover,
.search-button:hover {
    background-color: #420e07;
}

.return-container {
    display: flex;
    justify-content: center;
}

.return-button {
    background-color: #810000;
    color: #ecd2ae;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.return-button:hover {
    background-color: #420e07;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.profile-modal-content,
.add-book-modal-content {
    background-color: #ecd2ae;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 350px;
    text-align: center;
}

.profile-modal-content input,
.add-book-modal-content input,
.add-book-modal-content textarea {
    width: 90%;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

.add-book-modal-content textarea {
    height: 80px;
    resize: vertical;
}

.modal-button {
    background-color: #810000;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    color: #ecd2ae;
    cursor: pointer;
    margin: 5px;
}

.modal-button:hover {
    background-color: #420e07;
}

.close-button {
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    float: right;
}



/* ==================================================
     Profile Page Styles
================================================== */

.profile-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 15px;
    background-color: #f7e1c2;
    border-radius: 10px;
    max-width: 600px;
    margin: 30px auto;
    box-shadow: 0 0 10px rgba(129, 0, 0, 0.2);
    gap: 20px;
}

.profile-main h2 {
    color: #810000;
    font-size: 2em;
    margin-bottom: 10px;
    text-align: center;
}

#profile-picture {
    border-radius: 10px;
    border: 3px solid #810000;
    object-fit: cover;
    width: 150px;
    height: 150px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
}



.pfp-container {
    flex-shrink: 0;
}

.text-container {
    display: flex;
    flex-direction: column;
}

.commenter {
    font-weight: bold;
    margin-bottom: 4px;
}

.comment {
    white-space: pre-wrap;
}

.comment-profile-picture {
    border-radius: 10px;
    border: 3px solid #810000;
    object-fit: cover;
    width: 150px;
    height: 150px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
}

#upload-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

#upload-form input[type="file"] {
    background-color: #ecd2ae;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #810000;
    font-family: Copperplate, 'Palatino Linotype', serif;
    width: 90%;
    max-width: 300px;
}

#upload-form button {
    background-color: #810000;
    color: #ecd2ae;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#upload-form button:hover {
    background-color: #420e07;
}

#logout-button {
    margin-top: 20px;
    font-weight: bold;
}

@media screen and (max-width: 480px) {
    .profile-main {
        padding: 20px 10px;
        gap: 15px;
    }

    .profile-main h2 {
        font-size: 1.5em;
    }

    #profile-picture {
        width: 120px;
        height: 120px;
    }
}

#logout-button:hover {
    background-color: red;
}

#file-upload {
    display: none;
}

.custom-file-upload {
    background-color: #ecd2ae;
    color: #810000;
    padding: 10px 20px;
    border: 2px solid #810000;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.custom-file-upload:hover {
    background-color: #810000;
    color: #f7e1c2;
}

.profile-thumb {
    width: 100px;
    height: 100px;
    object-fit: cover;
    cursor: pointer;
    border-radius: 50%;
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.lightbox-content {
    display: block;
    margin: 5% auto;
    max-width: 80%;
    max-height: 80%;
    border-radius: 10px;
    box-shadow: 0 0 20px #000;
}

.lightbox .close {
    position: absolute;
    top: 30px;
    right: 50px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}


/* ==================================================
     Offline Page
================================================== */
.offline-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
    padding: 20px;
    background-color: #ecddae;
}

.offline-container h1 {
    font-size: 2.5em;
    font-family: Copperplate, 'Palatino Linotype', serif;
    color: #810000;
    margin-bottom: 20px;
}

.offline-container p {
    font-size: 1.2em;
    font-family: Copperplate, 'Palatino Linotype', serif;
    color: #420e07;
    margin: 10px 0;
}

.offline-container button {
    background-color: #810000;
    color: #ecd2ae;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.offline-container button:hover {
    background-color: #420e07;
}

/* Small Screen Optimizations */
@media screen and (max-width: 350px) {
    body {
        font-size: 14px;
    }

    .logo {
        width: 80px;
    }

    h1 {
        font-size: 2em;
    }

    .description {
        font-size: 0.9em;
        max-width: 80%;
    }

    button,
    .search-button,
    .return-button,
    .modal-button {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    .top-nav {
        padding: 10px;
    }

    .search-input {
        padding: 6px;
    }
}

/* ===========================
   ENTER BUTTON CLEANUP START
=========================== */

/* Base (desktop / default) */
.enterButton {
    font-size: 1.2em;
    padding: 20px 30px;
    margin-top: 20px;
    width: auto;
    height: auto;
    min-width: 120px;
}

/* Tablet and medium screens */
@media screen and (max-width: 768px) {
    .enterButton {
        font-size: 1em;
        padding: 15px 20px;
        margin-top: 15px;
        height: auto;

    }
}

/* Small screens */
@media screen and (max-width: 480px) {
    .enterButton {
        font-size: 0.9em;
        padding: 12px 18px;
        margin-top: 12px;
        height: auto;
    }
}

/* Very small screens */
@media screen and (max-width: 350px) {
    .enterButton {
        font-size: 0.8em;
        padding: 10px 15px;
        margin-top: 10px;
    }
}

/* =========================
   ENTER BUTTON CLEANUP END
========================= */

#main-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    gap: 20px;
}

#map-container {
    flex: 0 0 60%;
    height: 500px;
}


#map {
    width: 100%;
    height: 100%;
    border: 2px solid #810000;
    border-radius: 10px;
}

#library-list {
    flex: 1;
    height: 500px 96%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: #f7e1c2;
    border: 1px solid #810000;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    list-style-type: none;
}

@media (max-width: 1200px) {
    #main-container {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    #map-container,
    #library-list {
        width: 90%;
        max-width: 600px;
    }

    #map-container {
        min-height: 400px;
        max-height: 400px;
    }

    #map {
        width: 100%;
        height: 100%;
        max-height: 400px;
    }

    #library-list {
        height: 400px;
        min-height: 25px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 10px;
    }
}

#library-list p {
    margin: 3px;
}

#library-list li {
    cursor: pointer;
}

#askButton {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50%;
    max-width: 200px;
    margin: 0 auto;
    padding: 10px 20px;
    font-size: 16px;
    background-color: #810000;
    color: #ecd2ae;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#askButton:hover {
    background-color: #420e07;
}