﻿@font-face {
    font-family: "Besley";
    src: url("/css/fonts/Besley-Regular.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Besley";
    src: url("/css/fonts/Besley-Italic.woff2") format("woff2");
    font-weight: 400 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --color-bg: #F5F5F5;
    --color-menu-bg: #d6d6d6;
    --color-menu-text: #646464;
    --color-border: #D6D6D6;
    --color-border-light: #e0e0e0;
    --color-border-dark: #757575;
    --color-text: #646464;
    --color-text-active: var(--color-text);
    --color-text-dark: #000;
    --color-text-light: #fff;
    --color-font-light: #ccc;
    --color-font-hover: #e0e0e0;
    --color-popup-bg: #fff;
    --color-popup-header: #646464;
    --color-popup-header-title: var(--color-text-light);
    --color-popup-shadow: rgba(0, 0, 0, 0.15);
    --color-popup-shadow-dark: #00000026;
    --color-button-bg: #f9f9f9;
    --color-button-hover: #e0e0e0;
    --color-active: #000;
}

    :root[data-theme="dark"] {
        --color-bg: #292424;
        --color-text: #d0d0d0;
        --color-text-active: var(--color-text);
        --color-border: #333333;
        --color-border-light: #2a2e38;
        --color-border-dark: #4a4e59;
        --color-menu-bg: #333333;
        --color-menu-text: #d0d0d0;
        --color-text-dark: #ffffff;
        --color-text-light: #ccc;
        --color-font-light: #888;
        --color-font-hover: #555;
        --color-popup-bg: #595959;
        --color-popup-header: #333333;
        --color-popup-header-title: var(--color-menu-text);
        --color-popup-shadow: rgba(0, 0, 0, 0.6);
        --color-popup-shadow-dark: rgba(0, 0, 0, 0.8);
        --color-button-bg: #252a3a;
        --color-button-hover: #3a3f51;
        --color-active: #f5f5f5;
    }

    :root[data-theme="night"] {
        --color-bg: #eee8d1;
        --color-text: #553820;
        --color-text-active: var(--color-menu-text);
        --color-border: #333333;
        --color-border-light: #2a2e38;
        --color-border-dark: #4a4e59;
        --color-menu-bg: #5a4f45;
        --color-menu-text: #eee8d1;
        --color-text-dark: #ffffff;
        --color-text-light: #ccc;
        --color-font-light: #888;
        --color-font-hover: #555;
        --color-popup-bg: #857566;
        --color-popup-header: #5a4f45;
        --color-popup-header-title: var(--color-menu-text);
        --color-popup-shadow: rgba(0, 0, 0, 0.6);
        --color-popup-shadow-dark: rgba(0, 0, 0, 0.8);
        --color-button-bg: #252a3a;
        --color-button-hover: var(--color-popup-bg);
        --color-active: #f5f5f5;
    }

.tiptap {
    font-family: 'Besley', serif !important;
}

.tiptap p {
    margin: 0;
    padding: 4px 0;
}

.tiptap h1 {
    font-size: 24px;
}

.tiptap h2 {
    font-size: 20px;
}

.tiptap img {
    border-radius: .5rem;
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

blockquote {
    border: 0 solid var(--color-text);
    border-left-width: 2px;
    margin: 0;
    padding-left: 1rem;
}

.reader-page {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    height: 100vh;
    background-color: var(--color-bg);
}

.reader-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.reader__header,
.chapter__actions {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
}

    .chapter__actions .styled-btn {
        border: 1px solid var(--color-text);
    }

        .chapter__actions .styled-btn span {
            color: var(--color-text);
        }

.reader__header {
    font-family: 'Fira Sans', serif;
    background: var(--color-menu-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 0.65rem 1.65rem 0.65rem 1.65rem;
    transition: opacity ease-in-out 0.2s;
    opacity: 1;
}

    .reader__header.visible {
        position: sticky;
        top: 0;
        z-index: 9999;
        opacity: 0;
    }

        .reader__header.visible.full {
            opacity: 1;
        }

.actions-block {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
}

.reader__chapter {
    max-width: 800px;
    align-self: center;
    color: var(--color-text);
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    user-select: none;
}

.indice-wrapper {
    position: relative;
    display: inline-block;
}

.indice-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: max-content;
    max-height: 350px;
    overflow: hidden;
    max-width: 560px;
    background: var(--color-popup-bg);
    border: 1px solid var(--color-border-dark);
    border-radius: 0;
    box-shadow: 4px 4px 10px 0px var(--color-popup-shadow-dark);
    z-index: 1000;
    padding: 1rem;
    font-family: sans-serif;
}

.indice-popup__header {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem;
}

    .indice-popup__header button {
        display: none;
    }

.header__title {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.indice-popup h4,
.settings-popup h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-dark);
    font-family: Roboto;
    letter-spacing: 0px;
}

.indice-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 275px;
    overflow-y: auto;
}

h4,
h5 {
    color: var(--color-menu-text);
    margin: 0;
}

h5 {
    font-size: 1rem;
    font-family: Roboto;
}

.styled-btn {
    border: 1px solid var(--color-menu-text);
    font-family: 'Fira Sans', serif;
}

    .styled-btn span {
        color: var(--color-menu-text);
    }

    .styled-btn:hover {
        background-color: var(--color-button-hover);
    }

.chapter {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: Roboto;
    font-weight: 400;
    line-height: 22px;
    letter-spacing: 0px;
    color: var(--color-menu-text);
}

    .chapter:last-child {
        border-bottom: none;
    }

    .chapter:hover {
        background-color: var(--color-button-hover);
    }

    .chapter input[type="radio"] {
        appearance: none;
        -webkit-appearance: none;
        box-sizing: border-box;
        position: relative;
        width: 1rem;
        height: 1rem;
        margin-right: 0.75rem;
        border: 2px solid var(--color-menu-text);
        border-radius: 50%;
        flex-shrink: 0;
        cursor: pointer;
    }

        .chapter input[type="radio"]::before {
            content: "";
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0.5rem;
            height: 0.5rem;
            border-radius: 50%;
            transform: translate(-50%, -50%) scale(0);
            background: var(--color-menu-text);
        }

        .chapter input[type="radio"]:checked::before {
            transform: translate(-50%, -50%) scale(1);
        }

    .chapter.active {
        font-weight: bold;
    }

.hidden,
.fullscreen-button.hidden {
    display: none;
}

.settings-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 400px;
    background: var(--color-popup-bg);
    border: 1px solid var(--color-border-dark);
    box-shadow: 4px 4px 10px 0px var(--color-popup-shadow);
    z-index: 1000;
    padding: 1rem;
    font-family: sans-serif;
}

    .settings-popup .indice-popup__header {
        display: none;
    }

.settings-popup__content {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1.5rem;
}

.font-size-options {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.font-size-button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
    text-align: center;
    transition: all 0.2s ease;
}

    .font-size-button:hover {
        background: var(--color-button-hover);
        color: var(--color-text-active);
    }

    .font-size-button.active {
        background-color: var(--color-border);
        color: var(--color-text-active);
        font-weight: bold;
    }

.chapter__content.font-small {
    font-size: 1rem;
    line-height: 1.375;
}

.chapter__content.font-medium {
    font-size: 1.25rem;
    line-height: 1.375;
}

.chapter__content.font-large {
    font-size: 1.5rem;
    line-height: 1.375;
}

.theme-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.theme-button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    user-select: none;
}

    .theme-button:hover {
        color: var(--color-text-active);
        background: var(--color-button-hover);
    }

    .theme-button.active {
        background-color: var(--color-border);
        color: var(--color-text-active);
        font-weight: bold;
    }

    .theme-button svg {
        width: 18px;
        height: 18px;
        fill: currentColor;
    }

.setting-item {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

    .setting-item h5 {
        text-align: center;
    }

@media (max-width: 600px) {
    .styled-btn .text-regular {
        display: none;
    }

    .styled-btn,
    .chapter__actions .styled-btn {
        border: none;
        padding: 0.25rem 0.5rem;
    }

    .reader__header {
        padding: 0.5rem;
    }

    .styled-btn img {
        width: 1.25rem;
        height: auto;
    }

    .btn-outlined {
        border: none;
    }

    .indice-wrapper {
        position: static;
    }

    .indice-popup {
        width: 100%;
        top: auto;
        left: 0;
        bottom: 0;
        position: fixed;
        height: 70%;
        max-height: 100%;
        padding: 0;
        transition: transform 0.3s ease;
        transform: translateY(0);
    }

    .indice-list {
        max-height: 60vh;
    }

    .settings-popup {
        width: 100%;
        top: auto;
        left: 0;
        bottom: 0;
        position: fixed;
        height: 50%;
        padding: 0;
        transition: transform 0.3s ease;
        transform: translateY(0);
    }

        .settings-popup .indice-popup__header {
            display: flex;
        }

    .indice-popup__header {
        padding: 0 1rem;
        align-items: center;
        background: var(--color-popup-header);
        height: 3.5rem;
    }

        .indice-popup__header button {
            display: block;
        }

            .indice-popup__header button span {
                color: var(--color-popup-header-title) !important;
            }

    .header__title h4 {
        font-size: 1.25rem;
        color: var(--color-popup-header-title);
    }

    .hidden {
        display: block;
        transform: translateY(100%);
    }
}

@media (max-width: 970px) {
    .reader__chapter {
        width: 90%;
    }
}

/* Paywall styles */

.chapter-paywall {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem;
}

.paywall-content {
    max-width: 500px;
    text-align: center;
    padding: 3rem 2rem;
    background: var(--color-menu-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.paywall-icon {
    margin-bottom: 1.5rem;
    color: var(--color-menu-text);
}

    .paywall-icon svg {
        display: inline-block;
    }

.paywall-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text-dark);
}

.paywall-content p {
    font-size: 1rem;
    color: var(--color-menu-text);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.paywall-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-purchase {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: transparent;
    color: var(--color-menu-text);
    text-decoration: none;
    border: 1px solid var(--color-menu-text);
    border-radius: 8px;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

    .btn-purchase:hover {
        background: var(--color-button-hover);
        color: var(--color-text-active);
    }

    .btn-purchase svg {
        transition: transform 0.2s ease;
    }

    .btn-purchase:hover svg {
        transform: translateX(4px);
    }

/* Responsive */
@media (max-width: 600px) {
    .chapter-paywall {
        padding: 1rem;
    }

    .paywall-content {
        padding: 2rem 1.5rem;
    }

        .paywall-content h3 {
            font-size: 1.25rem;
        }

        .paywall-content p {
            font-size: 0.9375rem;
        }

    .btn-purchase {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }
}
