/* ===========================
   Reset & Base Styles
   =========================== */
* {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    box-sizing: border-box;
}

/* HTML5 display reset */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}

body {
    line-height: 1;
    background-color: #f0f0f0;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

ol, ul {
    list-style: none;
}

blockquote, q {
    quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
    content: '';
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

a {
    text-decoration: none;
    color: inherit;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===========================
   Book Container
   =========================== */
#book-container {
    position: absolute;
    top: 47%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.3s ease;
    max-width: 100%;
    max-height: calc(100vh - 80px);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===========================
   Flipbook
   =========================== */
#flipbook {
    width: 100%;
    height: 100%;
    cursor: grab;
}
#flipbook .turn-page-wrapper{
    position: relative;
}
/* #flipbook .turn-page-wrapper:before{
    content: "";
    width: 0px;
    height: 100%;
    transform: translate(0,-50%);
    box-shadow: rgba(0, 0, 0, .2) 0 0 5px 3px;
    position: absolute;
    top: 50%;
    left: 0;
    z-index: 2;
}
#flipbook .turn-page-wrapper::after{
    content: "";
    width: 0px;
    height: 100%;
    transform: translate(0,-50%);
    box-shadow: rgba(0, 0, 0, .2) 0 0 5px 3px;
    position: absolute;
    top: 50%;
    right: 0;
    z-index: 2;
} */
 .page-nav-arrow.left div{
        mix-blend-mode: multiply;
opacity: 0.5;
    border-top: 2px solid rgb(51, 51, 51)!important;
    border-left: 2px solid rgb(51, 51, 51)!important;
 }
  .page-nav-arrow.right div{
    mix-blend-mode: multiply;
opacity: 0.5;
        border-top: 2px solid rgb(51, 51, 51)!important;
    border-right: 2px solid rgb(51, 51, 51)!important;
 }
#flipbook.grabbing {
    cursor: grabbing;
}

#flipbook .page,
#flipbook .hard {
    background-color: none;
    color: white;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

#flipbook .hard {
    font-size: 24px;
}

/* Prevent text selection */
#flipbook,
#flipbook .page,
#flipbook .hard,
#flipbook img {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* ===========================
   Drawing Canvas
   =========================== */
#drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 800px;
    height: 600px;
    pointer-events: none;
    z-index: 10;
}

body.drawing-active #drawing-canvas {
    pointer-events: all;
    cursor: crosshair;
}

body.drawing-active #toggle-draw-mode {
    background-color: #ff5722;
}

body.drawing-active #toggle-draw-mode:hover {
    background-color: #e64a19;
}

/* ===========================
   Controls Panel
   =========================== */
.controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 100;
    padding: 0 0 10px;
    height: 60px;
    background: #ffffff;
}

.controls:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(to top, #000000 0%, #212121 13%, #ffffff 100%);
    opacity: 0.15;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.controls button {
    border: none;
    cursor: pointer;
    background: none;
    width: 24px;
    padding: 0;
    min-width: unset;
    min-height: unset;
}

.controls-inner {
    width: 75%;
    max-width: 950px;
    margin: 0 auto;
    position: relative;
    height: auto;
    padding-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls-inner02 {
    width: 57.6%;
    margin-left: auto;
    position: relative;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Button Groups */
.btn-box01 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 43.9%;
    height: auto;
}

.btn-box02 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 12.3%;
    margin-right: 9%;
    height: auto;
}

.btn-box03 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 24.6%;
    margin-right: 11%;
    height: auto;
}

.btn-box04 {
    width: 5.2%;
    margin-right: 17.3%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-box04 #toc-btn {
    margin-right: 10px;
}

/* Special cursors */
/* #pen, #sticky {
    cursor: none;
} */

#pdf-btn {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
    width: 24px;
    padding: 0;
    min-width: unset;
    min-height: unset;
}

/* ===========================
   Progress Bar
   =========================== */
.progress-container {
    width: 100%;
    position: absolute;
    top: 0;
}

.progress-bar {
    width: 100%;
    height: 1px;
    background-color: #5C5A5A;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-circle {
    width: 7px;
    height: 7px;
    background-color: #5C5A5A;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: left 0.5s ease;
    border: 2px solid #FFFFFF;
    box-sizing: content-box;
}

/* ===========================
   Page Counter
   =========================== */
.page-counter {
    display: flex;
    text-align: center;
    margin-bottom: 5px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #4d4d4d;
}

.page-counter p {
    text-align: center;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #4d4d4d;
    padding: 5px 0;
}

.page-counter .current-box {
    text-align: center;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #4d4d4d;
    margin-left: 5px;
    background: #fff;
    padding: 5px 20px;
    border-radius: 20px;
    display: block;
}

/* ===========================
   Modals
   =========================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
}

.modal-content {
        background-color: #f6f6f6;
    margin-right: auto;
    position: absolute;
    padding: 1.4% 0 1.4% 1.4%;
    width: 80%;
    height: calc(100% - 60px);
    bottom: 60px;
    max-width: 350px;
    overflow-x: scroll;
}

.modal-content h2,
.toc-title {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #4d4d4d;
    border: none;
    padding-bottom: 25px;
}

.toc-title {
    padding-bottom: 8px;
}

.modal-content h3 {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    color: #4d4d4d;
    border: none;
    padding-bottom: 0px;
    margin-right: 10px;
    transition: 0.3s all ease;
}
.modal-content h3:hover{
    opacity: 0.7;
}
.close-btn {
    position: absolute;
    right: 4%;
    top: 2%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    width: 24px;
    height: 24px;
    color: #fff;
    background: #5C5A5A;
    text-align: center;
    border-radius: 49px;
}

.close-btn:hover {
    opacity: 0.8;
}

/* ===========================
   Table of Contents
   =========================== */
.toc-item {
    position: relative;
    padding: 8px 0 8px 0.8em;;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;

    color: #4d4d4d;
}

.toc-item::after {
    font-family: "roboto";
    font-size: 13px;
    font-weight: 400;
    content: var(--page-number, "");
    display: block;
    padding-right: 18px;
}

/* ===========================
   Thumbnails
   =========================== */
#thumbnails-modal .modal-content {
    padding: 2.4% 2.4% 2.4% 2.4%;
    box-sizing: border-box;
}

.thumbnails {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
}

.thumbnail-box {
    width: 90%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

    .thumbnail:first-child{
        margin-right: -1px;
    }
.thumbnail {
    width: 48%;
    background-color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #999;
}

.thumbnail:hover {
    border-color: #4CAF50;
}

.page-title {
    width: 100%;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #4d4d4d;
    text-align: center;
    padding-top: 10px;
}

/* ===========================
   Page Jump
   =========================== */
.page-jump {
    text-align: center;
    margin-top: 20px;
}

.page-jump input {
    width: 60px;
    padding: 5px;
    text-align: center;
}

/* ===========================
   Download Link
   =========================== */
.donwload_link {
    background: #5C5A5A;
    width: 80%;
    text-align: center;
    color: #ffffff;
    font-family: "Noto Sans JP";
    font-size: 14px;
    padding: 5px;
    border-radius: 8px;
    display: block;
    margin: 40px auto;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 1024px) {
    .controls-inner {
        width: 90%;
        flex-wrap: wrap;
    }
    
    .controls-inner02 {
        width: 100%;
        margin-left: 0;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn-box01,
    .btn-box02,
    .btn-box03,
    .btn-box04 {
        width: auto;
        margin: 5px;
    }
}

@media (max-width: 840px) {
    #book-container {
        width: 95%;
        height: 500px;
    }
    
    #drawing-canvas {
        width: 95%;
        height: 500px;
    }
    
    .controls button {
        padding: 6px 8px;
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .modal-content {
        width: 90%;
        margin: 15% auto;
    }
}

@media (max-width: 768px) {
        .modal-content {
        width: 100%;
        max-width: none;
        margin: 0;
        left: 0;
        right: 0;
        padding: 20px;
        height: calc(100% - 60px);
        bottom: 60px;
    }
    
    /* サイドバーオープン時の調整をスマホでは無効化 */
    body.sidebar-open #book-container {
        left: 50%;
        max-width: 100%;
    }
    .controls {
        height: auto;
        padding-bottom: 10px;
    }
    
    .controls-inner {
        padding-top: 10px;
        flex-direction: column;
    }
    
    .controls-inner02 {
        width: 100%;
        margin-left: auto;
        position: relative;
        height: auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-box01,
    .page-counter,
    .current-box {
        display: none !important;
    }
    .btn-box04{
        position: absolute;
        left: 0;
        top: 3px;
        z-index: 2;
    }
    .btn-box02 {
        position: absolute;
        right: 2%;
        width: 20%;
        margin: 0;
    }
    
    .btn-box03 {
        width: 41.6%;
        margin: 0 auto;
    }
    
    .controls button {
        padding: 0;
        width: 24px !important;
        min-width: unset;
        min-height: unset;
    }
        .thumbnail-box{
        width: 100%;
        margin-bottom: 30px;
    }
}

@media (max-width: 480px) {

    .modal-content {
        width: 100%;
        max-width: none;
        height: calc(100% - 60px);
        bottom: 60px;
        top: auto;
        left: 0;
        right: 0;
        margin: 0;
        padding: 20px;
    }
    
    .btn-box01,
    .btn-box02,
    .btn-box03 {
        justify-content: center;
    }
    
    .controls {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding: 5px 0;
    }
    
    .controls button {
        margin: 4px;
        font-size: 11px;
    }
}
/* ===========================
   Book Container
   =========================== */
#book-container {
    position: absolute;
    top: 47%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    max-width: 100%;
    max-height: calc(100vh - 80px);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Book container when sidebar is open */
body.sidebar-open #book-container {
    left: calc(50% + 175px); /* Half of modal width */
    max-width: calc(100% - 370px); /* Account for sidebar width + margin */
}
