/* ===========================
   ShortNovel Reader - reader.css
   Chapter reading page styles
   =========================== */

/* === Reader Body === */
.sn-reader-body {
    font-family: 'Droid Sans', Noto, 'PingFang SC', sans-serif;
    background: #F5F0E8;
    color: #1a1a1a;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* === Top Bar === */
.sn-reader-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 12px;
    background: #fff;
    color: #333;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.sn-reader-topbar.hidden {
    transform: translateY(-100%);
}

.sn-reader-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #333;
    flex-shrink: 0;
}

.sn-reader-title {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

.sn-reader-topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.sn-reader-follow-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s;
}

.sn-reader-follow-btn.active {
    color: #fbbf24;
}

.sn-reader-follow-btn:active {
    transform: scale(0.9);
}

.sn-reader-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

/* === Reading Content === */
.sn-reader-content {
    padding: 60px 20px 80px;
    max-width: 720px;
    margin: 0 auto;
    min-height: 100vh;
}

.sn-reader-chapter-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    line-height: 1.4;
    color: inherit;
}

.sn-reader-text {
    font-size: 18px;
    line-height: 2;
    letter-spacing: 0.3px;
    word-break: break-all;
    color: inherit;
}

.sn-reader-text p {
    margin-bottom: 1em;
    text-indent: 2em;
}

.sn-reader-text h2 {
    font-size: 1em;
    font-weight: normal;
    text-indent: 2em;
}

.sn-reader-text img {
    max-width: 100%;
    height: auto;
    margin: 12px auto;
    display: block;
}

.sn-reader-text .no-content {
    text-align: center;
    color: #999;
    padding: 60px 0;
}

/* === End Section === */
.sn-reader-end {
    text-align: center;
    padding: 32px 0 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 32px;
}

.sn-reader-next-btn {
    display: inline-block;
    padding: 12px 48px;
    background: #FF6B6B;
    color: #fff;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
    transition: background 0.2s;
}

.sn-reader-next-btn:active {
    background: #E85D5D;
}

.sn-reader-end-text {
    display: inline-block;
    padding: 12px 0;
    color: #999;
    font-size: 14px;
}

/* === Paywall === */
.sn-reader-paywall {
    text-align: center;
    padding: 32px 20px;
    margin-top: 24px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
}

.sn-reader-paywall p {
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
    text-indent: 0;
}

.sn-reader-balance {
    font-size: 13px !important;
    color: #999 !important;
}

.sn-reader-paywall-actions {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sn-auto-pay {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.sn-auto-pay input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #FF6B6B;
}

.sn-btn-pay {
    display: inline-block;
    padding: 12px 48px;
    background: #FF6B6B;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.sn-btn-pay:active {
    background: #E85D5D;
}

.sn-btn-pay.recharge {
    background: #f59e0b;
}

.sn-btn-pay.recharge:active {
    background: #d97706;
}

/* === Bottom Bar === */
.sn-reader-bottombar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 56px;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.sn-reader-bottombar.hidden {
    transform: translateY(100%);
}

.sn-reader-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 12px;
    color: #333;
    font-size: 11px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

.sn-reader-nav-btn:active {
    opacity: 0.7;
}

.sn-reader-nav-btn.disabled {
    color: #666;
    cursor: default;
    pointer-events: none;
}

.sn-reader-nav-btn svg {
    flex-shrink: 0;
}

/* === TOC Modal === */
.sn-reader-toc-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
}

.sn-reader-toc-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    touch-action: none;
}

.sn-reader-toc-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: #fff;
    border-radius: 0 16px 16px 0;
    display: flex;
    flex-direction: column;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.sn-reader-toc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.sn-reader-toc-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.sn-reader-toc-header span {
    flex: 1;
    font-size: 13px;
    color: #999;
}

.sn-reader-toc-header button {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

/* TOC pagination tabs */
.sn-reader-toc-tabs {
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    display: none;
}

.sn-reader-toc-tabs::-webkit-scrollbar { display: none; }

.sn-reader-toc-tabs.has-tabs {
    display: flex;
    gap: 8px;
}

.sn-reader-toc-tabs .sn-toc-tab-btn {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    background: #f3f4f6;
    color: #666;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.sn-reader-toc-tabs .sn-toc-tab-btn.active {
    background: #FF6B6B;
    color: #fff;
}

.sn-reader-toc-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 8px 0;
}

.sn-reader-toc-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
    text-decoration: none;
    white-space: nowrap;
}

.sn-reader-toc-list a:active {
    background: #f5f5f5;
}

.sn-reader-toc-list a .sn-chapter-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sn-reader-toc-list a .sn-chapter-status {
    font-size: 11px;
    color: #999;
    flex-shrink: 0;
    margin-left: 12px;
}

.sn-reader-toc-list a.current {
    color: #FF6B6B;
    font-weight: 600;
}

/* === Settings Modal === */
.sn-reader-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
}

.sn-reader-settings-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    touch-action: none;
}

.sn-reader-settings-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    animation: slideUpSettings 0.3s ease;
}

@keyframes slideUpSettings {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.sn-setting-group {
    margin-bottom: 20px;
}

.sn-setting-group:last-child {
    margin-bottom: 0;
}

.sn-setting-group label {
    display: block;
    font-size: 13px;
    color: #999;
    margin-bottom: 10px;
}

.sn-setting-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sn-setting-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f3f4f6;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    transition: background 0.15s;
}

.sn-setting-btn:active {
    background: #e5e7eb;
}

.sn-setting-control input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    outline: none;
}

.sn-setting-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FF6B6B;
    cursor: pointer;
}

/* === Theme Dots === */
.sn-setting-themes {
    display: flex;
    gap: 16px;
}

.sn-theme-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sn-theme-dot.active {
    border-color: #FF6B6B !important;
}

/* === Page Mode Buttons === */
.sn-setting-modes {
    display: flex;
    gap: 8px;
}

.sn-mode-btn {
    flex: 1;
    padding: 8px 0;
    text-align: center;
    font-size: 13px;
    color: #666;
    background: #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.sn-mode-btn.active {
    background: #FF6B6B;
    color: #fff;
}

/* === Theme Overrides (applied to body) === */
.sn-reader-body[data-theme="dark"] {
    background: #1A1A2E;
    color: #ccc;
}

.sn-reader-body[data-theme="dark"] .sn-reader-paywall {
    background: rgba(255, 255, 255, 0.05);
}

.sn-reader-body[data-theme="dark"] .sn-reader-end {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* === Ad Styles === */
.sn-reader-content ins,
.sn-reader-content iframe {
    max-width: 100%;
}
