/* --- Variables & Themes --- */
:root {
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --border: #e5e7eb;
    --red: #ef4444;
    --nav-bg: #ffffff;
    --overlay: rgba(0,0,0,0.6);
    --success: #10b981;
}

[data-theme="dark"] {
    --bg-color: #111827;
    --card-bg: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border: #374151;
    --nav-bg: #1f2937;
    --overlay: rgba(0,0,0,0.8);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg-color); color: var(--text-primary); transition: background 0.3s; overflow-x: hidden; }

/* --- Header & Brand --- */
header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: var(--card-bg); box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100; }
.brand-container { display: flex; flex-direction: column; }
.logo { font-size: 1.1rem; color: var(--primary); display: flex; align-items: center; gap: 8px; line-height: 1.2; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.profile-icon img { width: 38px; height: 38px; border-radius: 50%; cursor: pointer; border: 2px solid var(--primary); }

/* --- Page Floating Bar (New) --- */
.page-floating-bar { position: fixed; top: 80px; right: 15px; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(5px); padding: 8px 12px; border-radius: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 6px; z-index: 90; border: 1px solid var(--border); }
[data-theme="dark"] .page-floating-bar { background: rgba(31, 41, 55, 0.95); }
.page-text { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.page-input { width: 45px; text-align: center; border: 1px solid var(--border); border-radius: 6px; padding: 4px; font-weight: 700; font-family: 'Poppins', sans-serif; outline: none; background: var(--bg-color); color: var(--text-primary); }
.page-input:focus { border-color: var(--primary); }
.total-pages { font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; }
.go-btn { background: var(--primary); color: white; border: none; padding: 5px 12px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; font-family: 'Poppins', sans-serif; }
.go-btn:active { transform: scale(0.9); }
.load-prev { display: none; text-align: center; color: var(--primary); font-weight: 600; padding: 15px; background: var(--card-bg); border-radius: 8px; margin-bottom: 15px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

/* --- Layout --- */
main { padding: 1rem; padding-top: 0.5rem; padding-bottom: 90px; min-height: 100vh; position: relative; }
.screen { display: none; animation: fadeIn 0.3s ease-in-out; }
.screen.active { display: block; }
.empty-state { text-align: center; color: var(--text-secondary); margin-top: 5rem; }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.8; }

/* --- E-Book PDF Viewer Styling --- */
.pdf-container { display: flex; flex-direction: column; align-items: center; width: 100%; gap: 15px; }
.pdf-container canvas { max-width: 100%; height: auto !important; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.08); background-color: white; }

/* Scroll Loader */
.scroll-loader { text-align: center; padding: 25px 0; color: var(--primary); font-size: 1.1rem; font-weight: 600; display: flex; justify-content: center; align-items: center; gap: 10px; font-family: 'Poppins', sans-serif; }
.scroll-loader i { font-size: 1.4rem; }

/* --- Forms & Inputs (For Profile) --- */
.input-group { margin-bottom: 1.2rem; text-align: left; }
.input-group label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.premium-input { width: 100%; padding: 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg-color); color: var(--text-primary); font-size: 1rem; outline: none; transition: 0.3s; }
.premium-input:focus { border-color: var(--primary); background: var(--card-bg); box-shadow: 0 4px 10px rgba(79, 70, 229, 0.1); }

.primary-btn { width: 100%; padding: 15px; background: var(--primary); color: #fff; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: 0.2s; }
.primary-btn:active { background: var(--primary-hover); transform: scale(0.98); }

/* --- Bottom Nav --- */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--nav-bg); display: flex; justify-content: space-around; align-items: center; padding: 10px 0; box-shadow: 0 -2px 15px rgba(0,0,0,0.05); border-top: 1px solid var(--border); z-index: 100; transition: transform 0.3s; }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-secondary); cursor: pointer; font-size: 0.8rem; font-weight: 500; width: 60px; transition: color 0.2s; }
.nav-item i { font-size: 1.3rem; margin-bottom: 2px; }
.nav-item.active { color: var(--primary); }

/* --- Professional Share Button --- */
.add-btn { position: relative; top: -22px; }
.plus-icon { width: 60px; height: 60px; background: linear-gradient(135deg, #4f46e5, #4338ca); border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; font-size: 1.6rem; box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4); border: 4px solid var(--nav-bg); transition: transform 0.2s, box-shadow 0.2s; }
.plus-icon:active { transform: scale(0.92); box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3); }
.plus-icon i { margin-bottom: 0; }

/* --- STRICT MODALS (POPUPS) --- */
.sm-modal { display: none !important; position: fixed !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; background: var(--overlay) !important; z-index: 9999 !important; justify-content: center !important; align-items: center !important; padding: 20px !important; }
.sm-modal.active { display: flex !important; animation: fadeIn 0.2s; }
.sm-modal-content { background: var(--card-bg); width: 100%; max-width: 350px; border-radius: 20px; padding: 25px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); transform: scale(0.9); transition: transform 0.2s; text-align: center; }
.sm-modal.active .sm-modal-content { transform: scale(1); }

.sm-modal-content h3 { font-size: 1.3rem; margin-bottom: 10px; color: var(--text-primary); }
.sm-modal-content p { color: var(--text-secondary); margin-bottom: 20px; font-size: 0.95rem; line-height: 1.5; }

.modal-buttons { display: flex; gap: 10px; }
.modal-buttons button { flex: 1; padding: 12px; border-radius: 10px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-secondary { background: var(--border); color: var(--text-primary); border: none; }
.btn-secondary:active { background: #d1d5db; }
.share-icon { font-size: 3rem; color: var(--primary); margin-bottom: 15px; }

/* --- Profile (Slide Up) --- */
.slide-up { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: var(--bg-color); z-index: 200; overflow-y: auto; padding: 1rem; transform: translateY(100%); transition: transform 0.3s ease-in-out; }
.slide-up.active { transform: translateY(0); display: block; }
.profile-header { display: flex; align-items: center; gap: 15px; margin-bottom: 2rem; }
.back-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-primary); cursor: pointer; }
.profile-info { text-align: center; margin-bottom: 2rem; }
.profile-info img { width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--primary); margin-bottom: 15px; }

.settings-list { list-style: none; background: var(--card-bg); border-radius: 16px; overflow: hidden; border: 1px solid var(--border); }
.settings-list li { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 500; cursor: pointer; }
.settings-list li:last-child { border-bottom: none; }
.settings-list li i { width: 25px; color: var(--primary); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(18px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

.app-footer { text-align: center; margin-top: 3rem; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; padding-bottom: 2rem; }

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