/* Base Styles */
body {
    font-family: 'Noto Serif SC', serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.font-geist-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Loading Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

/* Character Cards */
.character-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.character-item:hover {
    transform: translateY(-8px);
}

.character-item img {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.character-item:hover img {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Novel Content Styling */
#novel-container {
    transition: color 0.3s ease, background-color 0.3s ease;
}

#novel-container img {
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin: 1.5rem 0;
    max-width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

#novel-container img:hover {
    transform: scale(1.02);
}

.chapter-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #b91c1c;
    margin: 2rem 0 1.5rem;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.75rem;
}

.chapter-description {
    font-style: italic;
    color: #6b7280;
    text-align: center;
    margin-bottom: 2rem;
}

/* Character dialog styling */
.dialog {
    background-color: rgba(254, 242, 242, 0.4);
    border-left: 3px solid #ef4444;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0 0.375rem 0.375rem 0;
}

.dialog-name {
    font-weight: 600;
    color: #b91c1c;
    margin-bottom: 0.5rem;
}

/* Image gallery */
.image-gallery {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.5rem 0 1rem;
    margin: 1.5rem 0;
    -webkit-overflow-scrolling: touch;
    scroll-padding: 1rem;
    scroll-snap-type: x mandatory;
}

.image-gallery img {
    height: 180px;
    object-fit: cover;
    flex-shrink: 0;
    scroll-snap-align: start;
    border-radius: 0.375rem;
}

/* Chapter List */
#chapter-list li {
    padding: 0.875rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chapter-list li:hover {
    background-color: #f9fafb;
}

#chapter-list li.active {
    background-color: #fee2e2;
    color: #b91c1c;
}

#chapter-list .chapter-number {
    font-size: 0.875rem;
    color: #9ca3af;
    min-width: 2rem;
}

/* Range Inputs */
input[type="range"] {
    -webkit-appearance: none;
    margin: 0.5rem 0;
    border-radius: 0.25rem;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #ef4444;
    cursor: pointer;
    margin-top: -6px;
}

input[type="range"]:focus {
    outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #e5e7eb;
    border-radius: 0.25rem;
}

/* Theme Buttons */
.theme-btn {
    position: relative;
    transition: transform 0.2s ease;
}

.theme-btn:hover {
    transform: scale(1.05);
}

.theme-btn.active::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
}

/* Theme Classes */
body.theme-light {
    --background: #ffffff;
    --text: #111827;
    --border: #e5e7eb;
    --accent: #b91c1c;
}

body.theme-dark {
    --background: #1f2937;
    --text: #f3f4f6;
    --border: #4b5563;
    --accent: #ef4444;
}

body.theme-sepia {
    --background: #fffbeb;
    --text: #78350f;
    --border: #fef3c7;
    --accent: #b45309;
}

body.theme-mint {
    --background: #f0fdf4;
    --text: #14532d;
    --border: #dcfce7;
    --accent: #15803d;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .chapter-title {
        font-size: 1.5rem;
    }
    
    #novel-container {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .image-gallery img {
        height: 140px;
    }
}

/* Transition for theme changes */
#novel-container, .dialog, header, footer {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
