/* Base Styles */
body {
    margin: 0;
    padding: 0;
    top: 8vh;
}

/* Controls Layout */
.controls {
    display: flex;
    padding: 0.5rem;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 5px;
    position: sticky;
    top: 0;
    z-index: 1051;
    position: relative;
    justify-content: center;
    align-content: center;
}

#innerControlDivs {
    display: fixed;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Menu Bar */
.menu-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 2rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    height: auto;
}

/* Button Styles */
button {
    color: #ced4da;
    background-color: #007bff;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

    button:hover {
        background-color: #0056b3;
        transform: translateY(-2px);
    }

    button:active {
        background-color: #004085;
        transform: translateY(0);
    }

/* Input Fields */
input[type="text"],
input[type="number"] {
    border: 1px solid #ced4da;
    border-radius: 3px;
    padding: 5px;
    height: 28px;
    font-size: 13px;
}

.pnumber {
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px;
    display: block !important;
    visibility: visible !important;
    color: black;
    width: 40px;
    text-align: center;
}

/* Search Controls */
.search-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 5px 10px;
    background-color: #f9f9f9;
}

    .search-controls input[type="text"] {
        flex-grow: 1;
        min-width: 241px;
        height: 30px;
        padding: 2px 6px;
        font-size: 14px;
    }

/* Page Navigation */
.gotopage {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #f9f9f9;
    width: fit-content;
    margin: 0 auto;
}

    .gotopage input {
        height: 30px;
        width: 60px;
        padding: 2px 6px;
        font-size: 14px;
        text-align: center;
    }

/* PDF Display */
.pdf-page {
    display: block;
    margin: 0 auto;
    background-color: white;
}

#pdf-canvas {
    display: block;
    margin: 0 auto;
    background-color: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

/* Highlighting */
.highlight {
    background-color: rgba(255, 223, 107, 0.5);
    border-radius: 3px;
}

.current-highlight {
    background-color: rgba(255, 153, 51, 0.5);
}

/* Info Text */
.highlight-note-pdf p {
    text-align: right;
    margin-top: 5px;
    font-size: 0.7rem;
    color: #660000;
}

/* Utility Classes */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    font-size: 13px;
    border-radius: 4px;
    min-width: 30px;
    height: 30px;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

/* Icons */
.menu-bar i {
    font-size: 16px;
}

/* ---------------- MOBILE RESPONSIVE FIX ---------------- */

@media (max-width: 768px) {

    /* Layout container */
    .controls {
        padding: 6px;
        width: 100%;
        box-sizing: border-box;
    }

    #innerControlDivs {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    /* Menu bar: pagination row stays on one line */
    .menu-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        padding: 6px 8px;
        width: 100%;
        box-sizing: border-box;
        overflow: visible;
    }

    /* Hide unwanted items */
    .pg-label {
        display: none;
    }

    #print-button {
        display: none !important;
    }

    .zoom-control {
        display: none !important;
    }

    /* Page number */
    .pnumber {
        width: 45px;
        font-size: 14px;
        padding: 3px;
        text-align: center;
    }

    #total-pagescount {
        font-size: 14px;
    }

    /* Buttons compact */
    .btn {
        height: 28px;
        min-width: 28px;
        padding: 3px 6px;
        font-size: 12px;
    }

    /* -------- SEARCH BAR: full-width row below pagination -------- */
    .search-controls {
        width: 100%;
        box-sizing: border-box;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        padding: 4px 5px;
        gap: 3px;
        /* Break it onto its own row inside the flex menu-bar */
        flex-basis: 65%;
        order: 99;
        margin-top: 4px;
    }

        .search-controls input[type="text"] {
            flex: 1 1 0;
            min-width: 0;
            width: 0;
            max-width: 140px; /* hard cap so buttons are never pushed out */
            height: 28px;
            font-size: 12px;
            padding: 3px 5px;
            box-sizing: border-box;
        }

    /* Hide match count on small screens to save space */
    #match-count {
        display: none;
    }

    #prev-match,
    #next-match,
    #btn-close {
        flex-shrink: 0;
        min-width: 26px;
        width: 26px;
        height: 26px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Info text */
    .highlight-note-pdf p {
        font-size: 0.6rem;
        text-align: center;
    }

    /* -------- CANVAS: centered and scaled to fit screen -------- */
    #pdfCanvas,
    canvas {
        display: block !important;
        margin: 8px auto !important;
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        box-sizing: border-box;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .highlight-note-pdf {
        max-width: 70%;
        margin: 0 auto; /* centers horizontally */
        text-align: center; /* center-align text */
        word-wrap: break-word; /* ensure wrapping */
        overflow-wrap: break-word; /* modern wrapping support */
    }

        .highlight-note-pdf p {
            margin: 0;
        }

    /*#pagesContainer{
        margin-left:15%;
    }*/

    #document-name{
        max-width:80%;
        margin:10px auto;
    }
}

@media (max-width: 480px) {
    .controls {
        margin-left: 0;
        margin-right: 0;
        padding: 4px;
    }

    .menu-bar {
        padding: 6px;
    }

    input[type="text"],
    input[type="number"],
    .btn {
        font-size: 12px;
        height: 30px;
    }

    .search-controls {
        gap: 3px;
        padding: 4px;
    }

    #prev-match,
    #next-match,
    #btn-close {
        min-width: 24px;
        padding: 2px 4px;
    }
}

#document-name {
    font-size: 0.8rem;
    font-style: italic;
}
