/* -------------------------
   ROOT COLOR VARIABLES 
--------------------------*/

:root {
    --ink-black: #1a1a1a;
    --ink-gray:#4a4a4a;
    --light-ink: #666666;
    --light-ink-glass: #d9d6d666;
    --light-ink-glass-fixed: #d9d6d666;
    --white:#eaeded;
    --ultra-white:#fcfcfc;
    --paper: #f8f5f0;
    --paper-gray: #e9f2f0;
    --red-seal: #d4380d;
    --orange: #f37042;
    --yellow: #FFCC33;
    --red-seal-alpha: #d4380daa;
    --pink: #FFD1DF;
    --qing:#09866C;
    --green:#00A86B;
    --blue:#00386A;
    --light-beige:#fefae0;
    --light-green:#d8e5c9;
    --turquoise:#40E0D0;
    --font-family: -apple-system, BlinkMacSystemFont,
                    "Segoe UI", Roboto, "Helvetica Neue", Arial,
                    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
                    sans-serif;
    --font-family-cn: "PingFang SC", "Microsoft YaHei", "SimHei", sans-serif;

    --field-input: #42484459;

    --background-color: var(--paper);
    --page-background-color: transparent;

    --text-color: var(--ink-black);
    --text-black: var(--ink-black);
    --text-gray:var(--ink-gray);
    --text-light:var(--light-ink);

    --a-color:var(--ink-black);
    --a-hover-color: var(--red-seal);
    
    --button-background-color: transparent;
    --button-color: var(--ink-black);
    --button-background-hover-color: transparent;
    --button-hover: var(--red-seal);
    --button-border: var(--ink-gray);
    

    --input-border:var(--light-ink);
    --input-border-hover:var(--ink-gray);

    --sidebar-color: var(--ink-black);
    --sidebar-a-color: var(--paper);
    --sidebar-a-hover-color: var(--red-seal);
    --sidebar-a-hover-background-color: transparent;

    --top-menu-color: var(--white);
    --top-menu-background-color: var(--ink-black);
    --top-menu-hover-background-color: var(--red-seal);

    --tool-box-border-color:var(--ink-gray);

    --profile-text-gray: var(--ink-gray);
    --profile-avatar-border:var(--ink-gray);
    --profile-avatar-overlay: rgba(0,0,0,0.6);

    --notification-color:var(--white);
    --notification-background-color:rgba(0,0,0,0.1);

    --floating-message-background:var(--ink-gray);
    --floating-message-text:var(--white);
    --floating-message-box-shadow:rgba(0,0,0,0.3);
    --floating-message-success:var(--ink-gray);
    --floating-message-error:var(--red-seal);

    --desktop-nav-width:200px;
    --desktop-nav-width-100:-100px;

    --mobile-nav-height:60px;
    --mobile-nav-height-more:80px;

    --word-active-background:#f9f9f9;
    --word-analysis-background:#ededed;

    --pop-window-background:var(--white);
    --text-light-background: #d1d1d11a;

    --font-size: medium;
}
/* -------------------------
   GLOBAL 
--------------------------*/
body {
    font-family: var(--font-family);
    font-size: var(--font-size);
    background-color: var(--background-color);
    margin: 0;
    scrollbar-gutter: stable;
}

.content {
    margin-left: 200px; /* desktop sidebar space */
    color: var(--text-black);
}

/* Remove blue highlight on mobile */
* {
    -webkit-tap-highlight-color: transparent;
}

/* =========================
   DESKTOP SIDEBAR
========================= */
.desktop-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--desktop-nav-width);
    height: 100vh;
    background-color: var(--sidebar-color);
    display: flex;
    flex-direction: column;
    padding: 20px 0px 50px 0px;
    z-index: 10;
}

.logout-link button{
    all:unset;
    width: 100%;
    border: none;
    background-color: none;
    color: var( --sidebar-a-color);
    font-weight: lighter;
}

.logout-link button:hover {
    color: var( --sidebar-a-hover-color);
    font-weight:normal;
}

.login-link{
    color: var( --sidebar-a-color);
    text-decoration: none;
    font-size: 16px;
    font-weight: lighter;
}

.login-link:hover {
    color: var( --sidebar-a-hover-color);
    font-weight: normal;
}

.sidebar-user {
    margin-top: auto; /* pushes it to the bottom */
    padding: 60px 20px;
    text-align: center;
    color: var(--content);
    font-weight: lighter;
}

.sidebar-logo {
    width: 60%;
    margin: 20px auto;
    display: block;
}

.sidebar-links a,
.sidebar-links button {
    display: flex;
    align-items: center;
    width: 90%;
    padding: 12px;
    margin: 4px 0;
    background: transparent;
    color: var(--sidebar-a-color);
    font-weight: bold;
    text-align: left;
    border: none;
    text-decoration: none;
    cursor: pointer;
}

.sidebar-links a:hover,
.sidebar-links button:hover {
    background-color: var(--sidebar-a-hover-background-color);
    color: var(--sidebar-a-hover-color);
}

/* Desktop sidebar icons */
.desktop-nav .icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    filter: brightness(0) invert(0.99); /* light */
}

.desktop-nav a.active{
    color: var(--red-seal);
}

.mobile-nav {
    /* border-top: solid 1px var(--paper); */
    margin-left: 0px;
    position: fixed;
    bottom: 0;
    height: var(--mobile-nav-height);
    background-color: var(--top-menu-background-color);
    align-items: center;
    justify-content: space-around;
    padding: 0 0px;
    z-index: 1000;
    display: flex;
}

.mobile-nav a,
.mobile-nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--top-menu-color);
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.mobile-nav a:hover,
.mobile-nav button:hover {
    color: var(--top-menu-hover-background-color);
}

/* Mobile bottom nav icons */
.mobile-nav .mobile-icon {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(0.99); /* light */
}

/* Mobile hover */
.mobile-nav a:hover .mobile-icon,
.mobile-nav button:hover .mobile-icon {
    width:  32px;
    height: 32px;
    filter: brightness(0) invert(0.99); /* light */
    /* filter: brightness(0) invert(0.0) sepia(1) saturate(6) hue-rotate(160deg); */
}

.mobile-nav a.active{
    height: 100%;
    /* background-color:var(--red-seal); */
    border-radius: 30px;
}
.mobile-icon.active {
    transform: scale(1.1);
}

.mobile-nav a.active img {
    transform: scale(1.2);
    /* transition: 0.0s; */
}

#mic-ring{
    background-color: transparent;
    position: absolute;
    pointer-events: none;
}

#waveform {
    background-color: transparent;
    position: absolute;
    pointer-events: none;
}


button:disabled {
    opacity: 0.5;
}

.disabled-link {
    pointer-events: none; 
}

.close-button{
    all:unset;
    padding:2px 8px 2px 8px;
    margin-left: 5px;
    margin-right: 5px;
    margin-left: auto;
    color: var(--white);
    /* border:1px solid var(--blue); */
    background-color: var(--ink-black);
    font-weight:normal; 
    border-radius: 10px;
    cursor: pointer;
}

.close-button:hover{
    background-color: var(--red-seal);
}

.feedback-box{

    position: fixed;
    bottom: var(--mobile-nav-height);
    right: 0;
    width: 30%;
    height: 50%;
    background: var(--pop-window-background);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    transition: bottom 0.3s ease;
    z-index: 1000;
    color: var(--ink-black);
    word-break: break-word; 
    padding: 12px;
    overflow-y: auto;   /* enables vertical scrolling inside the panel */

    display: flex;
    flex-direction: column;
}

.feedback-box .line,
.feedback-box .contentDiv {
    flex-wrap: wrap;       /* allow wrapping on small screens */
    /* gap: 2px; */
}

.correction-style{
    white-space: nowrap;
    margin-right: 6px;
    background: var(--light-ink-glass);
    border-radius: 3px;
    padding: 1px 2px;
}

.correction-style:active, .correction-style:hover{
    background: var(--blue-glass);
}

.correction-style span {
    margin-top: 2px;
    margin-bottom: 2px;
    display: inline-block;
}

.wave-bar{
    padding: 10px;
}

/* ================================
   Modal Container (Visibility FIX)
================================ */

#custom-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;

    /* Hidden state */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#custom-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ================================
   Background Overlay
================================ */

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

/* ================================
   Modal Box
================================ */

.modal-box {
    position: relative;
    background: var(--pop-window-background);
    padding: 20px 24px;
    border-radius: 14px;
    max-width: 90%;
    width: 360px;
    text-align: center;
    color: var(--ink-black);

    /* Shadow (depth) */
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.25);

    /* Animation */
    transform: scale(0.95);
    transition: transform 0.25s ease;
    z-index: 10001;
}

/* Pop-in animation */
#custom-modal.visible .modal-box {
    transform: scale(1);
}

/* ================================
   Message
================================ */

.modal-box p {
    font-size: 16px;
    margin-bottom: 18px;
    color: var(--light-ink);
}

/* ================================
   Buttons
================================ */

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.modal-buttons button {
    /* all: unset; */
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: small;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.modal-buttons button:hover {
    transform: scale(1.05);
}

.modal-submit{
    border: solid 1px var(--light-ink-glass);
    color: var(--light-ink);
}

.modal-submit:hover {
    background-color: var(--qing);
    color: var(--white);
}

.modal-submit-cancel{
    border: solid 1px var(--light-ink-glass);
    color: var(--light-ink);
}

.modal-submit-cancel:hover {
    background-color: var(--ink-black);
    color: var(--white);
}

/* Cancel */
#modal-cancel {
    border: solid 1px var(--light-ink-glass);
    color: var(--light-ink);
}

#modal-cancel:hover {
    background-color: var(--qing, #09866C);
    color: var(--white);
}

/* Confirm (normal) */
.modal-confirm {
    border: solid 1px var(--light-ink-glass);
    color: var(--light-ink);
}

.modal-confirm:hover {
    background-color: var(--blue);
    color: var(--white);
}

/* Danger / Delete */
.modal-danger {
    border: solid 1px var(--light-ink-glass);
    color: var(--light-ink);
}

.modal-danger:hover {
    background-color: var(--red-seal);
    color: var(--white);
}

/* Warning */
.modal-warning {
    border: solid 1px var(--light-ink-glass);
    color: var(--light-ink);
}

.modal-warning:hover {
    background-color: var(--orange);
    color: var(--white);
}

.modal-select select, .modal-box input{
    -webkit-tap-highlight-color: transparent; /* iOS tap highlight */
    outline: none;                             /* Remove focus outline */

    margin-left: auto;
    color: var(--light-ink);
    padding: 5px 10px;
    background-color: transparent;
    border: solid 1px var(--light-ink-glass);
    border-radius: 5px;
    margin-bottom: 10px;
    height: 30px;
}


.modal-text textarea{
    -webkit-tap-highlight-color: transparent; /* iOS tap highlight */
    outline: none;                             /* Remove focus outline */

    overflow-x: auto;         /* scroll horizontally if needed */
    overflow-y: auto;         /* scroll vertically */
    
    height: 150px;
    width: 95%;            /* fill parent container */
    max-width: 95%;        /* never exceed parent */
    box-sizing: border-box; /* include padding in width */
    overflow-x: auto;       /* horizontal scroll if needed */
    word-wrap: break-word;  /* break long words */
    white-space: pre-line;  /* preserve line breaks */

    margin-left: 0px;
    text-align: left;
    box-sizing: border-box;
    border-radius: 5px;
    padding: 5px 10px;
    border: solid 1px var(--light-ink-glass);

    transition: border-color 0.2s ease;        /* Optional: smooth border on focus */
}

.modal-text textarea:focus {
    border-color: var(--light-ink);  /* Or any color you like for focused state */
}

.missing-word {
    border-bottom: 2px solid var(--blue);
    padding: 0 2px;
    border-radius: 2px;
}

.success-msg{
    color:var(--qing);
    margin:10px;
    font-size: 15px;
}

.error-msg{
    color:var(--blue);
    margin:10px;
    font-size: 15px;
}

.word {
    cursor: pointer;
    position: relative;
}

.word:hover{
    color: var(--red-seal);
}

.definition-popup {
    position: absolute;
    max-height: 220px;          /* limit height */
    overflow-y: auto;           /* enable vertical scrolling */
    overflow-x: hidden;
    background: var(--pop-window-background);
    border: 1px solid var(--pop-window-background);
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 1000;
    scrollbar-width: thin;        /* Firefox */
}

.definition-popup::-webkit-scrollbar {
    width: 6px;
}
.definition-popup::-webkit-scrollbar-thumb {
    background: var(--pop-window-background);
    border-radius: 4px;
}

.vocab-popup {
    max-width: 280px;
    font-size: 14px;
    line-height: 1.4;
}

.vocab-word {
    font-size: 16px;
    margin-bottom: 6px;
}

.word-phonetic {
    margin-left: 6px;
    color: var(--light-ink);
    font-style: italic;
}

.vocab-translation,
.vocab-definition {
    text-align: justify;
    margin-top: 4px;
}

.general-back-block {
    display: flex;
    align-items: center;        /* vertical align back button & symbols */
    justify-content: space-between; /* push first item left, last item right */
    width: 100%;
    gap: 12px;                  /* optional spacing */
    border-radius: 8px;
    border: solid 1px var(--light-ink-glass);
    padding: 10px;
    box-sizing: border-box;
}

.general-back-button {
    all:unset;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    /* border: 1px solid var(--light-ink-glass); */
    
    display: flex;             /* ensures it behaves as a block flexbox */
    justify-content: center;
    align-items: center;

    box-sizing: border-box;    /* include border inside width/height */
    
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;           /* adjust so the ❮ fits */
    line-height: 1;            /* no extra vertical spacing */
    padding: 0;
}

.general-back-button:hover{
    color: var(--red-seal);
}



/* =========================
   MOBILE BOTTOM NAV
========================= */
@media (min-width: 768px) {

    .mobile-nav {
        margin-left: var(--desktop-nav-width);
        width: calc(100% - var(--desktop-nav-width));
        background-color: transparent;
    }

    #mobile-home, #mobile-resources, #mobile-practice, #mobile-profile{
        display:none;
    }
    #mobile-record{
        /* border: 1px solid var(--ink-black); */
        background-color: var(--background-color);
        padding: 20px;
        border-radius: 40px;
        margin-bottom: 30px;
    }
    #mobile-record.disabled-link{
        /* border: 1px solid var(--ink-black); */
        background-color:transparent;
    }

    #mobile-record:hover{
        background-color:var(--red-seal);
        border: none;
    }

    #mobile-record:hover img{
        filter: invert(1.0); /* dark */
        transition: 0s;
    }

    #mobile-record img {
        /* height: 40px;
        width: 40px; */
        filter: invert(0.0); /* dark */
    }
}

/* =========================
   RESPONSIVE RULES
========================= */
@media (max-width: 768px) {

    .modal-box {
        width: 80%;
        padding: 18px 20px;
        transform: translateY(30px);
    }

    #custom-modal.visible .modal-box {
        transform: translateY(0);
    }
    .modal-buttons button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .feedback-box {
        width: 100%;
        width: calc(100% - 28px); /* 2px left + 2px right + 12px left + 12px right*/
        margin: 0 2px; /* top/bottom 0, left/right 10px */
        padding: 12px; /* top/bottom 0, left/right 10px */
        overflow-x: hidden;
        overflow-y: auto; /* vertical scroll still allowed */
        margin-bottom: calc(var(--mobile-nav-height) / 2);;
    }

    .mobile-nav{
        width: 100%;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-block{
        width: 20%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .desktop-nav {
        display: none;
    }

    .content {
        margin-left: 0;
        padding-left: 0px; /* content won't be covered by menu now */
    }

    #mobile-record.disabled-link{
        /* border: 1px solid var(--ink-black); */
        background-color:var(--ink-black);
    }

    #mobile-record{
        background-color: var(--red-seal);
        padding: 20px;
        border-radius: 40px;
        margin-bottom: 20px;
        /* border: 1px solid var(--light-ink); */
    }
    #mobile-record:hover{
        width: 28px;
        height: 28px;
        transform: scale(1.02);
        transition: transform 0.2s ease-out, opacity 0.2s ease-out; /* The animation properties */
    }

    #mobile-record:active{
        width: 28px;
        height: 28px;
        transform: scale(1.3);
        transition: transform 0.5s ease-out, opacity 0.5s ease-out; /* The animation properties */
    }
}



/* =========================
   FOOTER
========================= */
.footer {
    width: 100%;
    text-align: center;
    padding: 15px;
    background-color: transparent;
    /*color: var(--sidebar-a-color);*/
}

@keyframes pop-heart {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

