/* Font Selection Styles */
.reading-preferences {
    margin: 0 0 28px;
    padding: 10px 14px;
    background-color: #f1f3f4;
    border-top: 1px solid #d8dddf;
    border-bottom: 1px solid #d8dddf;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
    align-items: center;
    color: #4b565c;
}

.font-selector {
    display: flex;
    align-items: center;
    max-width: 300px;
}

.font-selector label {
    margin-right: 10px;
    margin-bottom: 0;
    color: #59666d;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.font-selector select {
    flex: 1;
    height: 32px;
    padding: 4px 28px 4px 10px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #c7ced2;
    color: #3d464b;
    font-size: 13px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.04);
}

/* Font Size Controls */
.font-size-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.font-size-controls label {
    margin-bottom: 0;
    color: #59666d;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.font-size-buttons {
    display: flex;
    gap: 6px;
}

.font-size-buttons button {
    min-width: 42px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    background-color: #fff;
    border: 1px solid #b8c1c6;
    border-radius: 4px;
    color: #334047;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.font-size-buttons button:hover,
.font-size-buttons button:focus {
    background-color: #e9f3ef;
    border-color: #14a669;
    color: #0f7f51;
    outline: none;
    box-shadow: 0 2px 5px rgba(20, 166, 105, 0.18);
}

.font-size-buttons button:active {
    background-color: #d8ece4;
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.12);
}

#decrease-font-size {
    font-size: 0.9em;
}

#reset-font-size {
    font-size: 1em;
}

#increase-font-size {
    font-size: 1.1em;
}

@media (max-width: 600px) {
    .reading-preferences {
        align-items: flex-start;
        padding: 12px;
    }

    .font-selector,
    .font-size-controls {
        width: 100%;
    }

    .font-selector select {
        min-width: 0;
    }
}

/* Font Classes with !important to override other styles */
.font-default {
    font-family: inherit !important;
}

.font-serif {
    font-family: "Times New Roman", Times, serif !important;
}

.font-sans-serif {
    font-family: Arial, Helvetica, sans-serif !important;
}

.font-monospace {
    font-family: "Courier New", Courier, monospace !important;
}

.font-georgia {
    font-family: Georgia, serif !important;
}

.font-palatino {
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif !important;
}

.font-verdana {
    font-family: Verdana, Geneva, sans-serif !important;
}

.font-tahoma {
    font-family: Tahoma, Geneva, sans-serif !important;
}

/* Apply font to all elements inside the chapter content */
#chapterContent.font-serif,
#chapterContent.font-serif * {
    font-family: "Times New Roman", Times, serif !important;
}

#chapterContent.font-sans-serif,
#chapterContent.font-sans-serif * {
    font-family: Arial, Helvetica, sans-serif !important;
}

#chapterContent.font-monospace,
#chapterContent.font-monospace * {
    font-family: "Courier New", Courier, monospace !important;
}

#chapterContent.font-georgia,
#chapterContent.font-georgia * {
    font-family: Georgia, serif !important;
}

#chapterContent.font-palatino,
#chapterContent.font-palatino * {
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif !important;
}

#chapterContent.font-verdana,
#chapterContent.font-verdana * {
    font-family: Verdana, Geneva, sans-serif !important;
}

#chapterContent.font-tahoma,
#chapterContent.font-tahoma * {
    font-family: Tahoma, Geneva, sans-serif !important;
}

/* Font Size Adjustment Helpers */
/* Ensure images and other media scale appropriately with font size */
#chapterContent img,
#chapterContent video,
#chapterContent iframe,
#chapterContent embed,
#chapterContent object {
    max-width: 100%;
    height: auto;
}

/* Ensure tables remain readable */
#chapterContent table {
    width: 100%;
    table-layout: auto;
    overflow-x: auto;
    display: block;
}

/* Ensure pre-formatted text doesn't overflow */
#chapterContent pre,
#chapterContent code {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Ensure lists maintain proper indentation */
#chapterContent ul,
#chapterContent ol {
    padding-left: 2em;
}

/* Ensure blockquotes are properly styled */
#chapterContent blockquote {
    margin-left: 1em;
    padding-left: 1em;
    border-left: 3px solid #ccc;
}
