/* ===== ELIBRARY PAGE ===== */

/* ── BODY ── */
.elib-body {
    background-color: #f5f6f8;
    padding: 48px 0 72px;
    min-height: 500px;
}

.elib-layout {
    display: flex;
    align-items: flex-start;
    gap: 28px;
}

/* ── SIDEBAR ── */
.elib-sidebar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 24px;
}

.elib-sidebar-inner {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e9ebee;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    padding: 8px 0;
}

.elib-sidebar-label {
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 12px 18px 6px;
}

.elib-cat-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 18px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    font-family: 'Open Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    color: #374151;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.elib-cat-btn:hover {
    background: #f3f4f6;
}

.elib-cat-btn.active {
    background: #fef2f2;
    color: var(--theme_color);
    font-weight: 700;
    border-left-color: var(--theme_color);
}

.elib-cat-count {
    font-size: 11px;
    font-weight: 700;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 20px;
    padding: 2px 8px;
    flex-shrink: 0;
    margin-left: 6px;
}

.elib-cat-btn.active .elib-cat-count {
    background: rgba(217, 0, 13, 0.10);
    color: var(--theme_color);
}

/* ── MAIN ── */
.elib-main {
    flex: 1;
    min-width: 0;
}

/* ── CONTROLS ROW ── */
.elib-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

/* Search — takes all remaining space */
.elib-search-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.elib-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #9ca3af;
    pointer-events: none;
}

.elib-search-input {
    width: 100%;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 38px 10px 40px;
    font-family: 'Open Sans', sans-serif;
    font-size: 13.5px;
    color: var(--text_color);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.elib-search-input::placeholder {
    color: #b0b7c0;
}

.elib-search-input:focus {
    border-color: var(--theme_color);
    box-shadow: 0 0 0 3px rgba(217, 0, 13, 0.08);
}

.elib-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: #e9ebee;
    border: none;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease;
}

.elib-search-clear:hover {
    background: #d1d5db;
}

.elib-search-clear .iconify {
    width: 13px;
    height: 13px;
}

/* Sort — right side, fixed width */
.elib-sort-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.elib-sort-label {
    font-family: 'Open Sans', sans-serif;
    font-size: 12.5px;
    color: #9ca3af;
    white-space: nowrap;
}

.elib-sort-select {
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    padding: 8px 12px;
    color: var(--text_color);
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.18s ease;
}

.elib-sort-select:focus {
    border-color: var(--theme_color);
}

/* Result info line */
.elib-result-info {
    font-family: 'Open Sans', sans-serif;
    font-size: 12.5px;
    color: #9ca3af;
    margin-bottom: 14px;
}

.elib-result-info strong {
    color: var(--text_color);
}

/* ── RESOURCE LIST ── */
.elib-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── LIST ITEM ── */
.elib-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #eaecef;
    border-left: 3px solid transparent;
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.elib-item:hover {
    border-left-color: var(--theme_color);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
    background: #fafafa;
}

/* Type icon */
.elib-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    background-color: color-mix(in srgb, var(--icon-color) 10%, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.elib-item-icon .iconify {
    width: 22px;
    height: 22px;
    color: var(--icon-color);
}

/* Content area */
.elib-item-body {
    flex: 1;
    min-width: 0;
}

.elib-item-tags {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.elib-item-badge {
    display: inline-block;
    font-family: 'Open Sans', sans-serif;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--badge-color);
    background-color: color-mix(in srgb, var(--badge-color) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--badge-color) 20%, #fff);
    padding: 1px 7px;
    border-radius: 20px;
    white-space: nowrap;
}

.elib-item-cat {
    font-family: 'Open Sans', sans-serif;
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.elib-item-title {
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text_color);
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.elib-item-desc {
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    color: #6b7280;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action button — right side */
.elib-item-action {
    flex-shrink: 0;
}

.elib-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'Open Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 7px;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}

.elib-action-btn .iconify {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.elib-action-open {
    background-color: #f0f4ff;
    color: #2563eb;
}

.elib-action-open:hover {
    background-color: #2563eb;
    color: #fff;
    text-decoration: none;
}

.elib-action-download {
    background-color: #fff5f0;
    color: #ea580c;
}

.elib-action-download:hover {
    background-color: #ea580c;
    color: #fff;
    text-decoration: none;
}

.elib-file-size {
    font-weight: 400;
    opacity: 0.75;
}

/* ── EMPTY STATE ── */
.elib-empty {
    text-align: center;
    padding: 64px 20px;
}

.elib-empty .iconify {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    color: #d1d5db;
}

.elib-empty p {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 4px;
}

.elib-empty small {
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    color: #9ca3af;
}

/* ── PAGINATION ── */
.elib-pag-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e9ebee;
}

.elib-pag-info {
    font-family: 'Open Sans', sans-serif;
    font-size: 12.5px;
    color: #9ca3af;
}

.elib-pag {
    display: flex;
    align-items: center;
    gap: 4px;
}

.elib-pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.elib-pag-btn:hover:not(.disabled):not(.active) {
    background: #fef2f2;
    border-color: rgba(217, 0, 13, 0.3);
    color: var(--theme_color);
}

.elib-pag-btn.active {
    background: var(--theme_color);
    border-color: var(--theme_color);
    color: #fff;
    cursor: default;
}

.elib-pag-btn.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.elib-pag-btn.elib-pag-nav .iconify {
    width: 17px;
    height: 17px;
}

.elib-pag-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 34px;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    color: #9ca3af;
    user-select: none;
}

/* ── RESPONSIVE ── */
@media (max-width: 991px) {
    .elib-layout {
        flex-direction: column;
        gap: 20px;
    }

    .elib-sidebar {
        width: 100%;
        position: static;
    }

    /* Horizontal pill row */
    .elib-sidebar-inner {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 8px 12px;
        gap: 6px;
        scrollbar-width: none;
    }

    .elib-sidebar-inner::-webkit-scrollbar { display: none; }

    .elib-sidebar-label { display: none; }

    .elib-cat-btn {
        white-space: nowrap;
        border-left: none;
        border: 1.5px solid #e5e7eb;
        border-radius: 20px;
        padding: 6px 14px;
        width: auto;
        flex-shrink: 0;
        font-size: 12.5px;
    }

    .elib-cat-btn.active {
        background: var(--theme_color);
        color: #fff;
        border-color: var(--theme_color);
    }

    .elib-cat-btn.active .elib-cat-count {
        background: rgba(255,255,255,0.25);
        color: #fff;
    }
}

@media (max-width: 767px) {
    .elib-body { padding: 32px 0 56px; }

    .elib-controls { flex-wrap: wrap; }

    .elib-search-wrap { flex: 1 1 100%; }

    .elib-item-desc { display: none; }

    .elib-pag-row { justify-content: center; }

    .elib-pag-info { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
    .elib-item { gap: 10px; padding: 12px; }

    .elib-item-icon {
        width: 34px;
        height: 34px;
    }

    .elib-item-icon .iconify {
        width: 18px;
        height: 18px;
    }

    .elib-action-btn {
        padding: 6px 10px;
        font-size: 0;
    }

    .elib-action-btn .iconify {
        width: 16px;
        height: 16px;
        font-size: initial;
    }
}
