/* ============================================
   Merkezi Sunum — Ortak Yapısal Stiller
   ============================================ */

:root {
    /* Sidebar — varsayılan, theme.css override edebilir */
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #c4c4d4;
    --sidebar-heading: #eeeef5;
    --sidebar-accent: #e2a84b;
    --sidebar-hover: rgba(226, 168, 75, 0.1);
    --sidebar-active: rgba(226, 168, 75, 0.18);
    --sidebar-width: 280px;

    /* Content */
    --content-bg: #faf8f4;
    --content-surface: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #8a8a9a;
    --accent: #c17d2a;
    --accent-light: #f5e6cc;
    --accent-glow: rgba(226, 168, 75, 0.15);

    /* Code */
    --code-bg: #1e1e2e;
    --code-text: #cdd6f4;
    --code-keyword: #cba6f7;
    --code-string: #a6e3a1;
    --code-number: #fab387;
    --code-comment: #6c7086;
    --code-function: #89b4fa;
    --code-type: #f9e2af;
    --code-operator: #89dceb;

    /* Misc */
    --border-subtle: rgba(26, 26, 46, 0.08);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
    --radius: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Source Sans 3', -apple-system, sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* ── Sidebar (always overlay) ── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
}
.sidebar.open { transform: translateX(0); }
.sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(226,168,75,0.2), transparent);
}

.sidebar-header {
    padding: 2rem 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.book-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--sidebar-accent), #d4943a);
    color: var(--sidebar-bg);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}
.sidebar-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--sidebar-heading);
    line-height: 1.2;
}
.sidebar-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.nav-topic { padding: 0 1rem; margin-bottom: 0.5rem; }
.nav-topic-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sidebar-accent);
    padding: 0.5rem 0.5rem 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}
.nav-topic-title::before {
    content: '';
    width: 8px; height: 2px;
    background: var(--sidebar-accent);
    border-radius: 1px;
    flex-shrink: 0;
}
.nav-slide-list { list-style: none; }
.nav-slide-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.5rem 0.5rem 1.2rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.82rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    line-height: 1.35;
    position: relative;
}
.nav-slide-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-heading);
}
.nav-slide-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-accent);
    font-weight: 600;
}
.nav-slide-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--sidebar-accent);
    border-radius: 0 2px 2px 0;
}
.nav-slide-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
    min-width: 1.4em;
    text-align: right;
    opacity: 0.6;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.presenter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--sidebar-text);
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.presenter-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--sidebar-heading);
    border-color: rgba(255,255,255,0.15);
}
/* Sync panel */
.sync-panel {
    margin-top: 0.6rem;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
}
.sync-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.75rem;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: background 0.15s;
}
.sync-panel-header:hover { background: rgba(255,255,255,0.04); }
.sync-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-left: auto;
    background: #555;
    transition: background 0.3s;
}
.sync-status-dot.connected { background: #6bbd66; }
.sync-panel-body {
    padding: 0.5rem 0.7rem 0.6rem;
    border-top: 1px solid rgba(255,255,255,0.04);
}
.sync-input-row {
    display: flex;
    gap: 0.4rem;
}
.sync-input {
    flex: 1;
    padding: 0.35rem 0.5rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: var(--sidebar-heading);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    outline: none;
}
.sync-input:focus { border-color: var(--sidebar-accent); }
.sync-input::placeholder { color: rgba(255,255,255,0.25); }
.sync-save-btn {
    padding: 0.35rem 0.6rem;
    background: var(--sidebar-accent);
    border: none;
    border-radius: 4px;
    color: var(--sidebar-bg);
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.sync-save-btn:hover { opacity: 0.85; }
.sync-info {
    font-size: 0.65rem;
    color: var(--sidebar-text);
    margin-top: 0.4rem;
    opacity: 0.7;
    line-height: 1.4;
}

.home-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.8rem;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
    margin-top: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}
.home-btn:hover { color: var(--sidebar-heading); background: rgba(255,255,255,0.04); }
.sidebar-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.8rem;
    text-align: center;
    opacity: 0.6;
}

/* ── Sidebar Toggle ── */
.sidebar-toggle {
    display: flex;
    position: fixed;
    top: 1rem; left: 1rem;
    z-index: 200;
    width: 40px; height: 40px;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: var(--shadow-md);
    transition: opacity 0.2s ease;
}
.sidebar-toggle:hover { opacity: 0.85; }
.sidebar-toggle span {
    display: block;
    width: 18px; height: 2px;
    background: var(--sidebar-heading);
    border-radius: 1px;
    transition: all 0.2s ease;
}
.sidebar.open ~ .sidebar-toggle { opacity: 0; pointer-events: none; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 140;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Main Content ── */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.slide-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem 3rem 2rem 4rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.1) transparent;
}
.slide-container::-webkit-scrollbar { width: 6px; }
.slide-container::-webkit-scrollbar-track { background: transparent; }
.slide-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }

/* ── Slide ── */
.slide {
    max-width: 920px;
    width: 100%;
    margin: 0 auto;
    animation: slideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    min-height: calc(100vh - 8rem);
    display: flex;
    flex-direction: column;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Slide Content — Ortak Sunum Tipografisi ── */
/* Theme'ler override edebilir, ama varsayılan olarak
   tüm slaytlar bu boyut/boşluk kurallarını kullanır */

.slide-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.slide-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.4rem;
    display: block;
}
.slide-title, .slide h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.slide-body {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-secondary);
    flex: 1;
}
/* .si wrapper (SA gibi slide-header/body kullanmayan içerikler) */
.slide > .si {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-secondary);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 1rem 0;
}
.slide-body h3, .slide h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1.5rem 0 0.6rem;
}
.slide-body h3:first-child, .slide h3:first-child { margin-top: 0; }
.slide-body p, .slide .si > p {
    margin-bottom: 0.8rem;
}
.slide-body ul, .slide-body ol {
    margin: 0.5rem 0 1rem 1.5rem;
}
.slide-body li {
    margin-bottom: 0.4rem;
    padding-left: 0.3rem;
}
.slide-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Cover slide — ortak merkezi düzen */
.slide-cover, .slide.cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: calc(100vh - 10rem);
    position: relative;
}
.slide.cover > .si {
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* ── Highlight Box (tüm dersler) ── */
.highlight-box {
    background: var(--accent-glow);
    border-left: 3px solid var(--accent);
    padding: 0.8rem 1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.92rem;
    margin: 1rem 0;
}
.highlight-box.info {
    background: rgba(137, 180, 250, 0.08);
    border-left-color: #5b8fd4;
}
.highlight-box.warning {
    background: rgba(250, 179, 135, 0.08);
    border-left-color: #e8845a;
}
.highlight-box.success {
    background: rgba(166, 227, 161, 0.08);
    border-left-color: #6bbd66;
}

/* ── Code Blocks (tüm dersler) ── */
.code-block {
    background: var(--code-bg);
    border-radius: var(--radius);
    margin: 1rem 0;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.code-lang {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--code-comment);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.code-copy {
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--code-comment);
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}
.code-copy:hover {
    border-color: rgba(255,255,255,0.25);
    color: var(--code-text);
}
.code-content,
.code-block pre {
    padding: 1rem 1.2rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--code-text);
    white-space: pre;
    margin: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.code-block pre code {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
    padding: 0;
    border-radius: 0;
}
.code-content::-webkit-scrollbar { height: 4px; }
.code-content::-webkit-scrollbar-track { background: transparent; }
.code-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Syntax Highlighting */
.kw { color: var(--code-keyword); font-weight: 500; }
.str { color: var(--code-string); }
.num { color: var(--code-number); }
.cm { color: var(--code-comment); font-style: italic; }
.fn { color: var(--code-function); }
.ty { color: var(--code-type); }
.op { color: var(--code-operator); }

/* Inline Code */
.slide code, .slide-body code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background: rgba(26, 26, 46, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--accent);
}

/* ── Dinamik Ölçekleme ── */
/* !important kullanılıyor çünkü theme CSS'leri sonra yükleniyor ve
   aynı specificity'de theme'in kuralları kazanıyor. Scale engine'in
   son sözü olmalı. */

/* İçerik azsa: büyük font, geniş boşluklar, dikey ortala */
.slide.scale-spacious {
    font-size: 1.2rem !important;
    line-height: 1.9 !important;
    justify-content: center;
}
.slide.scale-spacious > .si,
.slide.scale-spacious > .slide-body {
    justify-content: center;
    gap: 1rem;
}
.slide.scale-spacious h2 {
    font-size: clamp(2.2rem, 4.5vw, 3.2rem) !important;
    margin-bottom: 0.8rem !important;
}
.slide.scale-spacious h3 {
    font-size: 1.4rem !important;
    margin: 2rem 0 1rem !important;
}
.slide.scale-spacious p {
    margin-bottom: 1.2rem !important;
    font-size: 1.15rem !important;
}
.slide.scale-spacious li {
    margin-bottom: 0.8rem !important;
    font-size: 1.1rem !important;
}
.slide.scale-spacious .card,
.slide.scale-spacious .kp,
.slide.scale-spacious .highlight-box,
.slide.scale-spacious .index-type-card {
    padding: 1.3rem 1.6rem !important;
    font-size: 1.05rem !important;
}
.slide.scale-spacious .cols,
.slide.scale-spacious .cols3,
.slide.scale-spacious .two-col,
.slide.scale-spacious .comparison-grid,
.slide.scale-spacious .index-type-grid {
    gap: 1.8rem !important;
}
.slide.scale-spacious .sub {
    font-size: 1.2rem !important;
}
.slide.scale-spacious .badge {
    font-size: 0.72rem !important;
    padding: 0.25rem 0.7rem !important;
}
.slide.scale-spacious .fl li {
    font-size: 1.05rem !important;
    padding: 0.45rem 0 !important;
}
.slide.scale-spacious .slide-header {
    margin-bottom: 2.5rem !important;
    padding-bottom: 1.5rem !important;
}

/* İçerik normalse */
.slide.scale-normal {
    font-size: 1.05rem;
    line-height: 1.75;
}

/* İçerik çoksa: sıkıştır */
.slide.scale-compact {
    font-size: 0.92rem !important;
    line-height: 1.55 !important;
}
.slide.scale-compact h2 {
    font-size: clamp(1.4rem, 2.5vw, 1.8rem) !important;
}
.slide.scale-compact h3 {
    font-size: 1rem !important;
    margin: 0.8rem 0 0.3rem !important;
}
.slide.scale-compact p {
    margin-bottom: 0.4rem !important;
}
.slide.scale-compact li {
    margin-bottom: 0.2rem !important;
}
.slide.scale-compact .slide-header {
    margin-bottom: 0.8rem !important;
    padding-bottom: 0.5rem !important;
}

/* ── Bottom Bar ── */
.bottom-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.8rem 2rem;
    background: var(--content-surface);
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.02);
}
.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.nav-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
.nav-btn:disabled { opacity: 0.3; cursor: default; }

.progress-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.page-indicator {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 50px;
    text-align: center;
}
.page-sep { margin: 0 0.15rem; opacity: 0.4; }
.progress-track {
    flex: 1;
    height: 3px;
    background: rgba(26,26,46,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #d4943a);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Landing Page ── */
.landing-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem;
}
.landing-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.landing-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--text-primary);
}
.landing-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 300;
}
.landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
    max-width: 900px;
    margin: 0 auto;
}
.landing-card {
    background: var(--content-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.8rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}
.landing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}
.landing-card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--sidebar-accent), #d4943a);
    color: var(--sidebar-bg);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}
.landing-card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.landing-card-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
    line-height: 1.5;
}
.landing-card-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .slide-container { padding: 2rem 1.5rem; }
    .bottom-bar { padding: 0.8rem 1rem; }
}
@media (max-width: 600px) {
    .slide-container { padding: 1.5rem 1rem; }
    .landing-grid { grid-template-columns: 1fr; }
}

/* ── Print ── */
@media print {
    .sidebar, .bottom-bar, .sidebar-toggle, .landing-page { display: none !important; }
    .content { margin: 0; }
    .slide-container { padding: 1rem; overflow: visible; }
    .slide { page-break-after: always; }
}
