/* Import Google Material Icons */
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap');

:root {
    --font-title: 'New Rocker', sans-serif;
    --clr-primary: #F8E660;
    --clr-white: #fff;
    --clr-dark: #000;
    --clr-bg: rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    margin-top: 0 !important;
}

body,
html {
    width: 100dvw;
    height: 100dvh;
    overflow: hidden;
    background: white;
    /* Changed from black to white */
    display: flex;
    align-items: center;
    font-family: 'Roboto', sans-serif;
    overflow: hidden;
}

#viewer .icon {
    --size: clamp(16px, 1.15vw, 22px);
    --color: var(--clr-dark);
    --hover-color: var(--clr-primary);
}

#shareModal.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--clr-bg);
    /* Made more transparent */
}

#shareModal .modal-content {
    background-color: var(--clr-white);
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #ddd;
    /* Lighter border */
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
    color: #333;
    position: relative;
}

#shareModal .close {
    color: #777;
    /* Darker for better contrast on light background */
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 5px;
}

#shareModal .close:hover,
#shareModal .close:focus {
    color: #333;
    /* Changed from yellow to dark gray */
    text-decoration: none;
    cursor: pointer;
}

#shareModal .a2a_kit {
    margin-top: 20px;
    text-align: center;
}

#viewer {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: #1f1f1f;
}

#viewer .comic-img-wrapper {
    width: 100%;
    display: grid;
    place-items: center;
    flex-grow: 1;
}

/*#viewer .comic-img-container {
    width: min(67.71vw, 1300px);
    height: min(33.85vw, 650px);
}*/

#viewer .comic-img-container {
  display: flex;
  max-height: calc(100dvh - 85px);
  justify-content: center;
  align-items: center;
}

#viewer .comic-img-container img {
  max-width: min(100vw, 1300px);
  width: auto;
  height: auto;
  object-fit: contain;
}

#comic-image {
    width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease-in-out;
}

#chapter-title {
    font-family: var(--font-title);
}

#bottom-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    transition: background 0.3s ease;
    background: #0d0d0d;
    /* Lighter background */
}

#bottom-bar-fullscreen {
    width: 100%;
    display: none;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 20px;
    /* Transparent white */
}

.fullscreen #bottom-bar {
    display: none;
}

.fullscreen #bottom-bar-fullscreen {
    display: flex;
}

.left,
.center,
.right {
    display: flex;
    align-items: center;
    gap: 10px;
    @media (max-width: 580px) {
        gap: 8px;
    }
    @media (max-width: 387px) {
        gap: 0px;
    }
}

.button-chapter {
    color: #0d0d0d;
    /* Dark text for light mode */
    border: none;
    padding: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: 0.2s;
    background: none;
    border-radius: 8px;
    /* Adding specific styles to prevent pink color on click */
    outline: none;
}

/* Adding visited state to prevent color change */
.button-chapter:visited {
    color: #909090;
}

/* Adding active state to prevent color change */
.button-chapter:active {
    color: #909090;
    background-color: rgba(0, 0, 0, 0.1);
    /* Light gray background on click */
}

.button-chapter:disabled {
    cursor: default;
}

.button-chapter:hover:not(:disabled) {
    opacity: 0.3;
}

.button-chapter:disabled .icon-rounded {
    background-color: #555;
}

.button-chapter:hover {
    background: rgba(0, 0, 0, 0.1);
    /* Light gray for hover */
}

.button-chapter.active .icon-rounded {
    background-color: var(--clr-primary);
}

.chapter-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--clr-white);
    /* Dark text */
}

.chapter-info img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
}

.hidden {
    display: none;
}

.button-chapter .material-icons,
.button-chapter .icon-rounded {
    font-size: 24px;
    vertical-align: middle;
    color: #0d0d0d;
    /* Dark icons */
    /*background-color: #ffffff4d;*/
    background-color: #fff;
    /* Light background */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 350ms ease;
    -webkit-transition: background-color 350ms ease;
}

.button-chapter .icon-rounded {
    pointer-events: none;
}

.button-chapter.home {
    padding: 0 10px 0 0;
}

.button-chapter.home:hover .icon {
    --color: var(--clr-primary) !important;
}

#viewer .button-chapter.home .icon {
    --color: var(--clr-white);
    --hover-color: var(var(--clr-white));
}

.button-chapter:not([disabled]):hover .material-icons,
.button-chapter:not([disabled]):hover .icon-rounded {
    background-color: var(--clr-white);
    transition: background-color 350ms ease;
    -webkit-transition: background-color 350ms ease;
}

.button-chapter[data-liked="true"] .icon-rounded {
    background-color: var(--clr-primary);
}

.button-chapter.home:hover .icon {
    --color: var(--clr-primary);
}

/* Progress Bar Styles */
#progress-bar-container {
    width: 100%;
    height: 5px;
    background: transparent;
}

#progress-bar {
    height: 100%;
    background: var(--clr-primary);
    width: 0;
    transition: width 0.3s ease;
}

#like {
    display: flex;
}

.like-count {
    color: var(--clr-white);
    align-self: center;
    padding-left: 0.5em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--clr-bg);
    /* More transparent */
}

.modal-content {
    background-color: #f8f8f8;
    /* Light background */
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #ddd;
    /* Light border */
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
    color: #333;
    /* Dark text */
}

.a2a_svg{
    width: 40px !important;
    height: 40px !important ;
}

.close-button {
    color: #777;
    /* Darker for better contrast */
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #333;
    /* Dark gray instead of white */
    text-decoration: none;
    cursor: pointer;
}

#chapter-list {
    .chapter-item {
        list-style-type: none;
        padding: 0;
        .acte-title {
            font-family: var(--font-title);
            font-size: clamp(26px, 1.67vw, 32px);
            color: #D3D3D3;
            line-height: 1;
            margin: 0;
            padding-block: 18px;
        }
        li {
            a {
                display: block;
                font-family: var(--font-title);
                font-size: clamp(18px, 1.25vw, 24px);
                color: #535352;
                padding-block: 13px;
                border-top: 1px solid #D3D3D3;
                &.current {
                    color: #1E1E1E;
                }
            }
            &:last-of-type {
                a {
                    border-bottom: 1px solid #D3D3D3;
                }
            }
        }
    }
}

/* Comments Section Styles */
#comments-section {
    position: absolute;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: rgba(245, 245, 245, 0.95);
    /* Light background */
    color: #333;
    /* Dark text */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    /* Lighter shadow */
}

#comments-section.comments-visible {
    right: 0;
    backdrop-filter: blur(10px);
}

#comments {
    padding-block: var(--inner-spacing);
}

#comments .comment-meta {
    margin-block-end: 0 !important;
}

#comments .children {
    margin-top: 20px !important;
    &::before {
        content: none !important;
    }
    .comment {
        border: none !important;
    }
}

#comments .reply a {
    display: block;
    margin-top: 10px;
    color: #0d0d0d;
    transition: color 350ms ease;
    -webkit-transition: color 350ms ease;
    &:hover {
        color: var(--clr-primary);
        transition: color 350ms ease;
        -webkit-transition: color 350ms ease;
    }
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.comments-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.says {
    display: none;
}

.comment-content {
    margin-top: 0 !important;
}

#comments .comment .comment-body {
    padding: 0 !important;
}

.comments-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

.comments-content::-webkit-scrollbar {
    width: 6px;
}

.comments-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.comments-area {
    max-width: 100%;
    color: #333;
    /* Dark text */
}

.comments-title {
    font-size: 16px;
    margin-bottom: 24px;
    color: rgba(0, 0, 0, 0.7);
    /* Dark text */
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment {
    &:not(:last-of-type) {
        padding-bottom: 15px;
        margin-bottom: 15px;
        border-bottom: 1px solid #D3D3D3;
    }
    .comment-meta {
        flex-wrap: wrap;
        .comment-awaiting-moderation {
            flex-basis: 100%;
            margin-bottom: 8px;
            line-height: 1.2;
        }
        .comment-author {
            flex-wrap: wrap;
            .fn {
                font-size: clamp(18px, 1.04vw, 20px);
                font-family: var(--font-title);
                line-height: 1;
            }
            .comment-date {
                font-size: clamp(14px, 1.04vw, 16px);
                line-height: 1;
                color: #909090;
                text-transform: capitalize;
            }
        }
    }
    .comment-body {
        flex-direction: row !important;
        border: none !important;
        .comment-avatar {
            flex-shrink: 0;
            .avatar {
                position: initial !important;
                margin-right: 20px !important;
            }
        }
        .comment-content {
            font-size: clamp(14px, 1.04vw, 16px);
            line-height: 1.2;
            color: #909090;
            p {
                margin-bottom: 0;
            }
        }
    }
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.comment-author .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: none;
}

.comment-author .fn a,  .comment-author b{
    color: #333;
    font-weight: bold;
    text-decoration: none;
}

.comment-metadata {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
    /* Medium gray */
    margin-left: 44px;
    margin-top: -8px;
    display: none !important;
}

.comment-content {
    margin-top: 12px;
    color: rgba(0, 0, 0, 0.8);
    /* Dark text */
    line-height: 1.5;
}

.comment-notes,
.logged-in-as,
.comment-form-cookies-consent {
    display: none !important;
}

.comment-reply-title {
    display: none !important;
}

.comments-title {
    display: none !important;
}

#chapter-list-modal {
    position: absolute;
    top: 0;
    left: -400px;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: rgba(245, 245, 245, 0.95);
    color: #333;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
}

#chapter-list-modal.visible {
    left: 0;
    backdrop-filter: blur(10px);
}

#chapter-list-modal .modal-content {
    margin: 0;
    width: 100%;
    border: none;
    border-radius: 0;
    background-color: #fff;
}

.sidebar {
    background-color: var(--clr-white) !important;
    --inner-spacing: 25px 18px;
    @media (max-width: 580px) {
        --inner-spacing: 16px 10px;
    }
}

.sidebar .sidebar-heading {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    padding: var(--inner-spacing);
    background-color: #D3D3D3;
    color: #535352;
}

.sidebar .sidebar-heading #close-comments {
    cursor: pointer;
}

.sidebar .sidebar-heading h3 {
    font-family: var(--font-title);
    font-size: clamp(26px, 1.67vw, 32px);
    margin: 0;
}

.sidebar .sidebar-heading .icon {
    float: none;
}

.sidebar .modal-content,
.sidebar .comments-content {
    padding: 0;
}

.sidebar .sidebar-body {
    padding-inline: var(--inner-spacing);
}

#commentform {
    display: flex;
    flex-direction: column;
    padding: var(--inner-spacing);
    background-color: #D3D3D3;

    .comment-form-comment {
        order: 1;
    }
    .form-submit {
        order: 2;
    }

    label,
    input,
    textarea {
        font-size: clamp(16px, 1.04vw, 20px);
        line-height: 1;
    }
    input,
    textarea {
        border: none;
        padding: 5px 10px;
    }
    textarea {
        max-height: clamp(50px, 6.15vw, 118px);
    }
    label {
        display: block;
        font-family: var(--font-title);
        margin-bottom: 6px;
    }
    p {
        margin-bottom: 15px;
    }
    .form-submit {
        margin-bottom: 0;
        input[type="submit"] {
            width: 100%;
            font-family: var(--font-title);
            color: var(--clr-white);
            background-color: #1F1F1F;
            border-radius: 0;
            border: none;
            padding-block: 10px;
        }
    }
}

@media only screen and (max-width: 1024px) {
    #viewer {
        /* #bottom-bar,
        #progress-bar-container {
            position: fixed;
            inset-inline: 0;
            width: 100dvw;
            bottom: 5px;
        } */
        #progress-bar-container {
            bottom: 0px;
        }
    }
}

@media screen and (max-width: 768px) {
    #viewer .comic-img-container {
        width: 100%;
        height: auto;
    }

    #comments-section {
        width: 100vw;
        /* Make it take the full width on small screens */
        right: -100vw;
        /* Hide it off-screen initially */
    }

    #comments-section.comments-visible {
        right: 0;
        /* Show it when active */
    }

    #bottom-bar {
        padding: 16px;
        height: auto;
        /* Ajuste la hauteur en fonction du contenu */
        display: flex;
        flex-wrap: wrap;
        /* Permet aux éléments de passer à la ligne si besoin */
        align-items: center;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        gap: 10px;
        /* Espacement entre les boutons */
    }

    /*#comments-button {
        display: none;
    }*/

    #more {
        position: fixed;
        top: 10px;
        left: 10px;
    }

    .button-chapter {
        font-size: 16px;
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 10px;
    }

    .button-chapter .material-icons,
    .button-chapter .icon-rounded {
        font-size: 20px;
        width: 40px;
        /* Taille fixe */
        height: 40px;
        /* Assure un cercle parfait */
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 50%;
        /* Assure un fond rond */
        transition: background 0.2s ease-in-out;
    }

    .button-chapter:hover .material-icons,
    .button-chapter:active .material-icons {
        background: rgba(0, 0, 0, 0.1);
    }
}

@media screen and (max-width: 636px) {
    #chapter-title {
        display: none;
    }
}

@media screen and (max-width: 580px) {
    .button-chapter {
        gap: 0;
        padding: 5px;
    }
    .button-chapter .material-icons,
    .button-chapter .icon-rounded {
        width: 30px;
        height: 30px;
    }
}

@media screen and (max-width: 1024px) and (orientation: landscape) {
    .left .chapter-info #chapter-title {
        font-size: clamp(12px, 1.25vw, 24px);
    }

    #bottom-bar {
        padding: 16px;
        height: auto;
        /* Ajuste la hauteur en fonction du contenu */
        display: flex;
        flex-wrap: wrap;
        /* Permet aux éléments de passer à la ligne si besoin */
        align-items: center;
        gap: 10px;
        /* Espacement entre les boutons */
    }

    .button-chapter {
        font-size: 16px;
        display: flex;
        align-items: center;
        gap: 0;
        padding: 0 6px;
    }

    .button-chapter .material-icons,
    .button-chapter .icon-rounded {
        font-size: 20px;
        width: 30px;
        /* Taille fixe */
        height: 30px;
        /* Assure un cercle parfait */
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 50%;
        /* Assure un fond rond */
        transition: background 0.2s ease-in-out;
    }
}

@media (max-width: 1200px) and (max-height: 600px) {
    #viewer {
        overflow: hidden;
        &:not(.fullscreen) {
            .comic-img-wrapper {
                height: calc(100vh - 85px);
                overflow: hidden;
            }
        }
        .comic-img-container {
            width: 100%;
            height: 100%;
            #comic-image {
                max-width: none;
                width: 100vw;
                height: calc(100vh - 85px);
            }
        }
        &.fullscreen {
            .comic-img-container {
                #comic-image {
                    height: 100vh;
                }
            }
            #bottom-bar-fullscreen {
                position: absolute;
                bottom: 0;
                .button-chapter {
                    display: none;
                }
                #fullscreen-exit {
                    display: block;
                    .icon-rounded {
                        background-color: transparent;
                        .icon {
                            --color: #000 !important;
                        }
                    }
                }
            }
            #progress-bar-container {
                position: absolute;
                bottom: 0;
            }
        }
    }
}

@media (max-width: 1024px) and (max-height: 600px) {
    #viewer {
        &:not(.fullscreen) {
            .comic-img-wrapper {
                height: calc(100vh - 65px);
                overflow: hidden;
            }
        }
        & .comic-img-container {
            max-height: none;
            #comic-image {
                height: calc(100vh - 65px);
                object-fit: cover;
            }
        }
    }
}