/*
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
See LICENSE-CODE in the project root for details.
*/

html, body { 
    max-width: 100%;
    overflow-x: hidden;
}

:root {
    /* Website */
    --primary-color: #F9BB1E;
    --text-color: #f0f0f0;
    --background-color: #2F4858;
    --background-image: none;
    --font: Figtree;

    /* Website Supplements */
    --primary-color-transparent: rgba(249, 187, 30, 0.2);
    --button-inside-shadow: rgba(0,0,0,0.3);
    --bar-background: #000000;
    --glass: rgba(255,255,255,0.3);

    /* Email */
    --email-text-color: #000000;
    --email-info-color: #555;
    --link-text-color: #007bff;
    --email-background-color: #ffffff;

    /* Email Supplements */
    --email-shadow: rgba(0,0,0,1); /* Shadow outside of email */
}

#theme-buttons button.active {
    background-color: var(--primary-color);
    color: var(--background-color);
}

/* Global */

body {
    background-color: var(--background-color);
    
    background-image: var(--background-image);
    
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;

    color: var(--text-color);
    font-family: var(--font);
    height: 100%;
    margin: 0;
}

button {
    background-color: var(--text-color);
    border: none;
    color: var(--background-color);
    font-family: inherit;
    font-weight: bold;
    padding: 15px 30px;
    transition: background-color 0.3s ease;
    border-radius: 6px;
    cursor: pointer;
}

button:hover:not(:disabled) {
    background-color: var(--primary-color);
    box-shadow: inset 0 0 10px var(--button-inside-shadow);
    /*transform: scale(1.02);*/
    /*border: 2px solid var(--primary-color);*/
}

button:disabled {
    background-color: black;
    color: var(--text-color);
}

button.completed {
    background-color: var(--primary-color);
}

.accordion.completed {
    background-color: var(--primary-color);
}

.accordion.locked {
    pointer-events: none;
}

/* Classes */

.title {
    color: var(--primary-color);
}

.center-content {
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.locked {
    pointer-events: none;
}

.active-page {
    background-color: var(--primary-color);
    color: var(--background-color)
}

.page-wrapper {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

/* Navigation Bar */

header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
}

#website-title {
    color: var(--primary-color);
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
}

/*#website-title img {
    height: 50px;
    width: auto;
    margin-right: 20px;
    content: url('../assets/icon.png');
    transition: 1s ease-in-out;
}

#website-title:hover img {
    content: url('../assets/icon_hover.png')
}*/

ul {
    display: flex;
    list-style: none;
}

ul li {
    margin-right: 20px;
}

ul li:last-child {
    margin-right: 0;
}

ul li a {
    color: inherit;
    /* display: inline-block; */
    display: flex;
    align-items: center;
    gap: 8px;

    text-decoration: none;
    border-radius: 6px;
    padding: 8px 12px;
    transition: background-color 0.3s ease, color 0.3 ease;
    font-weight: bold;
}

ul li a:not(.active-page):hover {
    color: var(--primary-color);
    transition: color 0.3s ease;
    background-color: var(--primary-color-transparent);
    /*border: 2px solid var(--primary-color);*/
}

#menu-toggle {
    display: none;
}

/* Footer */

footer {
    font-size: 0.9rem;
    padding: 1rem;
}

/* Home */

#home {
    height: 80vh;
}

#home h1 {
    margin-bottom: 10px;
}

#home p {
    margin-top: 0px;
}

#home button {
    margin-top: 30px;
}

/* Learn */

.modal-class {
    cursor: pointer;
    transition: 0.2s;
}

.modal-class:hover {
    color: var(--primary-color);
}

#learn-page button {
    margin-bottom: 20px;
}

#progress-summary h2 {
    margin-bottom: 0px;
}

#progress {
    width: 80%;
    background-color: var(--bar-background);
    border-radius: 10px;
    margin: 20px auto;
    height: 20px;
    overflow: hidden;
    position: relative;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    transition: width 0.5s ease;
    color: var(--background-color);
    border-radius: 10px;
    position: relative;
}

#progress.complete {
    box-shadow: 0 0 7px 1px var(--primary-color);
    transition: box-shadow 1s ease-in-out;
}

#progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    pointer-events: none;
}

.accordion {
    cursor: pointer;
    padding: 18px;
    width: 100%;
    transition: 0.4s;
}

.active, .accordion:hover {
    background-color: var(--primary-color);
}

.panel {
    display: none;
    /*overflow: hidden;*/
    transition: max-height 0.2s ease-out;
}

.accordion:before {
    font-family: "Font Awesome 6 Free";
    content: "\f078";
}

.accordion.active::before {
    font-family: "Font Awesome 6 Free";
    content: "\f077";
}

/* Lesson: Email */

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--glass);
}

.modal-content {
    background-color: var(--background-color);
    margin: 15% auto;
    padding: 20px;
    border: 4px solid var(--primary-color);
    border-radius: 6px;
    width: 80%;
}

.close {
    color: var(--text-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover, .close:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

#lesson {
    display: flex;
    gap: 20px;
    padding: 20px;
}

#email {
    flex: 7;
    background-color: var(--email-background-color);
    color: var(--email-text-color);
    padding: 20px;
    box-shadow: 0 2px 8px var(--email-shadow);
    font-family: Arial, Helvetica, sans-serif;
    border-radius: 6px;
}

#email-title {
    font-size: 24px;
    font-weight: normal;
    margin: 0 0 12px 0;
    /*border-bottom: 1px solid #ddd;
    margin-bottom: 8px;
    padding-bottom: 4px;*/
}

#email-info {
    align-items: center;
    display: flex;
    gap: 10px;
    color: var(--email-info-color);
    flex-wrap: wrap;
    margin-bottom: 20px;
}

#email-info p {
    margin: 0;
}

#email-info p:first-child {
    font-weight: bold;
}

#email-content {
    padding-top: 10px;
    /*margin-top: 0px;*/
    line-height: 1.6;
}

.email-link {
    color: var(--link-text-color);
    text-decoration: underline;
    cursor: pointer;
}

#email-attachments {
    border-top: 1px solid #ddd;
    margin-top: 20px;
    padding-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.attachment-tile {
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 8px 12px;
    width: 200px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.attachment-tile:hover {
    background-color: #e9f3ff;
    box-shadow: 0 0 4px rgba(0,0,0,0.15);
    cursor: pointer;
}

.attachment-tile i {
    font-size: 1.5rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.attachment-tile i.fa-file-pdf { color: #d9534f; }
.attachment-tile i.fa-file-word { color: #2b579a; }
.attachment-tile i.fa-file-excel { color: #217346; }
.attachment-tile i.fa-file-zipper { color: #f0ad4e; }
.attachment-tile i.fa-file-image { color: #28a745; }

/* Text */
.attachment-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.attachment-name {
    margin: 0;
    color: #1a73e8;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: underline;
    line-height: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
}

/* Lesson: Information */

#info {
    flex: 3;
}

#info-intro {
    text-align: center;
}

#lesson-number {
    margin-bottom: 0px;
}

#lesson-title {
    margin-top: 2px;
}

#buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

#result-message {
    font-weight: bold;
    margin: 10px;
}

#next-btn {
    display: none;
    width: 100%;
    margin-top: 10px;
}

.link {
    text-decoration: none;
    color: var(--primary-color);
}

/* Settings */

#settings-page h2 {
    margin-bottom: 10px;
}

#settings-page p {
    margin-bottom: 20px;
    margin-top: 0px;
}

#settings-page button {
    margin-bottom: 20px;
}

/* Profile */

#profile-lesson-progress-summary h2 {
    margin-bottom: 0px;
}

#profile-lesson-progress {
    width: 80%;
    background-color: var(--bar-background);
    border-radius: 10px;
    margin: 20px auto;
    height: 20px;
    overflow: hidden;
    position: relative;
}

#profile-lesson-progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    transition: width 0.5s ease;
    color: var(--background-color);
    border-radius: 10px;
    position: relative;
}

#profile-lesson-progress.complete {
    box-shadow: 0 0 7px 1px var(--primary-color);
    transition: box-shadow 1s ease-in-out;
}

#profile-lesson-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    pointer-events: none;
}



#profile-reading-progress-summary h2 {
    margin-bottom: 0px;
}

#profile-reading-progress {
    width: 80%;
    background-color: var(--bar-background);
    border-radius: 10px;
    margin: 20px auto;
    height: 20px;
    overflow: hidden;
    position: relative;
}

#profile-reading-progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    transition: width 0.5s ease;
    color: var(--background-color);
    border-radius: 10px;
    position: relative;
}

#profile-reading-progress.complete {
    box-shadow: 0 0 7px 1px var(--primary-color);
    transition: box-shadow 1s ease-in-out;
}

#profile-reading-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    pointer-events: none;
}





#profile-total-progress-summary h2 {
    margin-bottom: 0px;
}

#profile-total-progress {
    width: 80%;
    background-color: var(--bar-background);
    border-radius: 10px;
    margin: 20px auto;
    height: 20px;
    overflow: hidden;
    position: relative;
}

#profile-total-progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    transition: width 0.5s ease;
    color: var(--background-color);
    border-radius: 10px;
    position: relative;
}

#profile-total-progress.complete {
    box-shadow: 0 0 7px 1px var(--primary-color);
    transition: box-shadow 1s ease-in-out;
}

#profile-total-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    pointer-events: none;
}






#profile-progress-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 88%;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 0 auto;
}

.profile-progress-section {
    flex: 1;
    min-width: 280px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center; /* centers text and bar */
}









/* History */

#reading {
    display: flex;
    gap: 20px;
    padding: 20px;
}

#reading-email {
    flex: 7;
    background-color: var(--email-background-color);
    color: var(--email-text-color);
    padding: 20px;
    box-shadow: 0 2px 8px var(--email-shadow);
    font-family: Arial, Helvetica, sans-serif;
    border-radius: 6px;
}

#reading-email-title {
    font-size: 24px;
    font-weight: normal;
    margin: 0 0 12px 0;
    /*border-bottom: 1px solid #ddd;
    margin-bottom: 8px;
    padding-bottom: 4px;*/
}

#reading-email-info {
    align-items: center;
    display: flex;
    gap: 10px;
    color: var(--email-info-color);
    flex-wrap: wrap;
    margin-bottom: 20px;
}

#reading-email-info p {
    margin: 0;
}

#reading-email-info p:first-child {
    font-weight: bold;
}

#reading-email-content {
    padding-top: 10px;
    /*margin-top: 0px;*/
    line-height: 1.6;
}

#reading-info {
    flex: 3;
}

#reading-info-intro {
    text-align: center;
}

#reading-lesson-number {
    margin-bottom: 0px;
}

#reading-lesson-title {
    margin-top: 2px;
}

#reading-next-btn {
    display: none;
    width: 100%;
    margin-top: 10px;
}

#reading-complete-btn {
    width: 100%;
}

#reading-email-attachments {
    border-top: 1px solid #ddd;
    margin-top: 20px;
    padding-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.reading-attachment-tile {
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 8px 12px;
    width: 200px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.reading-attachment-tile:hover {
    background-color: #e9f3ff;
    box-shadow: 0 0 4px rgba(0,0,0,0.15);
    cursor: pointer;
}

.reading-attachment-tile i {
    font-size: 1.5rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.reading-attachment-tile i.fa-file-pdf { color: #d9534f; }
.reading-attachment-tile i.fa-file-word { color: #2b579a; }
.reading-attachment-tile i.fa-file-excel { color: #217346; }
.reading-attachment-tile i.fa-file-zipper { color: #f0ad4e; }
.reading-attachment-tile i.fa-file-image { color: #28a745; }

/* Text */
.reading-attachment-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.reading-attachment-name {
    margin: 0;
    color: #1a73e8;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: underline;
    line-height: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reading-attachment-size {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
}






/* Scrollbar */

::-webkit-scrollbar { /* WebKit */
    width: 0;
    height: 0;
}




/* Mobile */

@media (max-width: 768px) {
    .page-wrapper {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    body {
        padding: 0 10px;

        /* test */
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
    }

    header a:first-child {
        align-self: center;
    }

    ul {
        flex-direction: column;
        width: 100%;
        padding-left: 0;
        margin-top: 10px;
    }

    ul li {
        margin: 0 0 10px 0;
    }

    ul li:last-child {
        margin-bottom: 0;
    }

    ul li a {
        width: 100%;
        display: block;
        padding: 12px;
        text-align: left;
    }

    #home {
        height: auto;
        padding: 40px 20px;
        text-align: center;
    }

    #home h1 {
        font-size: 1.8rem;
    }

    #home p {
        font-size: 1rem;
    }

    #home button {
        width: 100%;
    }

    #lesson {
        flex-direction: column;
        padding: 20px 10px;
    }

    #reading {
        flex-direction: column;
        padding: 20px 10px;
    }

    #email, #info, #reading-email, #reading-info {
        width: 100%;
    }

    #buttons {
        grid-template-columns: 1fr;
    }

    #progress {
        width: 100%;
        margin: 20px 0;
    }

    #email-info, #reading-email-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    footer {
        text-align: center;
        font-size: 0.8rem;
    }

    h1, h2, h3 {
        font-size: 1.5rem;
    }

    p {
        font-size: 1rem;
    }

    button {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
    }

    #next-btn {
        margin-top: 20px;
    }



    #menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 2rem;
        color: var(--text-color);
        padding: 10px;
        cursor: pointer;
        margin-top: 10px;
    }

    header ul {
        display: none;
        flex-direction: column;
        width: 100%;
        padding-left: 0;
    }

    header ul.open {
    display: flex;
    }

    header ul li {
        margin: 0 0 10px 0;
    }

    header ul li a {
        display: block;
        padding: 12px 16px;
        width: 100%;
        text-align: left;
    }
}