/* =====================================================
   CUSTOM DIALOG — murky green journal theme
   ===================================================== */
#jsr-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(44, 74, 38, 0.45);
    z-index: 99990;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
#jsr-overlay.active { display: flex; }

#jsr-dialog {
    background: #eef2e8;
    border-radius: 12px;
    max-width: 420px;
    width: 92%;
    box-shadow: 0 24px 64px rgba(44,74,38,0.22), 0 0 0 1px rgba(74,103,65,0.18);
    overflow: hidden;
    animation: dialogIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes dialogIn {
    from { transform: translateY(-18px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
#jsr-dialog .dialog-header {
    background: #d6e4cc;
    padding: 18px 22px 14px;
    display: flex;
    align-items: center;
    gap: 13px;
    border-bottom: 1px solid #c2d6b4;
}
#jsr-dialog .dialog-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
#jsr-dialog .dialog-icon.confirm { background: #b8d4a8; color: #2d5a1e; }
#jsr-dialog .dialog-icon.danger  { background: #f5c6c6; color: #8b1a1a; }
#jsr-dialog .dialog-icon.info    { background: #b8d4e8; color: #1a4a6b; }
#jsr-dialog .dialog-icon.success { background: #b8d4a8; color: #2d5a1e; }

#jsr-dialog .dialog-title {
    font-size: 15px;
    font-weight: 700;
    color: #2a4a22;
    letter-spacing: 0.2px;
}
#jsr-dialog .dialog-body {
    padding: 18px 22px 20px;
    font-size: 13.5px;
    color: #3d5a33;
    line-height: 1.65;
    background: #eef2e8;
}
#jsr-dialog .dialog-footer {
    padding: 0 22px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #eef2e8;
}
#jsr-dialog .dialog-btn {
    padding: 8px 22px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
    letter-spacing: 0.2px;
}
#jsr-dialog .dialog-btn:hover  { opacity: 0.88; }
#jsr-dialog .dialog-btn:active { transform: scale(0.97); }
#jsr-dialog .dialog-btn.cancel {
    background: #c8dbb8;
    color: #2a4a22;
    border: 1px solid #adc69a;
}
#jsr-dialog .dialog-btn.confirm-ok {
    background: #4a6741;
    color: #fff;
}
#jsr-dialog .dialog-btn.danger-ok {
    background: #8b1a1a;
    color: #fff;
}
#jsr-dialog .dialog-btn.info-ok {
    background: #1a4a6b;
    color: #fff;
}

/* =====================================================
   LOADING INDICATOR — flipping book + progress bar
   ===================================================== */
#jsr-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #4a6741, #e07b22);
    z-index: 999999;
    transition: width 0.3s ease;
    border-radius: 0 3px 3px 0;
}
#jsr-spinner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(44, 74, 38, 0.35);
    z-index: 99980;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
#jsr-spinner-overlay.active { display: flex; }

#jsr-spinner-box {
    background: #eef2e8;
    border-radius: 14px;
    padding: 28px 36px 24px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(44,74,38,0.22), 0 0 0 1px rgba(74,103,65,0.15);
    min-width: 170px;
}

/* Flipping Book Animation */
.jsr-book {
    width: 56px;
    height: 44px;
    position: relative;
    margin: 0 auto 14px;
    perspective: 300px;
}
.jsr-book .spine {
    position: absolute;
    left: 50%;
    top: 0;
    width: 5px;
    height: 100%;
    background: #4a6741;
    border-radius: 1px 1px 1px 1px;
    transform: translateX(-50%);
    z-index: 10;
}
.jsr-book .cover-left,
.jsr-book .cover-right {
    position: absolute;
    top: 2px;
    width: 24px;
    height: calc(100% - 4px);
    background: #4a6741;
    border-radius: 2px;
}
.jsr-book .cover-left  { left: 0; border-radius: 3px 0 0 3px; }
.jsr-book .cover-right { right: 0; border-radius: 0 3px 3px 0; }

.jsr-book .page {
    position: absolute;
    top: 4px;
    width: 22px;
    height: calc(100% - 8px);
    background: #f5f7f2;
    border: 1px solid #c8dbb8;
    transform-origin: left center;
    animation: flipPage 1.4s ease-in-out infinite;
    border-radius: 0 2px 2px 0;
    left: 50%;
}
.jsr-book .page:nth-child(3) { animation-delay: 0s;    background: #f0f4ea; }
.jsr-book .page:nth-child(4) { animation-delay: 0.2s;  background: #eef2e8; }
.jsr-book .page:nth-child(5) { animation-delay: 0.4s;  background: #f0f4ea; }

/* Horizontal lines on pages */
.jsr-book .page::before {
    content: '';
    position: absolute;
    left: 3px; right: 3px;
    top: 5px;
    height: 1px;
    background: #c8dbb8;
    box-shadow: 0 5px 0 #c8dbb8, 0 10px 0 #c8dbb8, 0 15px 0 #c8dbb8;
}

@keyframes flipPage {
    0%   { transform: rotateY(0deg);    z-index: 5; }
    45%  { transform: rotateY(-160deg); z-index: 5; }
    50%  { transform: rotateY(-160deg); z-index: 1; }
    100% { transform: rotateY(-160deg); z-index: 1; }
}

#jsr-spinner-box .spinner-text {
    font-size: 13px;
    color: #3d5a33;
    font-weight: 600;
    letter-spacing: 0.2px;
}