/**
 * \file
 * \brief Main stylesheet for the default theme.
 */

* {
    margin: 0;
    padding: 0;
}

body
{   
    --background-color: #fff;
    
    background-color: var(--background-color);
    color: #000000;
    font: 100%/1.25 "Lucida Grande",Arial,sans-serif,STHeiti,"Arial Unicode MS",MingLiu;
}

/* Main container div for Lute site content. */
.container {
    width: 95%;
    margin: 0 auto;
    box-sizing: border-box;
}

 .lutelogo_small
 {
     margin-right: 2px;
     float: left;
     width: 50px;
     height: auto;
 }

.header {
    display: flex;
    align-items: center; /* Vertically center the items */
}

a.home-link {
    text-decoration: none;
    color: black !important;
}

a.home-link:hover {
    text-decoration: none !important; /* Remove underline on hover */
}

.lutelogo {
    width: auto; /* Reset the width to auto */
    height: 3em; /* Set the height to match the text's font size */
    margin-right: 10px;
}

.title-container {
    flex: 1; /* Allow the title to take up remaining space */
}

p.version {
    margin: 0px;
    font-size: 0.6em;
    font-style: italic;
}

/* Style for the menu bar */

.menu-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.7rem 0;
}

.title {
    font-size: 18px;
    font-weight: bold;
}

.menu {
    display: flex;
    justify-content: space-between;
    gap: 2.2rem;
}

.menu-item {
    position: relative; /* Required for sub-menu positioning */
}

/* main menu item text (not links) */
.menu-item > span {
    text-decoration: none;
    display: block;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    color: black !important;
}

.menu-item > a:hover {
    text-decoration: none;
}

.sub-menu {
    display: none;
    position: absolute;
    list-style-type: none;
    margin: 0;
    padding: 10px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border: 1px solid #ccc;
}

.last-sub-menu {
    right: 0; /* Align the right edge of the sub-menu with the right edge of its container */
}

.sub-menu li {
    margin: 10px 0;
    white-space: nowrap;
}

.menu-item:hover .sub-menu {
    display: block;
}

/* end menu bar. */

/* Book listing */

div#divbooktable {
    width: 70% !important;
    display: table;
    margin-right: auto;
    margin-left: auto;
}

/* blank space to hang completed_book bullets while maintaining proper justification on the whole column */
a.book-title:before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: baseline;
    margin-right: 8px;
}

/* show a check mark for completed books */
a.completed_book:before {
    content: url('/static/icn/tick.png');
}

/**
  *  when the books list contains NO completed books, get rid of the awkward indent
  */
table#booktable:not(:has(a.completed_book)) a.book-title:before {
    display: none;
}

/* End book listing */

/* Term listing CSV export. */
button.buttons-csv {
    padding: 3px !important;
    margin: 5px 0 0 10px !important;
}


.flash-notice {
    margin: 20px;
    padding: 20px;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.flash-notice-narrow {
    margin-top: 2px;
    padding: 2px;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.small-flash-notice {
    margin-top: 3px;
    padding: 3px;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

/* Screen layouts - two columns ************************/

div#term_form_left {
    width: 50%;
}

div#term_form_right {
    width: 50%;
    position: fixed;
    top: 120px;
    right: 0;
    height: 95%;
}

div#read_pane_left {
    width: 50%;
}

div#read_pane_right {
    display: grid;
    grid-template-rows: 18rem 1fr;
    position: static;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    position: fixed;
    /* different width and right values because #container width=95% */
    right: var(--read-grid-margin);
    width: calc(50% - var(--read-grid-margin));
    height: 100%;
    top: 0;
}

.read-pane-right-close-btn {
    display: none;
}

.reading_header_container {
    display: grid;
    grid-template-columns: min-content 1fr;
    gap: 2rem;
    justify-items: center;
    align-items: center;
    padding: 1.5rem 2.2rem 0 2.2rem;
}

.reading_header_mid {
    width: 100%;
}

.reading_header_page {
    justify-self: end;
}

#reading-header {
    background-color: var(--background-color);
    /* padding: 0 1.5rem 1.5rem 1.5rem; */
    margin-bottom: 2rem;
}

#page_indicator {
    font-weight: 500;
    font-size: 0.9rem;
}

.reading_header_mid_top {
    display: grid;
    grid-template-columns: auto 1fr;
    /* display: flex;
    justify-content: space-between; */
    margin: 0 1.6rem;
    margin-bottom: 0.2rem;
    gap: 0.9rem;
    align-items: end;
}
    
/* End layouts *****************************************/

/* Reader slide-in hamburger menu. *********************/

/* The hamburger slices. */
span.hamburger {
  width: 20px;
  height: 4px;
  /* margin-bottom: 3px; */
  background: #777;
  border-radius: 3px;
  display: block;
}

.hamburger-btn {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    border: 1px solid #bcbcbc;
    border-radius: 6.9px;
    padding: 0.5rem;
    box-sizing: border-box;
    cursor: pointer;
}

#reading_menu.open-menu {
  transform: translateX(0);
}

#reading_menu {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
    
  padding: 0;
  margin: 0;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1004; /* higher than audio, header and right_pane (for mobile view) */
  height: 100vh;
  border-right: 4px solid #a9cfef;
  box-shadow: 1px 0 3px 2px #9393933d;
  box-sizing: border-box;
  background-color: var(--background-color);

  transform-origin: 0% 0%;
  transform: translate(-100%, 0);
  transition: transform 0.3s cubic-bezier(0.77,0.2,0.05,1.0);
}

#reading_menu ul {
  margin: 0;
  list-style: none;
  padding: 0 1.6rem 0 1rem;
}

#reading_menu li a {
  display: flex;
  align-items: center;
  gap: 0.4rem;

  color: inherit;
  box-sizing: border-box;
  text-decoration: none;
}

#reading_menu .menu-list-item-text {
  padding: 0.5rem 0.6rem;
  border-radius: 5px;
}

#reading_menu .menu-list-item-text:hover,
.close-btn:hover,
.text-options-button:hover {
    background-color: #d5e9fa;
    cursor: pointer;
}

.menu-icon{
  width: 18px;
  height: 18px;
}

.close-btn {
  background-image: url("/static/icn/close.svg");
  background-position: center;
  background-repeat: no-repeat;
  width: 20px;
  height: 20px;
  padding: 0.9rem;
  border-radius: 5px;
  border: none;
  background-size: 42.4%;
  background-color: transparent;
  cursor: pointer;
}

.reading-menu-close-btn {
  margin-left: 5.4rem;
}

#reading_menu .text-options-container {
  display: grid;
  grid-template-columns: max-content max-content;
  justify-content: center;
  gap: 0.2rem;
  padding: 0;
  margin-bottom: 1rem;
}

.text-options-btn-container {
  /* background-color: #d3ebffc9; */
  padding: 0.2rem;
  border-radius: 5px;
}

.reading_header_left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reading_menu_logo_container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
  background-color: aliceblue;
  padding: 0.9rem 1.5rem;
}
/* End reader slide-in hamburger menu. *********************/

.read_page_nav {
    display: block;
    font-size: 1.2rem;
    line-height: 1; /* higher value adds unnecessary height */
    cursor: pointer;
    user-select: none;
    color: var(--read-slider-color);
}

.read_page_disabled {
    color: lightgrey;
    cursor: default;
}

div#reading-footer span {
    margin: 5px;
}

.texttitlecontainer {
    overflow: hidden;
    white-space: nowrap;
}

#headertexttitle {
    font-size: 0.9rem;
    font-weight: normal;
    margin: 0;
}

#thetexttitle {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

#thetexttitle,
div#thetext {
    padding: 0 2.2rem;
    padding: 0 2.2rem;
}

div#thetext p {
    line-height: 1.25;
    margin-top: 1em;
    margin-bottom: 1em;
    font-size: 0;
}

.nomarginblock {
    margin-block-start: 0px;
    margin-block-end: 0px;
}

p
{
    margin: 5px 0 5px 0;
    padding: 0;
}

h1 {
    margin: 1rem 0;
}

h2 {
    margin: 0.8rem 0;
}

h3
{
    margin: 0px 0 0px 0;
    padding: 0;
}

h4
{
    margin: 5px 0 10px 0;
    padding: 0;
}

span.flashtextcopy {
    background-color: yellow !important;
}

span.status0
{
    background-color: #D5FFFF;
    color: #000000;
}

span.status1
{
    background-color: #F5B8A9;
    color: #000000;
}

span.status2
{
    background-color: #F5CCA9;
    color: #000000;
}

span.status3
{
    background-color: #F5E1A9;
    color: #000000;
}

span.status4
{
    background-color: #F5F3A9;
    color: #000000;
}

span.status5
{
    background-color: #DDFFDD;
    color: #000000;
}

/* span.status99, span.status98 have no styles, just regular text. */

span.hasflash:after {
    content: "*";
    color: black;
}

span.overlapped:before {
    content: "\207A";
    color: black;
}

span.textsentence {
     /* The weird "font-size: 0%" prevents excess space between the spans! */
     /* span.textitem then re-sets the font size for the words. */
    font-size: 0%;
}

/** A word shown in the reading pane. */
span.textitem
{
    font-size: 16px;
    color: #000000;
    display:inline-block;

    /* disallow select, only allow mouse-down-drag-up to define multiword
   terms. */
    user-select: none;

    /* Add a transparent border so that when the .wordhover or .kwordmarked
   style is added, things don't get pushed around. */
    border-bottom: 1px solid transparent;
}

.click
{
    cursor: pointer;
    color: #C00000;
}

.hide
{
    display: none;
}

a {
    text-decoration: none;
    color: #0000FF;
}

a:link {
    color: #0000EE;
}

a:visited {
    color: #0000EE;
}

a:hover {
    color: #C00000;
    text-decoration: underline;
}

a:focus {
    color: #C00000;
}

a:active {
    color: #C00000;
}
 
 
img
{
    border: 0pt none;
}

.uwordmarked
{
    font-weight: bold;
    border-top: 3px solid red;
    border-bottom: 3px solid red;
    border-right: 3px solid red;
    border-left: 3px solid red;
}

.wordhover
{
    border-bottom: 1px solid blue !important;
}

.kwordmarked
{
    border-bottom: 1px solid red !important;
}

.newmultiterm
{
    background: yellow !important;
}

#termtags
{
    width: 340px;
    margin-top: 0px;
    margin-bottom: 0px;
    margin-left: 2px;
}

#texttags
{
    width: 340px;
    margin-top: 0px;
    margin-bottom: 0px;
    margin-left: 2px;
}

.nowrap
{
    white-space: nowrap;
    margin-left: 20pt;
}

/* Widening the tooltip. */
div.ui-tooltip {
    max-width: 400px !important;
    z-index: 1000; /*higher than audio because of words on the bottom, but lower than header and side menu */
}

.tooltip-image {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
}

ul.sentencelist {
    margin-block-start: 3px;
}

.termpopup-tag {
    background-color: #e7e7e7;
    color: black;
    padding: 0 1px 0 1px;
    border: 1px solid darkgrey;
}

/* error handler */

div.bug_report {
    margin: 20px;
    padding: 5px;
    border: 1px solid grey;
}

div.code {
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.5;
    padding: 20px;
    background-color: #f8f9fa;
}

div.code pre {
    white-space: pre-wrap;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    overflow: auto;
    max-height: 500px;
    font-size: 14px;
    color: #212529;
}


/********************************
 * Type controls menu
 */

.text-options-button {
    width: 36px;
    height: 36px;
    border-radius: 5px;
    border: 2px solid #d5e9fa;
    background-color: white;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    cursor: pointer;
}

.font-plus {
    background-image: url("/static/icn/font-increase.svg");
}

.font-minus {
    background-image: url("/static/icn/font-decrease.svg");
}

.lh-plus {
    background-image: url("/static/icn/line-spacing-increase.svg");
}

.lh-minus {
    background-image: url("/static/icn/line-spacing-decrease.svg");
}

.width-plus {
    background-image: url("/static/icn/caret-right.svg");
}

.width-minus {
    background-image: url("/static/icn/caret-left.svg");
}

.column-one {
    background-image: url("/static/icn/text-column-one.svg");
}

.column-two {
    background-image: url("/static/icn/text-column-two.svg");
}

/*********************************
 * read page layout
 */

#read_pane_container {
    --read-grid-margin: 0; /*(100 - 95) / 2 -> do not use calc here. does not work*/
    width: 100%;
}

#wordframeid {
    height: 100% !important;
}

#dictframeid {
    /* calc for crawlbar */
    /* height: calc(100% - 20px) !important; */
    height: 100% !important;
    align-self: end;
}

/* resize */

/* border */
#read_pane_right::after {
    content: '';
    background-color: #dbefff;
    position: absolute;
    left: 0;
    top: 0;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    cursor: col-resize;
}

/* border */
.dictframecontainer::after {
    content: '';
    background-color: #dbefff;
    /* background-image: linear-gradient(to right, #dbefff 50%, #dbefff 50%); */
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    width: 100%;
    cursor: row-resize;
}

.dictframecontainer {
    position: relative;
    /* overflow: hidden; contents overflow (over audio player) if height is too small */
    /* there's no much point in hiding it. because after first term save it doesn't get hidden again anyway */
    /* disabling it for now. */
    /*opacity: 0; to hide the after element. easier this way */
}


/* read slider */
#read-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 1rem;
    margin: 0;
    background-color: #d7d7d7;
    border-radius: 3px;
    box-sizing: border-box;
    background-size: 0% 100%;
    background-image: linear-gradient(var(--read-slider-color), var(--read-slider-color));
    background-repeat: no-repeat;
}

#read-slider::-moz-range-thumb {
    width: 30px;
    height: 1rem;
    border: 2px solid var(--read-slider-color);
    background-size: 80%;
    border-radius: 5px;
    background-color: #fff;
    background-size: 60%;
  
    background-position: center;
    background-repeat: no-repeat;
    padding: 0;
    box-sizing: border-box;
}

#read-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 30px;
    height: 1rem;
    border: 2px solid var(--read-slider-color);
    background-size: 80%;
    border-radius: 5px;
    background-color: #fff;
    background-size: 60%;
  
    background-position: center;
    background-repeat: no-repeat;

    padding: 0;
    box-sizing: border-box;
}

#read-slider.read_page_disabled::-moz-range-thumb {
    border: 2px solid #d7d7d7;
}

#read-slider.read_page_disabled::-webkit-slider-thumb {
    border: 2px solid #d7d7d7;
}

#read-slider::-webkit-slider-runnable-track {
  -webkit-appearance: none;
  box-shadow: none;
  border: none;
}

#read-slider::-moz-range-track {
  box-shadow: none;
  border: none;
}

.read-slide-container {
    display: flex;
    align-items: center;
    gap: 0.4rem;

    --read-slider-color: #79b7e7;
}


/* STYLES FOR PAGE BOOKMARKS */
.read-bkm-btn {
    font-size: 1.6rem;
    color: var(--read-slider-color);
}

.read-bkm-btn {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border: none;
    padding: 0;
    border-radius: 50%;
  
    background-color: white;
    cursor: pointer;
    user-select: none;
    --webkit-user-select: none;

    display: none; /*temporarily*/
}

/* .read-bookmark-buttons-container { */
    /* display: grid; */
    /* grid-template-columns: min-content min-content; */
    /* gap: 0.4rem; */
/* } */

/* #read-bkm-save-btn {
    background-image: url("/static/icn/bookmark-off.svg");
    height: 28px;
    width: 28px;

    border-radius: unset;
    background-size: 67%;
    background-color: transparent;
} */
  
/* #read-bkm-prev-btn {
    background-image: url("/static/icn/prev.svg");
    height: 28px;
    width: 28px;
}
  
#read-bkm-next-btn {
    background-image: url("/static/icn/next.svg");
    height: 28px;
    width: 28px;
} */

/* .read-bookmark-jump-container {
    display: flex;
    align-items: center;
    gap: 0.3rem;
} */

/* .read-bookmark-buttons-container {
    display: flex;
} */


/* COMMON FORM STYLES */
#text,
#translation,
#romanization,
#book #title, 
#book #source_uri,
#backup_dir, 
#mecab_path, 
#custom_styles,
#language input {
    /* width: 100%; */
    font-size: 0.9rem;
    font-family: inherit;
    padding: 0.2rem 0.2rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
}


/* GENERAL FORM STYLES */
textarea {
    width: 100%;
    resize: vertical;
}

ul.shorttaglist {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem;
    padding: 0;
}

::placeholder {
    font-family: inherit;
}

.btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.7rem;
}

/* TABLE STYLES */
th, td {
    padding: 2px;
}

tbody {
    vertical-align: top;
}

table input:not([type="checkbox"]) {
    width: 100%;
}

.statsWordsRead th, 
.statsWordsRead td { 
    padding: 5px; 
}

#book,
#termimport,
#language,
.settingstable {
    width: 80%;
}

#edit-page-table {
    width: 50%;
}

#edit-page-table textarea {
    height: 18rem;
}

#termimport td:first-child,
.settingstable td:first-child {
    width: 20rem;
}

#book td:first-child,
#language td:first-child {
    width: 15rem;
}

#predefined-lang-container {
    margin-left: 0.3rem;
    margin-bottom: 0.4rem;
}

#predefined {
    margin-left: 5.3rem;
}

.smallfilename {
    font-size: 0.8em;
    font-style: italic;
}

div.help-text {
    font-size: 0.8em;
    font-style: italic;
    color: gray !important;
}


/* TERM FORM STYLES */
#term-form-container {
    padding: 1.5rem;
    padding-bottom: 1rem;
}

#translation-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 0.6rem;
}

#romanization {
    width: 100%;
}

#translation {
    height: 50px;
    min-height: 50px;
}

#term {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

#term-form #text {
    flex: 1;
}

#def-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.term-element-box {
    display: flex;
    gap: 0.5rem;
}

#status {
    display: flex;
    list-style: none;
    gap: 0.8rem;
}

#term-button-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#term-button-container .term-element-box {
    gap: 0.2rem;
}

.zoomableTermImage {
    transition: transform 0.2s; /* Animation */
    border-radius: 3px;
    border: 1px solid #ddd;
    box-sizing: border-box;
    width: 40px;
    display: none;
}

.zoomableTermImage:hover {
    transform: scale(4) translate(-17px, 5px);
}


/* SETTINGS TABLE */
#custom_styles {
    height: 100px;
    font-size: 1rem;
    font-family: 'Courier New', Courier, monospace;
}

#current_theme, 
#japanese_reading, 
#backup_count, 
#test_mecab_btn {
    width: 8rem;
    box-sizing: border-box;
}


/* CREATE BOOK TABLE */
#book #text {
    height: 420px;
}


@media screen and (max-width: 980px) {

    #thetexttitle,
    div#thetext {
        padding: 0 3.2rem;
        padding: 0 3.2rem;
    }

    #reading_menu li a {
        font-size: 1.6rem;
        gap: 0.9rem;
    }

    .reading_menu_logo_container {
        margin-bottom: 2.2rem;
    }

    .menu-icon {
        width: 2rem;
        height: 2rem;
    }

    .text-options-button {
        width: 3rem;
        height: 3rem;
    }

    .text-options-btn-container:nth-child(3),
    .text-options-btn-container:nth-child(4) {
        display: none;
    }

    .text-options-container {
        gap: 0.3rem !important;
        grid-template-columns: max-content max-content !important;
    }

    .close-btn {
        padding: 1.3rem;
    }

    .read-pane-right-close-btn {
        position: absolute;
        left: 0;
        top: 0;
        width: 50px;
        transform: translateY(-100%);
        background-image: url("/static/icn/close-white.svg");
        background-color: #79b7e7;
        border-top-left-radius: 0;
        
        display: block;
    }

    .read-pane-right-close-btn:hover {
        background-color: #79b7e7;
    }

    #reading-header {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        background: var(--background-color);
        height: 7.5rem;
        z-index: 1001;
        box-shadow: 0 0 12px 0 #dfdfdf;
    }

    div.ui-tooltip {
        z-index: 1002;
    }

    #read_pane_left {
        width: unset !important;
        margin-top: 10rem;
    }

    .reading_header_container {
        padding-right: 3.2em;
        padding-left: 3.2em;
        align-items: end;
    }

    .reading_header_left {
        align-items: flex-end;
    }

    div#read_pane_right {
        background-color: white;
        z-index: 1003;
        transform: translateY(100%);
        /* transition: all creates issues for drag resizing (laggy, slow)*/
        transition: transform 0.2s cubic-bezier(0.77,0.2,0.05,1.0), 
                    opacity 0.2s cubic-bezier(0.77,0.2,0.05,1.0);
        width: 100% !important;
        height: 100vh !important; /* unset height set when player is sticky */
        bottom: 0;
        left: 0;
        opacity: 0;
    }

    #read_pane_right::after {
        content: '';
        background-color: #79b7e7;
        position: absolute;
        left: 0;
        top: 0;
        transform: translateY(-50%);
        width: 100%;
        height: 6px;
        cursor: row-resize;
    }

    /*drag button*/
    #read_pane_right::before {
        content: '';
        background-color: #79b7e7;
        position: absolute;
        right: 0;
        top: 0;
        transform: translateY(-100%);
        width: 50px;
        height: 42px;
        cursor: row-resize;
        border-top-left-radius: 5px;
        background-image: url("/static/icn/drag-handle.svg");
        background-position: center;
        background-repeat: no-repeat;
        background-size: 91%;
    }

    .dictframecontainer::after {
        background-color: #79b7e7;
        height: 6px;
    }

    #read-slider {
        height: 1.7rem;
    }

    #read-slider::-moz-range-thumb {
        width: 2.2rem;
        height: 2rem;
    }

    #read-slider::-webkit-slider-thumb {
        width: 2.2rem;
        height: 2rem;
    }

    .reading_header_mid_top {
        margin-left: 2.3rem;
        margin-right: 2.3rem;
    }

    .read_page_nav {
        font-size: 2.2rem;
    }

    #page_indicator,
    #headertexttitle {
        font-size: 1.1rem;
    }

    span.hamburger {
        width: 24px;
        height: 5px;
    }

    .lutelogo_small {
        width: 70px;
    }

    #booktable td:nth-child(2),
    #booktable th:nth-child(2),
    #booktable td:nth-child(3),
    #booktable th:nth-child(3) {
        display: none;
    }

    table#term {
        width: 100% !important;
    }
}
