﻿/* ═══════════════════════════════════════════════════════
   TRAINING BOOK  ·  Single-Page E-Reader  ·  trainingbook.css
   ═══════════════════════════════════════════════════════ */

:root {
    --ebr-room: #100c06;
    --ebr-room2: #1c1408;
    --ebr-spine-a: #3a2210;
    --ebr-spine-b: #6a4020;
    --ebr-paper: #faf6ec;
    --ebr-text: #1c1408;
    --ebr-text-m: #6a5838;
    --ebr-text-s: #9a8870;
    --ebr-border: #ddd5c2;
    --ebr-gold: #c88828;
    --ebr-gold-l: #e8b050;
    --ebr-green: #3a8858;
    --ebr-font-ui: 'Segoe UI', system-ui, sans-serif;
    --ebr-font-book: Georgia, 'Palatino Linotype', serif;
}

/* ══ ROOM ══ */
.ebr-room {
    min-height: 100vh;
    background: radial-gradient(ellipse 130% 80% at 50% 20%, var(--ebr-room2) 0%, var(--ebr-room) 70%);
    display: flex;
    flex-direction: column;
    font-family: var(--ebr-font-ui);
    color: var(--ebr-text);
    overflow: hidden;
}

/* ══ LOADING ══ */
.ebr-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #8a7050;
}

.ebr-loading-icon {
    font-size: 56px;
    animation: ebr-float 2.2s ease-in-out infinite;
    filter: drop-shadow(0 8px 20px rgba(200,136,40,.25));
}

@keyframes ebr-float {
    0%,100% {
        transform: translateY(0) rotate(-2deg);
    }

    50% {
        transform: translateY(-10px) rotate(2deg);
    }
}

.ebr-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(200,136,40,.15);
    border-top-color: var(--ebr-gold);
    border-radius: 50%;
    animation: ebr-spin .75s linear infinite;
}

@keyframes ebr-spin {
    to {
        transform: rotate(360deg);
    }
}

.ebr-loading p {
    font-size: 13px;
    color: #6a5030;
}

/* ══ EMPTY ══ */
.ebr-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #6a5030;
    text-align: center;
}

.ebr-empty-icon {
    font-size: 58px;
}

.ebr-empty h3 {
    margin: 0;
    color: #c8b080;
}

.ebr-btn-ghost {
    margin-top: 8px;
    background: none;
    border: 1px solid rgba(200,136,40,.4);
    color: var(--ebr-gold);
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all .15s;
}

    .ebr-btn-ghost:hover {
        background: rgba(200,136,40,.1);
    }

/* ══ TOOLBAR ══ */
.ebr-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    background: rgba(0,0,0,.55);
    border-bottom: 1px solid rgba(255,255,255,.04);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    z-index: 10;
}

.ebr-toolbar-back {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 6px;
    cursor: pointer;
    color: #b89870;
    transition: all .15s;
}

    .ebr-toolbar-back:hover {
        background: rgba(255,255,255,.13);
        color: #fff;
    }

.ebr-toolbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 12px;
}

.ebr-toolbar-module {
    color: #5a4828;
}

.ebr-toolbar-sep {
    color: #3a3020;
}

.ebr-toolbar-unit {
    color: #c8b080;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ebr-toolbar-chap {
    color: #5a4828;
    flex-shrink: 0;
}

.ebr-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ebr-toolbar-timer {
    font-size: 11px;
    font-weight: 700;
    color: var(--ebr-gold);
    background: rgba(200,136,40,.12);
    border: 1px solid rgba(200,136,40,.25);
    padding: 2px 7px;
    border-radius: 10px;
}

.ebr-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ebr-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    transition: all .2s;
}

    .ebr-dot.cur {
        background: var(--ebr-gold);
        transform: scale(1.4);
    }

    .ebr-dot.done {
        background: var(--ebr-green);
    }

.ebr-pct {
    font-size: 11px;
    font-weight: 700;
    color: #5a4828;
}

/* ══ STAGE ══ */
.ebr-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: radial-gradient(ellipse 55% 45% at 50% 50%, rgba(200,136,40,.05) 0%, transparent 70%);
}

/* ══ BOOK WRAPPER ══ */
.ebr-book {
    width: min(820px, calc(100vw - 28px));
    height: min(700px, calc(100vh - 115px));
    min-height: 460px;
    position: relative;
    /* 3-katmanlı kitap gölgesi: derinlik + sol cilt gölgesi + ambient */
    box-shadow: -10px 4px 20px rgba(0,0,0,.35), /* sol cilt gölgesi */
    5px 8px 30px rgba(0,0,0,.45), 0 30px 80px rgba(0,0,0,.65), 0 0 60px rgba(200,136,40,.04);
}
    /* Üst kenar ışık yansıması */
    .ebr-book::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.12), rgba(255,255,255,.04));
        pointer-events: none;
        z-index: 5;
    }
    /* Altın yer imi şeridi */
    .ebr-book::after {
        content: '';
        position: absolute;
        top: 0;
        right: 38px;
        width: 13px;
        height: 46px;
        z-index: 6;
        pointer-events: none;
        background: linear-gradient(180deg, var(--ebr-gold) 0%, var(--ebr-gold-l) 100%);
        clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
        box-shadow: 0 6px 18px rgba(200,136,40,.5), 0 2px 4px rgba(0,0,0,.3);
    }

/* ══ TEK SAYFA ══ */
.ebr-page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--ebr-paper);
    /* Satır kağıt dokusu */
    background-image: repeating-linear-gradient( 0deg, transparent, transparent 27px, rgba(0,0,0,.025) 27px, rgba(0,0,0,.025) 28px );
    border-radius: 2px 10px 10px 2px;
    /* Sol cilt kenarı */
    border-left: 5px solid var(--ebr-spine-b);
    /* İç cilt gölgesi */
    box-shadow: inset 12px 0 24px rgba(0,0,0,.1);
    position: relative;
    overflow: hidden;
}

/* ══ ÇALIŞAN BAŞLIK (running header - gerçek kitap stili) ══ */
.ebr-running-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
    padding: 10px 32px 9px;
    border-bottom: 1px solid var(--ebr-border);
    background: rgba(255,255,255,.4);
}

.ebr-rh-left {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--ebr-text-s);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 35%;
}

.ebr-rh-center {
    font-size: 9px;
    color: var(--ebr-border);
    letter-spacing: .3em;
    flex-shrink: 0;
}

.ebr-rh-right {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(200,136,40,.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
    text-align: right;
}

/* ══ KAYDIRILAN İÇERİK ALANI ══ */
.ebr-page-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 48px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(160,120,60,.25) transparent;
}

    .ebr-page-scroll::-webkit-scrollbar {
        width: 4px;
    }

    .ebr-page-scroll::-webkit-scrollbar-thumb {
        background: rgba(160,120,60,.25);
        border-radius: 4px;
    }

/* ══ İÇERİK KARTI + SAYFA ÇEVİRME ANİMASYONU ══ */
.ebr-content.flip-r {
    animation: ebrFlipR .44s cubic-bezier(.25,.46,.45,.94) both;
}

.ebr-content.flip-l {
    animation: ebrFlipL .44s cubic-bezier(.25,.46,.45,.94) both;
}

@keyframes ebrFlipR {
    0% {
        opacity: 0;
        transform: perspective(1000px) rotateY(-20deg) translateX(55px);
        box-shadow: -20px 0 35px rgba(0,0,0,.16);
        filter: blur(1.5px);
    }

    100% {
        opacity: 1;
        transform: perspective(1000px) rotateY(0) translateX(0);
        box-shadow: none;
        filter: blur(0);
    }
}

@keyframes ebrFlipL {
    0% {
        opacity: 0;
        transform: perspective(1000px) rotateY(20deg) translateX(-55px);
        box-shadow: 20px 0 35px rgba(0,0,0,.16);
        filter: blur(1.5px);
    }

    100% {
        opacity: 1;
        transform: perspective(1000px) rotateY(0) translateX(0);
        box-shadow: none;
        filter: blur(0);
    }
}

/* ── İçerik başlık elemanları ── */
.ebr-content-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--ebr-gold);
    margin-bottom: 7px;
}

.ebr-content-dur {
    background: rgba(200,136,40,.1);
    color: var(--ebr-gold);
    padding: 2px 7px;
    border-radius: 8px;
    font-size: 10px;
}

.ebr-content-h2 {
    margin: 0 0 12px;
    font-family: var(--ebr-font-book);
    font-size: 24px;
    font-weight: 700;
    color: var(--ebr-text);
    line-height: 1.25;
}

.ebr-content-rule {
    height: 1px;
    margin-bottom: 16px;
    background: linear-gradient(90deg, var(--ebr-gold) 40px, var(--ebr-border) 40px);
}

/* ── Timer bandı ── */
.ebr-timer-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    background: rgba(200,136,40,.06);
    border: 1px solid rgba(200,136,40,.2);
    border-radius: 6px;
    padding: 7px 11px;
    margin-bottom: 14px;
    font-size: 11.5px;
    color: #9a6820;
}

    .ebr-timer-bar strong {
        color: var(--ebr-gold);
        font-size: 13px;
        font-weight: 700;
    }

.ebr-timer-track {
    flex: 1;
    min-width: 60px;
    height: 3px;
    background: rgba(200,136,40,.15);
    border-radius: 3px;
    overflow: hidden;
}

.ebr-timer-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ebr-gold), var(--ebr-gold-l));
    animation: ebrTimerShrink linear forwards;
}

@keyframes ebrTimerShrink {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

/* ── Kitap tipografisi ── */
.ebr-html {
    font-family: var(--ebr-font-book);
    font-size: 16px;
    line-height: 1.88;
    color: var(--ebr-text);
}

    .ebr-html p {
        margin: 0 0 1.1em;
        text-align: justify;
        hyphens: auto;
    }

    .ebr-html h1,
    .ebr-html h2,
    .ebr-html h3 {
        font-family: var(--ebr-font-book);
        color: var(--ebr-text);
        margin: 1.4em 0 .4em;
    }

    .ebr-html a {
        color: var(--ebr-gold);
    }

    .ebr-html blockquote {
        border-left: 3px solid var(--ebr-gold);
        margin: 1.2em 0;
        padding: 10px 16px;
        background: rgba(200,136,40,.04);
        font-style: italic;
        color: var(--ebr-text-m);
        border-radius: 0 6px 6px 0;
    }

    .ebr-html ul,
    .ebr-html ol {
        padding-left: 1.5em;
        margin: 0 0 1.1em;
    }

    .ebr-html li {
        margin-bottom: .4em;
    }

    .ebr-html img {
        max-width: 100%;
        border-radius: 5px;
    }

    .ebr-html table {
        width: 100%;
        border-collapse: collapse;
        font-size: 14px;
        margin-bottom: 1em;
    }

    .ebr-html th,
    .ebr-html td {
        border: 1px solid var(--ebr-border);
        padding: 7px 10px;
    }

    .ebr-html th {
        background: rgba(200,136,40,.06);
        font-weight: 600;
    }

    .ebr-html strong {
        color: #0f0802;
    }

/* ── Medya ── */
.ebr-pdf-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ebr-pdf-frame {
    width: 100%;
    height: 520px;
    border: 1px solid var(--ebr-border);
    border-radius: 6px;
}

.ebr-pdf-link {
    font-size: 12px;
    color: var(--ebr-gold);
    text-decoration: none;
    align-self: flex-start;
    border: 1px solid rgba(200,136,40,.3);
    padding: 4px 12px;
    border-radius: 5px;
    transition: all .15s;
}

    .ebr-pdf-link:hover {
        background: rgba(200,136,40,.08);
    }

.ebr-video-wrap {
    margin-bottom: 12px;
}

    .ebr-video-wrap.ebr-mt {
        margin-top: 20px;
    }

.ebr-video {
    width: 100%;
    border-radius: 6px;
    background: #000;
}

.ebr-media-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ebr-text-s);
    margin-bottom: 6px;
}

.ebr-audio-wrap {
    margin-top: 14px;
}

.ebr-audio {
    width: 100%;
}

/* ══ SAYFA ALT NAVİGASYONU (sayfanın içinde) ══ */
.ebr-page-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* eşit 3 sütun → mükemmel hizalama */
    align-items: center;
    flex-shrink: 0;
    padding: 10px 32px 10px;
    border-top: 1px solid var(--ebr-border);
    background: linear-gradient(0deg, rgba(200,136,40,.015), transparent);
}

.ebr-pnav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1.5px solid var(--ebr-border);
    border-radius: 7px;
    padding: 7px 16px;
    cursor: pointer;
    color: var(--ebr-text-m);
    font-size: 13px;
    font-weight: 600;
    transition: all .18s;
    font-family: var(--ebr-font-ui);
    white-space: nowrap;
}

    .ebr-pnav-btn:hover:not([disabled]) {
        border-color: var(--ebr-gold);
        color: var(--ebr-gold);
        background: rgba(200,136,40,.05);
    }

    .ebr-pnav-btn[disabled] {
        opacity: .3;
        cursor: not-allowed;
    }

.ebr-pnav-prev {
    justify-self: start;
}

.ebr-pnav-pos {
    justify-self: center;
    font-size: 12px;
    font-style: italic;
    color: var(--ebr-text-s);
    font-variant-numeric: tabular-nums;
}

.ebr-pnav-next {
    justify-self: end;
}

.ebr-pnav-complete {
    justify-self: end;
    border-color: rgba(58,136,88,.4);
    color: var(--ebr-green);
}

    .ebr-pnav-complete:hover:not([disabled]) {
        border-color: var(--ebr-green);
        background: rgba(58,136,88,.06);
    }

/* ══ SAYFA NUMARASI ══ */
.ebr-pagenum {
    text-align: center;
    flex-shrink: 0;
    font-size: 11px;
    font-style: italic;
    color: var(--ebr-text-s);
    padding: 5px 32px 9px;
}

/* ══ KÖŞE KIVRIMLARI (dekoratif) ══ */
.ebr-fold {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    overflow: hidden;
    pointer-events: none;
}

    .ebr-fold::before {
        content: '';
        position: absolute;
        bottom: 0;
        right: 0;
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 0 0 28px 28px;
        border-color: transparent transparent #d4ccba transparent;
    }

    .ebr-fold::after {
        content: '';
        position: absolute;
        bottom: 0;
        right: 0;
        width: 28px;
        height: 28px;
        background: linear-gradient(225deg, rgba(0,0,0,.12) 0%, transparent 60%);
    }

/* ══ TAMAMLANMA FLASH ══ */
.ebr-complete-flash {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
    animation: ebrFlashBg .9s ease forwards;
}

@keyframes ebrFlashBg {
    0%,100% {
        background: rgba(40,100,60,0);
    }

    25%,75% {
        background: rgba(40,100,60,.15);
    }
}

.ebr-complete-flash-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(10,26,16,.93);
    border: 1px solid rgba(58,136,88,.5);
    border-radius: 14px;
    padding: 24px 40px;
    box-shadow: 0 8px 40px rgba(0,0,0,.55), 0 0 28px rgba(58,136,88,.12);
    animation: ebrFlashCard .9s cubic-bezier(.34,1.2,.64,1) forwards;
}

@keyframes ebrFlashCard {
    0% {
        transform: scale(.6);
        opacity: 0;
    }

    30% {
        transform: scale(1.04);
        opacity: 1;
    }

    55% {
        transform: scale(1.0);
    }

    78% {
        opacity: 1;
    }

    100% {
        transform: scale(.92);
        opacity: 0;
    }
}

.ebr-complete-flash-icon {
    font-size: 44px;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(58,200,100,.45));
    animation: ebrCheckPop .36s cubic-bezier(.34,1.56,.64,1) .08s both;
}

@keyframes ebrCheckPop {
    0% {
        transform: scale(0) rotate(-15deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

.ebr-complete-flash-text {
    font-size: 15px;
    font-weight: 700;
    color: #7acf9a;
    letter-spacing: .04em;
}

.ebr-complete-flash-sub {
    font-size: 11px;
    color: rgba(122,207,154,.55);
    text-align: center;
}

/* ══ RESPONSIVE ══ */
@media (max-width: 640px) {
    .ebr-stage {
        padding: 10px 6px;
    }

    .ebr-page-scroll {
        padding: 16px 22px 12px;
    }

    .ebr-page-nav {
        padding: 8px 18px;
    }

    .ebr-content-h2 {
        font-size: 20px;
    }

    .ebr-html {
        font-size: 14.5px;
        line-height: 1.78;
    }

    .ebr-toolbar-center {
        font-size: 11px;
    }

    .ebr-toolbar-chap {
        display: none;
    }

    .ebr-pnav-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .ebr-page-scroll {
        padding: 12px 16px 8px;
    }

    .ebr-running-head {
        padding: 8px 16px;
    }
}
