:root {
    --font-scale: 1;
    --base-font-size: 16px;
}

body {
    padding-top: 80px;
    transition: background-color 0.3s, color 0.3s;
}

.navbar {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.card {
    height: 100%;
    border: none;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.fable-content {
    white-space: pre-line;
    font-size: calc(1rem * var(--font-scale));
    line-height: 1.6;
}

.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.loading-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    z-index: 999;
}

.search-container {
    position: relative;
    width: 250px;
}

.search-container .bi-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 1;
}

#searchInput {
    padding-left: 35px;
    border-radius: 20px;
}

.book-select {
    width: 200px;
}

.card-body .text-muted {
    font-size: 0.9rem;
    color: #6c757d; /* Muted gray */
    margin-bottom: 8px;
}

.dark-mode {
    background-color: #121212;
    color: #fff;
}

.dark-mode .navbar {
    background-color: rgba(33, 37, 41, 0.95);
}

.dark-mode .card {
    background-color: #1e1e1e;
    border-color: #2d2d2d;
}

.dark-mode .modal-content {
    background-color: #1e1e1e;
    color: #fff;
}

.dark-mode .form-control,
.dark-mode .form-select {
    background-color: #2d2d2d;
    border-color: #3d3d3d;
    color: #fff;
}

.dark-mode .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.dark-mode .loading-backdrop {
    background: rgba(0, 0, 0, 0.8);
}

@media print {
    .no-print {
        display: none !important;
    }
    .modal {
        position: absolute !important;
    }
    .modal-dialog {
        margin: 0 !important;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

.btn-small {
    font-size: 0.75rem; /* Smaller text */
    padding: 0.25rem 0.5rem; /* Smaller padding */
    line-height: 1.2; /* Adjust line height */
    border-radius: 0.2rem; /* Adjust border radius if needed */
    margin-top: -20px;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}
body.dark-mode .navbar, 
body.dark-mode .card {
    background-color: #1f1f1f;
    color: #e0e0e0;
}
body.dark-mode .card-body {
    background-color: #1f1f1f;
    color: #e0e0e0;
}
body.dark-mode .btn-outline-primary {
    color: #e0e0e0;
    border-color: #e0e0e0;
}
body.dark-mode .btn-outline-primary:hover {
    background-color: #2c2c2c;
}
body.dark-mode .badge {
    background-color: #343a40;
    color: #e0e0e0;
}
body.dark-mode .modal-content {
    background-color: #1f1f1f;
    color: #e0e0e0;
}
body.dark-mode .modal-header {
    border-bottom: 1px solid #2c2c2c;
}
body.dark-mode .modal-footer {
    border-top: 1px solid #2c2c2c;
}
body.dark-mode .search-container input {
    background-color: #1f1f1f;
    color: #e0e0e0;
    border-color: #2c2c2c;
}
body.dark-mode .search-container input:focus {
    background-color: #2c2c2c;
    color: #e0e0e0;
}
body.dark-mode .loading .spinner-border {
    border-color: #e0e0e0;
}