/* -------------------------------- reset default padding, margin and box-sizing -------------------------------- */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

/* -------------------------------- light mode colors -------------------------------- */
:root {
    --bg-color: #F9F5ED;
    --text-color: #333333;
    --bg-shadow: #FFFFFF;
    --accent-color: #E07A5F;
    --border-color: #E0E0E0;
}

/* -------------------------------- dark mode colors -------------------------------- */
body.dark {
    --bg-color: #1E1B18;
    --text-color: #F8F9FA;
    --bg-shadow: #2C2723;
    --accent-color: #FF7D6D;
    --border-color: #44403C;

    .filter-img {
        filter: invert(1);
    }
}

/* -------------------------------- default body styles -------------------------------- */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    width: 90%;
    margin: auto;
    transition: all 0.3s;
    position: relative;

    .filter-img {
        filter: none;
    }
}

/* -------------------------------- default button styles -------------------------------- */

button {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    padding: 10px;
    cursor: pointer;
    background-color: transparent;
    border-radius: 10px;
    transition: all 0.3s;
}

button:hover {
    border: 2px solid var(--accent-color);
}

button img {
    height: 20px;
    width: 20px;
}

/* -------------------------------- default textarea styles -------------------------------- */
textarea {
    width: 100%;
    height: 100%;
    color: var(--text-color);
    outline: none;
    background: transparent;
    border: none;
    resize: none;
}

/* -------------------------------- navbar styles -------------------------------- */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 10px auto;
}

/* -------------------------------- navbar heading styles -------------------------------- */
nav h1 {
    font-size: 2rem;
}

/* -------------------------------- navbar button styles -------------------------------- */
.nav-btns {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* -------------------------------- instructions box styles -------------------------------- */
.instructions-box {
    width: 100%;
    height: 90vh;
    border-radius: 10px;
    background-color: var(--bg-shadow);
    position: absolute;
    z-index: 100;
    translate: 0 -200%;
    transition: all 0.3s;
    overflow: auto;
}

.instructions-box-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* -------------------------------- instructions box grid styles -------------------------------- */
.instructions-box-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    gap: 10px;
    padding: 15px;
}

.grid-details {
    background: var(--border-color);
    border-radius: 5px;
    font-size: 1.5rem;
    width: 100%;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: flex-start;
    gap: 5px;
    padding: 10px;
}

.grid-details-name {
    text-decoration: underline;
}

.grid-details-instructions {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* -------------------------------- editor styles -------------------------------- */
.editor {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 10px;
}

/* -------------------------------- editor option styles -------------------------------- */
.editor-options {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    background-color: var(--bg-shadow);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom: 1px solid var(--border-color);
    padding: 10px;
}

/* -------------------------------- more headings styles -------------------------------- */
.more-headings {
    position: relative;
}

.more-headings-box {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-direction: column;
    border: 2px solid var(--accent-color);
    border-radius: 10px;
    top: 120%;
    background-color: var(--bg-shadow);
    translate: 0 -20%;
    visibility: hidden;
    opacity: 0;
    padding: 10px 10px;
    transition: all 0.5s;
}

.more-headings:hover {
    img {
        animation: spin 0.3s ease-in both;
    }

    .more-headings-box {
        translate: 0%;
        visibility: visible;
        opacity: 1;
    }
}

.more-headings-box span {
    text-align: start;
    color: var(--text-color);
    width: 100%;
}

.more-headings-box span:hover {
    text-decoration: underline;
}

/* -------------------------------- text areas styles -------------------------------- */
.text-areas {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    height: 80vh;
    width: 100%;
    background-color: var(--bg-shadow);
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.writing-area,
.preview-area {
    overflow: auto;
    padding: 15px;
}

/* -------------------------------- writing area styles -------------------------------- */
.writing-area {
    border-right: 1px solid var(--border-color);
}

/* -------------------------------- preview area styles -------------------------------- */
.preview-area {
    word-break: break-word;
}

.preview-area p {
    margin: 5px 0;
    font-size: 1.5rem;
}

.preview-area h1 {
    font-size: 3rem;
}

.preview-area h2 {
    font-size: 2.25rem;
}

.preview-area h3 {
    font-size: 1.75rem;
}

.preview-area h4 {
    font-size: 1.5rem;
}

.preview-area h5 {
    font-size: 1.24rem;
}

.preview-area h6 {
    font-size: 1rem;
}

.preview-area ul,
.preview-area ol {
    padding: 0 1em;
}

.preview-area ul li,
.preview-area ol li {
    font-size: 1.5rem;
}

.preview-area p code {
    background: var(--border-color);
    padding: 0 5px;
    border-radius: 5px;
    font-size: 1.5rem;
}


.preview-area pre {
    background: var(--border-color);
    margin: 5px 0;
    display: flex;
    flex-direction: column;
    padding: 5px;
    border-radius: 5px;
    font-size: 1.5rem;
    width: 100%;
}

.preview-area pre span {
    width: fit-content;
    border-radius: 5px;
    font-size: 1.5rem;
    background-color: var(--bg-shadow);
    padding: 2px 5px;
}

.preview-area pre code {
    width: 80%;
    margin: auto;
    text-wrap: wrap;
    padding-bottom: 10px;
}

/* -------------------------------- text areas custom scrollbar styles -------------------------------- */
.writing-area::-webkit-scrollbar,
.preview-area::-webkit-scrollbar {
    width: 2px;
}

.writing-area::-webkit-scrollbar-track,
.preview-area::-webkit-scrollbar-track {
    background: transparent;
}

.writing-area::-webkit-scrollbar-thumb,
.preview-area::-webkit-scrollbar-thumb {
    border: 2px solid var(--accent-color);
}

/* -------------------------------- spin animation styles -------------------------------- */
@keyframes spin {
    0% {
        rotate: 0deg;
    }

    100% {
        rotate: 180deg;
    }
}

/* -------------------------------- media styles for responsiveness -------------------------------- */
@media screen and (max-width: 1280px) {
    .instructions-box-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .instructions-box-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media screen and (max-width: 640px) {
    nav {
        flex-direction: column;
        gap: 10px;
    }

    nav h1 {
        font-size: 1.5rem;
    }

    .editor-options {
        justify-content: center;
        flex-wrap: wrap;
    }

    .text-areas {
        height: 70vh;
    }
}