/* Guns, Germs, and Steel - Interactive Study Guide */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #8B4513;
    --primary-light: #A0522D;
    --primary-dark: #654321;
    --accent: #4169E1;
    --accent-light: #87CEEB;
    --success: #228B22;
    --warning: #DAA520;
    --bg: #f9f7f4;
    --text: #2c3e50;
    --text-light: #666;
    --border: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Soft Sepia Theme - Easy on Eyes */
:root[data-theme="soft-sepia"] {
    --primary: #6B5B47;
    --primary-light: #8B7B67;
    --primary-dark: #4B3B27;
    --accent: #5D7399;
    --accent-light: #A8B8D8;
    --success: #4A7C59;
    --warning: #B8860B;
    --bg: #F5F1E8;
    --text: #3A3A3A;
    --text-light: #7A7A7A;
    --border: #C8B8A8;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Classic Sepia Theme - True Sepia Tone */
:root[data-theme="sepia"] {
    --primary: #7B5E38;
    --primary-light: #9B7E58;
    --primary-dark: #5B3E18;
    --accent: #6B5D4D;
    --accent-light: #A89C8C;
    --success: #5A7C59;
    --warning: #B8860B;
    --bg: #F4ECD8;
    --text: #4A3A2A;
    --text-light: #8A7A6A;
    --border: #B8A898;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Tokyo Night Dark Theme - Deep Blue/Purple Dark Theme */
:root[data-theme="dark"] {
    --primary: #4169E1;
    --primary-light: #5D8BDD;
    --primary-dark: #2E5DD6;
    --accent: #BB9AF7;
    --accent-light: #C084FC;
    --success: #4FD18B;
    --warning: #F7B868;
    --bg: #1A1B26;
    --text: #C0CAF5;
    --text-light: #7AA2F7;
    --border: #2E3440;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body {
    font-family: Georgia, 'Times New Roman', serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ===== THEME TOGGLE ===== */

.secondary.theme-toggle-btn {
    background: var(--accent-light);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.secondary.theme-toggle-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.menu-theme-toggle {
    background: var(--accent-light);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.menu-theme-toggle:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
}

.menu-lang-toggle {
    background: var(--accent-light);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.menu-lang-toggle:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
}

/* ===== READER LAYOUT ===== */

.reader-container {
    display: flex;
    height: 100vh;
}

.reader-sidebar {
    display: none;
}

.sidebar-toggle {
    display: none;
}

.reader-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.reader-header {
    display: none;
}

.reader-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
}

.reader-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.reader-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    font-size: 15px;
    transition: font-size 0.2s ease;
}

/* ===== PAGE VIEW ===== */

.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-header:hover {
    box-shadow: var(--shadow);
}

.page-header.collapsed {
    padding: 15px 30px;
    margin-bottom: 15px;
}

.page-header.collapsed h1 {
    margin: 0;
}

.page-header.collapsed .breadcrumb {
    display: none;
}

.header-toggle-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.header-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.page-header .breadcrumb {
    font-size: 14px;
    opacity: 0.9;
}

.page-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ===== ORIGINAL CONTENT ===== */

.original-content {
    background: var(--bg);
    padding: 25px;
    border-radius: 6px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.original-content h2 {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.text-content p {
    margin: 12px 0;
    font-size: 15px;
    line-height: 1.8;
}

.text-content p:first-child {
    margin-top: 0;
}

/* ===== COMMENTARY ===== */

.commentary {
    background: linear-gradient(135deg, var(--accent-light) 0%, rgba(230, 242, 255, 0.3) 100%);
    padding: 25px;
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.commentary h2 {
    font-size: 18px;
    color: var(--accent);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(65, 105, 225, 0.2);
}

.commentary-placeholder {
    padding: 10px 0;
}

.commentary-section {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg);
    border-radius: 4px;
    border: 1px solid var(--border);
}

.commentary-section h3 {
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 10px;
    font-weight: bold;
}

.commentary-section p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
}

/* ===== CONTROLS ===== */

.nav-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: system-ui, -apple-system, sans-serif;
}

button:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button.secondary {
    background: var(--accent);
}

button.secondary:hover {
    background: var(--primary-dark);
}

input[type="text"],
input[type="number"],
select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
}

.page-input {
    width: 80px;
    text-align: center;
}

/* ===== SIDEBAR NAVIGATION ===== */

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-title {
    font-size: 12px;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 10px;
    font-weight: bold;
}

.sidebar-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.sidebar-item.active {
    background: var(--accent);
    font-weight: bold;
}

/* ===== PROGRESS BAR ===== */

.progress-bar {
    display: none;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.3s ease;
}

/* ===== ZOOM CONTROLS ===== */

.zoom-panel {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-dark);
    color: white;
    padding: 10px;
    border-radius: 0 4px 4px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.zoom-panel:hover,
.zoom-panel.active {
    opacity: 1;
    pointer-events: all;
}

.zoom-level {
    padding: 8px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.zoom-level:hover {
    background: rgba(255, 255, 255, 0.2);
}

.zoom-level.active {
    background: var(--accent);
    font-weight: bold;
}

/* ===== IMAGE VIEW ===== */

.image-view {
    display: flex;
    justify-content: center;
    align-items: center;
}

.page-image {
    max-width: 100%;
    height: auto;
    box-shadow: var(--shadow-lg);
    border-radius: 4px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .reader-sidebar {
        width: 150px;
        padding: 15px;
    }

    .reader-content {
        padding: 20px;
    }

    .page-header {
        padding: 20px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .nav-controls {
        flex-wrap: wrap;
    }

    .page-input {
        width: 60px;
    }
}

/* ===== HELP MODAL ===== */

.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.help-modal.hidden {
    display: none;
}

.help-modal-content {
    background: var(--bg);
    padding: 40px;
    border-radius: 8px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    position: relative;
}

.help-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-close:hover {
    color: var(--primary);
}

.help-modal-content h2 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 24px;
}

.help-section {
    margin-bottom: 25px;
}

.help-section h3 {
    color: var(--accent);
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.help-section ul {
    list-style: none;
    padding: 0;
}

.help-section li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 15px;
}

kbd {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 6px;
    font-family: monospace;
    font-weight: bold;
    color: var(--primary);
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

/* ===== BOTTOM MENU ===== */

.bottom-menu {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: white;
    z-index: 50;
    border-top: 1px solid var(--primary);
    border-radius: 8px 8px 0 0;
    max-width: 600px;
    width: 90%;
    max-height: 28px;
    overflow: hidden;
    opacity: 0.1;
    transition: opacity 0.3s ease, max-height 0.3s ease;
    pointer-events: none;
}

.bottom-menu.expanded {
    max-height: 250px;
    opacity: 1;
    pointer-events: auto;
}

.bottom-menu-toggle {
    padding: 3px 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    user-select: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    min-height: 24px;
}

.bottom-menu-toggle:hover {
    background: var(--primary);
}

.bottom-menu-content {
    padding: 8px 12px;
    display: flex;
    gap: 20px;
    font-size: 11px;
    flex-wrap: wrap;
    animation: slideUp 0.2s ease;
}

.bottom-menu-section {
    display: flex;
    gap: 8px;
    align-items: center;
}

.bottom-menu-section strong {
    opacity: 0.9;
}

.bottom-menu-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.bottom-menu-item:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.menu-page-input {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 3px;
    font-size: 11px;
    width: 50px;
    text-align: center;
}

.menu-page-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.menu-page-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.menu-page-display {
    font-size: 10px;
    opacity: 0.8;
}

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.original-content,
.commentary {
    animation: fadeIn 0.3s ease;
}
