/* ====================================================================
   Publication Co-Pilot – Quick Edit Modal
   ==================================================================== */

/* Body lock when modal open */
body.pcp-qe-open {
    overflow: hidden;
}

/* ── Overlay ─────────────────────────────────────────────────────── */
.pcp-qe-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

/* ── Modal shell ──────────────────────────────────────────────────── */
.pcp-qe-modal {
    width: 98vw;
    height: 97vh;
    background: #fff;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

/* ── Header ─────────────────────────────────────────────────────── */
.pcp-qe-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    height: 56px;
    background: linear-gradient(315deg, #e8c645 0%, #c9a227 100%);
    flex-shrink: 0;
    border-radius: 14px 14px 0 0;
}

.pcp-qe-header-left {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-shrink: 0;
}

.pcp-qe-title {
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #1a1916;
    letter-spacing: -0.01em;
}

.pcp-qe-page-label {
    font-size: 13px;
    color: rgba(26, 25, 22, 0.65);
    font-family: 'Outfit', sans-serif;
}

/* ── Toolbar ─────────────────────────────────────────────────────── */
.pcp-qe-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-right: 12px;
}

.pcp-qe-tbtn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    color: #1a1916;
    font-size: 14px;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.pcp-qe-tbtn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.38);
    transform: translateY(-1px);
}

.pcp-qe-tbtn:active:not(:disabled) {
    transform: translateY(0);
}

.pcp-qe-tbtn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pcp-qe-tbtn.pcp-qe-saved {
    background: rgba(22, 163, 74, 0.3);
    border-color: #16a34a;
}

.pcp-qe-sep {
    width: 1px;
    height: 24px;
    background: rgba(26, 25, 22, 0.25);
    margin: 0 4px;
}

/* Close button */
.pcp-qe-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.18);
    color: #1a1916;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.pcp-qe-close-btn:hover {
    background: rgba(220, 38, 38, 0.25);
}

/* ── Find bar ─────────────────────────────────────────────────────── */
.pcp-qe-findbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: var(--pcp-gray-50, #f9fafb);
    border-bottom: 1px solid var(--pcp-gray-200, #e5e7eb);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.pcp-qe-findbar label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.pcp-qe-findbar input[type="text"] {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: Georgia, serif;
    min-width: 180px;
}

.pcp-qe-findbar input[type="text"]:focus {
    outline: none;
    border-color: #c9a227;
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

.pcp-qe-findbar button {
    height: 34px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.pcp-qe-findbar button:hover { background: #f3f4f6; }

.pcp-qe-find-status {
    font-size: 12px;
    color: #6b7280;
    margin-left: 4px;
}

.pcp-qe-scope-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    margin-left: 8px;
    cursor: pointer;
    white-space: nowrap;
}

/* ── Content area ─────────────────────────────────────────────────── */
.pcp-qe-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 40px;
    background: #fafafa;
}

.pcp-qe-loading,
.pcp-qe-error {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

/* ── Field wrappers ──────────────────────────────────────────────── */
.pcp-qe-field-wrap {
    max-width: 900px;
    margin: 0 auto;
}

.pcp-qe-field-full {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pcp-qe-label {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #A87C2A;
    margin-bottom: 8px;
}

/* ── Textareas ────────────────────────────────────────────────────── */
.pcp-qe-textarea {
    width: 100%;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 17px; /* default, overridden inline */
    line-height: 1.8;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px 20px;
    resize: vertical;
    background: white;
    color: #111827;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.pcp-qe-textarea:focus {
    outline: none;
    border-color: #c9a227;
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12);
}

.pcp-qe-title-field  { min-height: 80px; }
.pcp-qe-abstract-field { min-height: 280px; }

.pcp-qe-field-full .pcp-qe-textarea {
    flex: 1;
    min-height: 400px;
    resize: none;
}

/* ── Word count ───────────────────────────────────────────────────── */
.pcp-qe-wc {
    text-align: right;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
    font-family: 'Outfit', sans-serif;
}

/* ── Figure page ─────────────────────────────────────────────────── */
.pcp-qe-figure-wrap {
    display: flex;
    gap: 32px;
    max-width: 1100px;
    margin: 0 auto;
    height: 100%;
}

.pcp-qe-fig-preview {
    flex: 0 0 40%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.pcp-qe-fig-img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.pcp-qe-fig-noimg {
    width: 100%;
    padding: 40px;
    text-align: center;
    background: #f3f4f6;
    border-radius: 8px;
    color: #9ca3af;
    font-size: 14px;
}

.pcp-qe-fig-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pcp-qe-fig-caption {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 12px;
    font-family: Georgia, serif;
}

/* ── Footer navigation ───────────────────────────────────────────── */
.pcp-qe-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-top: 1px solid #e5e7eb;
    background: white;
    flex-shrink: 0;
}

.pcp-qe-nav-btn {
    padding: 8px 20px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
    color: #374151;
}

.pcp-qe-nav-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #A87C2A;
    color: #A87C2A;
}

.pcp-qe-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ── Page dots ────────────────────────────────────────────────────── */
.pcp-qe-dots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 60%;
}

.pcp-qe-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: #d1d5db;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s, transform 0.15s;
}

.pcp-qe-dot.active {
    background: #A87C2A;
    transform: scale(1.35);
}

.pcp-qe-dot:hover:not(.active) { background: #9ca3af; }

/* ── Unsaved changes popup ───────────────────────────────────────── */
.pcp-qe-unsaved-popup {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10;
    border-radius: 14px;
}

.pcp-qe-unsaved-inner {
    background: white;
    border-radius: 12px;
    padding: 28px 32px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    max-width: 380px;
}

.pcp-qe-unsaved-inner p {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 20px;
}

.pcp-qe-unsaved-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.pcp-qe-unsaved-btns button {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.pcp-qe-unsaved-btns button:first-child {
    background: #A87C2A;
    color: white;
    border-color: #A87C2A;
}

/* ── Mobile fixes ──────────────────────────────────────────────── */
.pcp-qe-modal {
    height: 97dvh; /* dynamic viewport height - überschreibt 97vh auf mobil */
    max-height: 97dvh;
}

.pcp-qe-content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@media (max-width: 600px) {
    .pcp-qe-header {
        height: auto;
        min-height: 48px;
        flex-wrap: wrap;
        padding: 6px 10px;
        gap: 6px;
    }
    .pcp-qe-header-left {
        flex: 1;
        min-width: 0;
    }
    .pcp-qe-title {
        font-size: 14px;
    }
    .pcp-qe-page-label {
        display: none;
    }
    .pcp-qe-toolbar {
        order: 3;
        width: 100%;
        margin: 0;
        flex-wrap: wrap;
        justify-content: center;
        padding-bottom: 4px;
    }
    .pcp-qe-close-btn {
        order: 2;
        flex-shrink: 0;
    }
    .pcp-qe-sep {
        display: none;
    }
    .pcp-qe-content {
        padding: 16px;
    }
    .pcp-qe-footer {
        padding: 8px 12px;
    }
    .pcp-qe-nav-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

.pcp-qe-unsaved-btns button:first-child:hover { background: #8a6422; }
.pcp-qe-unsaved-btns button:not(:first-child):hover { background: #f3f4f6; }