body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    direction: rtl;
}
header {
    background-color: #007bff; color: white; padding: 1rem; text-align: center; border-radius: 8px; margin-bottom: 20px; position: relative;
}
#auth-status {
    position: absolute; top: 5px; left: 10px; background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 12px; font-size: 12px;
}
.form-container {
    background: white; padding: 20px; margin-bottom: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.view-book-link {
    text-align: center; margin-bottom: 20px; padding: 15px; background: #e9ecef; border-radius: 8px;
}
.view-book-link a {
    font-size: 18px; font-weight: bold; text-decoration: none; color: #007bff;
}
label { display: block; margin-bottom: 5px; font-weight: bold; }
input, textarea {
    width: 100%; padding: 10px; margin-bottom: 15px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box;
}
button {
    background-color: #28a745; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px;
}
button:hover { background-color: #218838; }
hr { margin: 30px 0; border: 0; border-top: 1px solid #ccc; }
#uploadStatus { margin-top: 15px; font-weight: bold; color: #007bff; }

/* ======== STYLÊN لاپەرا پەرتووکێ (HATIN GUHERANDIN) ======== */
.book-body {
    padding: 0;
    overflow: hidden;
    background-color: #fff; /* Paşbiniada giştî dibe spî */
}
#book-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    margin: 0;
    background: #fff; /* Paşbiniada derveyî pirtûkê spî ye */
    display: flex;
    justify-content: center;
    align-items: center;
}
/* === HAT GUHERANDIN: Em pirtûkê hinekê biçûk dikin da ku valahî li rexan çêbibe === */
#book-view {
    display: flex;
    align-items: stretch;
    width: 85vw; /* Pirtûk 85% ji firehiya şaşê ye, bo zêdekirina valahiyê */
    height: 90vh; /* Pirtûk 90% ji bilindahiya şaşê ye */
    overflow: hidden;
    /* گرنگ: ئەم دێرە بۆشایی نێوان دوو وێنەکە لادەبات */
    font-size: 0; 
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); /* Sîberek bo ciwaniyê */
    border-radius: 4px; /* Goşeyên glover */
}
#book-view img {
    width: 100%;
    height: 100%; 
    object-fit: contain;
    box-sizing: border-box;
    cursor: zoom-in;
}

/* === HAT GUHERANDIN: Ev koda hanê dibe sedem ku هەردوو وێنە لە تەنیشت یەک بن و بۆشایی نەمێنێت === */
@media (orientation: landscape), (min-width: 768px) {
    #book-view img {
        width: 50%; /* Her wêne nîvê firehiya konteynerê digire, ji ber vê yekê ew لە ناوەڕاستدا پێکدەگەن */
    }
}

/* ======== STYLÊN KONTROLÊN SEREVÊ ======== */
#top-controls {
    position: absolute; top: 15px; left: 50%; transform: translateX(-50%); z-index: 20;
    display: flex; align-items: center; gap: 10px;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    padding: 8px 12px; border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0; transition: opacity 0.3s ease-in-out; user-select: none;
}
#book-container:hover #top-controls { opacity: 1; }
.nav-btn {
    position: static; transform: none; background-color: rgba(0, 0, 0, 0.05); color: #333;
    border: none; cursor: pointer;
    border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: bold; transition: background-color 0.2s;
}
.nav-btn:hover { background-color: rgba(0, 0, 0, 0.1); }
.nav-btn:disabled { opacity: 0.3; cursor: default; }
#search-container { position: static; transform: none; background-color: transparent; padding: 0; }
#search-form { display: flex; align-items: center; }
#search-input {
    border: none; background: transparent; color: #333;
    padding: 5px 10px; width: 120px; outline: none; direction: ltr; text-align: center;
}
#search-input::placeholder { color: #888; }
#search-input::-webkit-outer-spin-button, #search-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#search-input[type=number] { -moz-appearance: textfield; }
#search-form button {
    background-color: #007bff; color: white; border: none;
    border-radius: 20px; padding: 5px 15px; cursor: pointer; font-size: 14px;
}
#fullscreen-btn { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 2h-2v3h-3v2h5v-5zm-3-4V5h-3v2h3v3z"/></svg>'); background-repeat: no-repeat; background-position: center; background-size: 22px; }
body:fullscreen #fullscreen-btn { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/></svg>'); }
.loading-text { color: #333; font-size: 20px; margin: auto; }
#install-pwa-btn { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M12 3L1 9l11 6 9-4.91V17h2V9L12 3zm0 8.48L5.53 8.35 12 5l6.47 3.35L12 11.48zM17 15.32V12l-5 2.73L7 12v3.32L12 18l5-2.68z"/></svg>'); background-repeat: no-repeat; background-position: center; background-size: 22px; }
#screenshot-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: black; color: white; z-index: 9999; display: none; justify-content: center; align-items: center; text-align: center; font-size: 24px; }
.secure-content { -webkit-user-select: none; user-select: none; }
@media print { body.secure-content * { display: none !important; } }
.zoom-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: flex; justify-content: center; align-items: center; z-index: 10000; cursor: zoom-out; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.zoom-overlay img { max-width: 95%; max-height: 95%; object-fit: contain; cursor: default; }