/* ── ARSO PDF Library — Public Styles ──────────────────────── */

:root {
    --arso-primary:     #1a5276;
    --arso-accent:      #2e86c1;
    --arso-light:       #eaf4fb;
    --arso-border:      #d5e8f3;
    --arso-text:        #2c3e50;
    --arso-muted:       #7f8c8d;
    --arso-white:       #ffffff;
    --arso-radius:      10px;
    --arso-shadow:      0 2px 16px rgba(26,82,118,.10);
    --arso-shadow-hover:0 8px 32px rgba(26,82,118,.18);
    --arso-transition:  .2s ease;
}

/* Library wrapper */
.arso-pdf-library { font-family: inherit; color: var(--arso-text); }

/* ── Toolbar ─────────────────────────────────────────────── */
.arso-library-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
    align-items: center;
}
.arso-search-form { display:flex; flex-wrap:wrap; gap:10px; width:100%; }
.arso-search-wrap {
    display: flex;
    flex: 1;
    min-width: 220px;
    border: 1.5px solid var(--arso-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--arso-white);
    transition: border-color var(--arso-transition), box-shadow var(--arso-transition);
}
.arso-search-wrap:focus-within {
    border-color: var(--arso-accent);
    box-shadow: 0 0 0 3px rgba(46,134,193,.15);
}
.arso-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    padding: 10px 14px;
    font-size: 14px;
    background: transparent;
    box-shadow: none !important;
}
.arso-search-btn {
    background: var(--arso-primary);
    color: #fff;
    border: none;
    padding: 0 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background var(--arso-transition);
}
.arso-search-btn:hover { background: var(--arso-accent); }

.arso-cat-select {
    padding: 10px 14px;
    border: 1.5px solid var(--arso-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--arso-white);
    color: var(--arso-text);
    cursor: pointer;
    min-width: 180px;
}
.arso-cat-select:focus { border-color: var(--arso-accent); outline: none; }

/* ── Grid ────────────────────────────────────────────────── */
.arso-pdf-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
}
.arso-pdf-grid--1col { grid-template-columns: 1fr; }
.arso-pdf-grid--2col { grid-template-columns: repeat(2, 1fr); }
.arso-pdf-grid--3col { grid-template-columns: repeat(3, 1fr); }
.arso-pdf-grid--4col { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
    .arso-pdf-grid--3col,
    .arso-pdf-grid--4col { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 580px) {
    .arso-pdf-grid--2col,
    .arso-pdf-grid--3col,
    .arso-pdf-grid--4col { grid-template-columns: 1fr; }
}

/* ── Card ────────────────────────────────────────────────── */
.arso-pdf-card {
    background: var(--arso-white);
    border: 1.5px solid var(--arso-border);
    border-radius: var(--arso-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--arso-shadow);
    transition: transform var(--arso-transition), box-shadow var(--arso-transition), border-color var(--arso-transition);
}
.arso-pdf-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--arso-shadow-hover);
    border-color: var(--arso-accent);
}

.arso-pdf-card__thumb {
    position: relative;
    background: var(--arso-light);
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.arso-pdf-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.arso-pdf-card__thumb-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--arso-accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.arso-pdf-card__cat {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--arso-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 4px;
}

.arso-pdf-card__body {
    padding: 16px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.arso-pdf-card__number {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--arso-accent);
}
.arso-pdf-card__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--arso-primary);
    margin: 0;
}
.arso-pdf-card__year {
    font-size: 12px;
    color: var(--arso-muted);
}
.arso-pdf-card__excerpt {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    margin: 4px 0 0;
}
.arso-pdf-card__meta {
    margin-top: auto;
    padding-top: 10px;
}
.arso-pdf-card__downloads {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--arso-muted);
}

.arso-pdf-card__actions {
    padding: 12px 18px 16px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--arso-border);
    background: #fafcff;
}

/* ── Buttons ─────────────────────────────────────────────── */
.arso-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background var(--arso-transition), transform var(--arso-transition), opacity var(--arso-transition);
}
.arso-btn:active { transform: scale(.97); }

.arso-btn--view {
    background: var(--arso-light);
    color: var(--arso-primary);
    flex: 1;
}
.arso-btn--view:hover { background: var(--arso-border); }

.arso-btn--download {
    background: var(--arso-primary);
    color: #fff;
    flex: 1;
}
.arso-btn--download:hover { background: var(--arso-accent); }

.arso-btn--submit {
    width: 100%;
    justify-content: center;
    background: var(--arso-primary);
    color: #fff;
    padding: 12px 20px;
    font-size: 15px;
    border-radius: 8px;
    margin-top: 8px;
}
.arso-btn--submit:hover { background: var(--arso-accent); }
.arso-btn--submit:disabled { opacity: .6; cursor: not-allowed; }

/* ── Pagination ──────────────────────────────────────────── */
.arso-pagination { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin:28px 0; }
.arso-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 7px;
    border: 1.5px solid var(--arso-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--arso-text);
    text-decoration: none;
    transition: background var(--arso-transition), color var(--arso-transition), border-color var(--arso-transition);
}
.arso-page-btn:hover,
.arso-page-btn.active {
    background: var(--arso-primary);
    color: #fff;
    border-color: var(--arso-primary);
}

/* ── Empty State ─────────────────────────────────────────── */
.arso-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--arso-muted);
}
.arso-empty p { margin-top: 12px; font-size: 15px; }

/* ── Modals ──────────────────────────────────────────────── */
.arso-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.arso-modal.is-open { display: flex; }

.arso-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
    animation: arsoFadeIn .25s ease;
}

.arso-modal__box {
    position: relative;
    background: var(--arso-white);
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    animation: arsoSlideUp .3s ease;
    max-height: 92vh;
    overflow: hidden;
}
.arso-modal__box--viewer {
    width: 90vw;
    max-width: 1000px;
}
.arso-modal__box--form {
    width: 92vw;
    max-width: 480px;
}

.arso-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--arso-border);
    background: var(--arso-light);
}
.arso-modal__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--arso-primary);
    margin: 0;
}
.arso-modal__close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--arso-muted);
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background var(--arso-transition), color var(--arso-transition);
}
.arso-modal__close:hover { background: #fde; color: #c0392b; }

.arso-modal__body { flex:1; overflow-y:auto; padding: 0; }
.arso-modal__box--viewer .arso-modal__body { padding: 0; }

#arso-pdf-iframe { width:100%; height:80vh; display:block; border:none; }

/* Viewer-only overlay — sits over the iframe, blocks the browser PDF toolbar's
   native download/print icons and right-click > Save As from inside the viewer */
.arso-pdf-viewer-wrap {
    position: relative;
    width: 100%;
    height: 80vh;
}
.arso-pdf-viewer-wrap iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
    /* #toolbar=0 appended in JS suppresses Chrome/Edge PDF toolbar */
}
.arso-pdf-viewer-overlay {
    position: absolute;
    /* Cover only the top toolbar area where the browser renders its download button
       (~40px). A full overlay would block scrolling, so we leave the content area open. */
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    z-index: 10;
    cursor: default;
    /* transparent — invisible to user */
    background: transparent;
}


/* Form */
.arso-download-form { padding: 20px 24px 24px; }
.arso-form-note { padding: 14px 24px 0; font-size: 13px; color: var(--arso-muted); line-height:1.5; }
.arso-field { margin-bottom: 14px; }
.arso-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--arso-primary);
    margin-bottom: 5px;
}
.arso-field .req { color: #e74c3c; }
.arso-field input,
.arso-field textarea {
    width: 100%;
    border: 1.5px solid var(--arso-border);
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--arso-text);
    background: var(--arso-white);
    transition: border-color var(--arso-transition), box-shadow var(--arso-transition);
    box-sizing: border-box;
}
.arso-field input:focus,
.arso-field textarea:focus {
    border-color: var(--arso-accent);
    box-shadow: 0 0 0 3px rgba(46,134,193,.15);
    outline: none;
}
.arso-field textarea { resize: vertical; min-height: 68px; }

.arso-form-msg {
    margin: 0 24px 10px;
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
}
.arso-form-msg.success { background: #e9f7ef; color: #1e8449; border: 1px solid #a9dfbf; }
.arso-form-msg.error   { background: #fdedec; color: #c0392b; border: 1px solid #f1948a; }

@keyframes arsoFadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes arsoSlideUp { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:translateY(0); } }
