* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

body {
    background: linear-gradient(135deg, #d30088 0%, #6100cc 100%);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Üst Bar */
.top-bar {
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    padding: 8px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}
.top-left { display: flex; gap: 16px; align-items: center; font-size: 13px; }
.top-left .campaign-name { color: #f2f2f2; font-weight: 600; }
.top-left .page-counter { color: #ccc; }
.top-right { display: flex; gap: 8px; align-items: center; }

.top-btn {
    color: #fff;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    transition: background 0.2s;
}
.site-btn { background: #c91818; }
.site-btn:hover { background: #e62117; }
.ig-btn { background: rgba(255, 255, 255, 0.2); }
.ig-btn:hover { background: rgba(255, 255, 255, 0.35); }

/* İşaretlenen Kırmızı Alandaki Not Ekle Butonu */
.top-note-btn {
    background: #4caf50;
    color: #ffffff;
    border: none;
    height: 30px;
    width: 34px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}
.top-note-btn:hover {
    background: #43a047;
    transform: scale(1.08);
}

.search-btn { 
    background: transparent; 
    border: none; 
    color: #fff; 
    font-size: 16px; 
    cursor: pointer; 
    padding: 4px 8px; 
}

/* Ana Sahne */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0 40px;
    height: calc(100vh - 105px);
    overflow: hidden;
    cursor: default;
}

.main-wrapper.is-zoomed { cursor: grab; }
.main-wrapper.is-grabbing { cursor: grabbing; }

.catalog-stage {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    perspective: 2500px;
}

/* Kitap Konteyneri */
.book-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 94%;
    max-height: 880px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    background: transparent;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

/* KAPAK MODU (Sayfa 1): Ekranın Tam Ortasında */
.book-container.is-single-cover .left-slot {
    display: none !important;
}
.book-container.is-single-cover .right-slot {
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border-radius: 4px;
}

/* ÇİFT SAYFA MODU */
.book-container.is-double-page .left-slot {
    display: flex;
    border-right: 1px solid rgba(0,0,0,0.15);
}
.book-container.is-double-page .right-slot {
    display: flex;
}

.page-slot {
    position: relative;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent; /* Mobilde ve masaüstünde beyaz boşluk oluşturmaz */
    overflow: hidden;
}

.page-slot img {
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

/* Resim Üzeri Vurgu Kutusu */
.word-highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.search-highlight-box {
    position: absolute;
    background: rgba(255, 235, 59, 0.55);
    border: 2px solid #ff9800;
    border-radius: 4px;
    animation: highlightPulse 2.5s ease-out forwards;
}

@keyframes highlightPulse {
    0% { transform: scale(1.15); opacity: 1; }
    20% { transform: scale(1); opacity: 1; }
    80% { opacity: 0.9; }
    100% { opacity: 0; }
}

/* 3D Yaprak Çevirme Kanadı */
.flipper-leaf {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    transform-style: preserve-3d;
    display: none;
    z-index: 40;
    pointer-events: none;
}

.flipper-leaf.flipping-next {
    right: 0;
    transform-origin: left center;
    animation: flipLeafNext 0.52s cubic-bezier(0.25, 1, 0.35, 1) forwards;
}

.flipper-leaf.flipping-prev {
    left: 0;
    transform-origin: right center;
    animation: flipLeafPrev 0.52s cubic-bezier(0.25, 1, 0.35, 1) forwards;
}

@keyframes flipLeafNext {
    0% { transform: rotateY(0deg); }
    50% { box-shadow: 0 25px 45px rgba(0, 0, 0, 0.4); }
    100% { transform: rotateY(-180deg); }
}

@keyframes flipLeafPrev {
    0% { transform: rotateY(0deg); }
    50% { box-shadow: 0 25px 45px rgba(0, 0, 0, 0.4); }
    100% { transform: rotateY(180deg); }
}

.flipper-front, .flipper-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    overflow: hidden;
    background: #fff;
}

.flipper-front img, .flipper-back img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.flipper-back { transform: rotateY(180deg); }

.leaf-shadow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0) 25%);
    pointer-events: none;
}

/* Kenar Yön Okları */
.edge-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    border: none;
    height: 110px;
    width: 42px;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30;
    transition: all 0.2s;
    border-radius: 8px;
}
.edge-arrow:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-50%) scale(1.05);
}
.prev-arrow { left: 16px; }
.next-arrow { right: 16px; }

/* Sağ Tık Menüsü */
.custom-context-menu {
    position: absolute;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    padding: 6px 0;
    z-index: 300;
    width: 190px;
}
.custom-context-menu.hidden { display: none; }
.custom-context-menu ul { list-style: none; }
.custom-context-menu li {
    padding: 8px 16px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}
.custom-context-menu li:hover { background: #f2f2f2; color: #000; }
.custom-context-menu li i { font-size: 14px; width: 16px; color: #555; }

/* Not Popover */
.note-popover {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    width: 280px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    padding: 14px;
    z-index: 600;
}
.note-popover.hidden { display: none; }
.note-popover textarea {
    width: 100%;
    height: 85px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    resize: none;
    outline: none;
    font-size: 13px;
    color: #333;
}
.popover-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #eee; padding-top: 10px; margin-top: 8px; }
.color-options { display: flex; gap: 6px; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-dot.active { border-color: #333; transform: scale(1.1); }
.popover-actions button { background: transparent; border: none; font-size: 16px; cursor: pointer; margin-left: 8px; }
.popover-actions .delete-icon { color: #d32f2f; }
.popover-actions .save-icon { color: #4caf50; }

/* Yan Menüler */
.sidebar {
    position: fixed;
    top: 0;
    width: 330px;
    height: 100%;
    z-index: 500;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 5px 0 25px rgba(0,0,0,0.5);
}

.dark-sidebar, .red-sidebar { left: -330px; }
.dark-sidebar.open, .red-sidebar.open { left: 0; }

/* Arama Menüsü */
.search-sidebar {
    right: -360px;
    width: 360px;
    background: #fc1c2f;
    color: #fff;
}
.search-sidebar.open { right: 0; }
.search-header { background: #0077c8; padding: 14px; display: flex; justify-content: space-between; align-items: center; }
.search-box-wrap { padding: 15px; background: #ea1325; border-bottom: 1px solid rgba(255,255,255,0.15); }
.search-box-wrap input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 4px;
    border: none;
    outline: none;
    font-size: 13px;
    color: #333;
}
.search-filter-opt { margin-top: 8px; font-size: 12px; color: #fff; }
.results-count { margin-top: 8px; font-size: 12px; font-weight: 600; color: #fff; }

.search-results-list { flex-grow: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.search-item {
    background: rgba(0,0,0,0.22);
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.search-item:hover { background: rgba(0,0,0,0.4); }
.search-item h4 { font-size: 13px; margin-bottom: 4px; color: #fff; font-weight: bold; }
.search-item p { font-size: 12px; color: #ffebee; line-height: 1.4; word-break: break-word; }
.search-item mark { background: #ffd700; color: #000; padding: 1px 3px; border-radius: 2px; font-weight: bold; }

/* Kırmızı Not Menüsü */
.red-sidebar { background: #fc1c2f; color: white; }
.red-sidebar .sidebar-header { background: #df1022; padding: 15px; display: flex; justify-content: space-between; align-items: center; }
.notes-list { flex-grow: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 10px; }
.note-item { background: rgba(0,0,0,0.15); border-radius: 6px; padding: 10px; display: flex; gap: 10px; position: relative; }
.note-item img { width: 45px; height: 65px; object-fit: cover; border-radius: 4px; }
.note-text-area h4 { font-size: 12px; opacity: 0.85; margin-bottom: 4px; }
.note-dot { position: absolute; top: 10px; right: 10px; width: 10px; height: 10px; border-radius: 50%; }
.notes-footer { background: #df1022; padding: 15px; text-align: center; }
.sidebar-btn {
    width: 100%; background: #fff; color: #fc1c2f; border: none; padding: 10px; border-radius: 4px; font-weight: bold; cursor: pointer; margin-bottom: 10px;
}
.sidebar-btn.outline { background: transparent; border: 1px solid #fff; color: #fff; margin-bottom: 0; }
.note-info { font-size: 12px; line-height: 1.4; }
.text-small { font-size: 10px; opacity: 0.8; }

/* Siyah Küçük Resimler */
.dark-sidebar { background: #1a1a1a; color: white; }
.dark-sidebar .sidebar-header { background: #111; padding: 15px; display: flex; justify-content: space-between; align-items: center; }
.thumbnail-grid { padding: 15px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.thumb-card { cursor: pointer; border: 2px solid transparent; border-radius: 4px; overflow: hidden; background: #000; text-align: center; }
.thumb-card:hover { border-color: #d80093; }
.thumb-card img { width: 100%; height: auto; display: block; }
.thumb-card span { font-size: 11px; color: #ccc; display: block; padding: 4px 0; }

.close-btn { background: transparent; border: none; color: #fff; font-size: 18px; cursor: pointer; }

/* Alt Bar */
.bottom-toolbar {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    display: flex;
    justify-content: center;
    gap: 16px;
    z-index: 100;
}
.bottom-toolbar button { background: transparent; border: none; color: #eee; font-size: 18px; cursor: pointer; transition: 0.2s; }
.bottom-toolbar button:hover { color: #fff; transform: scale(1.15); }
.divider { width: 1px; height: 18px; background: rgba(255, 255, 255, 0.3); }

/* =======================================================
   MOBİL BOYUT DÜZENLEMESİ (BEYAZ BOŞLUĞU TAMAMEN YOK EDER)
   ======================================================= */
@media screen and (max-width: 768px) {
    .top-bar {
        padding: 6px 12px;
    }
    .top-left .campaign-name {
        font-size: 11px;
    }
    .top-left .page-counter {
        font-size: 11px;
    }
    .site-btn, .ig-btn {
        display: none; /* Mobilde üst barı rahatlatmak için */
    }
    .main-wrapper {
        padding: 0; /* Kenar taşmalarını sıfırla */
        height: calc(100vh - 95px);
    }
    .edge-arrow {
        width: 32px;
        height: 70px;
        font-size: 18px;
        background: rgba(0,0,0,0.3);
    }
    .prev-arrow { left: 4px; }
    .next-arrow { right: 4px; }

    /* Mobilde çift sayfa yerine tek sayfa odaklı merkezleme */
    .book-container {
        height: 88%;
        width: 96%;
        box-shadow: none;
        background: transparent;
    }
    /* Mobilde Sol Sayfa Boşluğunu ve Beyazlığını Tamamen Gizle */
    .book-container .left-slot {
        display: none !important;
    }
    .book-container .right-slot {
        width: 100% !important;
        height: 100% !important;
        background: transparent !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    }
    .book-container .right-slot img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    .flipper-leaf {
        display: none !important; /* Mobilde çift sayfa yaprak kanadı beyaz taşma yapmasın */
    }
    .bottom-toolbar {
        gap: 12px;
        padding: 8px 4px;
    }
    .bottom-toolbar button {
        font-size: 16px;
    }
    .divider {
        display: none;
    }
}