/* =============================================
   Biblioteka Frontend Styles
   Main color: #008080 (teal)
   ============================================= */

.biblioteka-library {
    max-width: 1100px;
    margin: 0 auto;
    font-family: inherit;
}

/* =============================================
   Search / Filter Bar
   ============================================= */
.biblioteka-search {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid #008080;
}

.biblioteka-search-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.biblioteka-search-field label {
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #008080;
    margin-bottom: 6px;
}

.biblioteka-search-field input,
.biblioteka-search-field select {
    border: none;
    border-bottom: 2px solid #ccc;
    padding: 8px 4px;
    font-size: 0.95em;
    background: transparent;
    color: #333;
    outline: none;
    border-radius: 0;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease;
}

.biblioteka-search-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23008080'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    padding-right: 20px;
}

.biblioteka-search-field input:focus,
.biblioteka-search-field select:focus {
    border-bottom-color: #008080;
}

.biblioteka-search-field input::placeholder {
    color: #aaa;
}

.biblioteka-no-results {
    text-align: center;
    color: #888;
    padding: 30px 0;
    font-style: italic;
    font-size: 1em;
}

/* Category titles */
.biblioteka-category {
    margin-bottom: 30px;
}

.biblioteka-category-title {
    color: #008080;
    font-size: 1.4em;
    font-weight: 700;
    border-bottom: 2px solid #008080;
    padding-bottom: 8px;
    margin-bottom: 0;
}

/* Book list items */
.biblioteka-book-item {
    border-bottom: 1px solid #e0e0e0;
}

.biblioteka-book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.biblioteka-book-header:hover {
    background-color: rgba(0, 128, 128, 0.06);
}

.biblioteka-book-title {
    font-size: 1.05em;
    font-weight: 500;
    color: #333;
}

.biblioteka-book-arrow {
    color: #008080;
    font-size: 1em;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 10px;
}

.biblioteka-book-item.open .biblioteka-book-arrow {
    transform: rotate(180deg);
}

/* Book details (mobile: inline expand) */
.biblioteka-book-details {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.biblioteka-book-details-inner {
    display: flex;
    gap: 20px;
    padding: 12px 12px 20px;
    align-items: flex-start;
}

.biblioteka-book-image {
    flex-shrink: 0;
}

.biblioteka-book-image img {
    width: 100px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.biblioteka-book-info p {
    margin: 4px 0;
    color: #444;
    font-size: 0.95em;
    line-height: 1.5;
}

.biblioteka-book-description {
    margin-bottom: 10px !important;
    color: #555 !important;
    font-style: italic;
}

.biblioteka-book-link a {
    color: #008080;
    text-decoration: none;
    font-weight: 500;
}

.biblioteka-book-link a:hover {
    text-decoration: underline;
}

.biblioteka-bookstore-link a {
    display: inline-block;
    margin-top: 8px;
    color: #fff;
    background: #008080;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    letter-spacing: 0.03em;
    transition: background 0.2s ease;
}

.biblioteka-bookstore-link a:hover {
    background: #006666;
    text-decoration: none;
}

/* =============================================
   Desktop Popup
   ============================================= */
.biblioteka-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.biblioteka-popup {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    padding: 30px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: biblioteka-fadeIn 0.25s ease;
    display: flex;
    flex-direction: column;
}

@keyframes biblioteka-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.biblioteka-popup-header {
    color: #008080;
    font-size: 1.3em;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.05em;
    padding-bottom: 14px;
    margin-bottom: 18px;
    border-bottom: 2px solid #008080;
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}

.biblioteka-popup-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.biblioteka-popup-close:hover {
    color: #008080;
}

.biblioteka-popup-content {
    overflow-y: auto;
    flex: 1;
}

.biblioteka-popup-content .biblioteka-book-details-inner {
    flex-direction: column;
    align-items: center;
}

.biblioteka-popup-content .biblioteka-book-image {
    text-align: center;
    margin-bottom: 14px;
}

.biblioteka-popup-content .biblioteka-book-image img {
    width: 100%;
}

.biblioteka-popup-content .biblioteka-book-info h4 {
    margin: 0 0 10px;
    color: #008080;
    font-size: 1.2em;
}

.biblioteka-popup-content .biblioteka-book-info p {
    margin: 6px 0;
    color: #444;
    font-size: 0.95em;
}

.biblioteka-popup-content .biblioteka-book-link a {
    display: inline-block;
    margin-top: 8px;
    color: #fff;
    background: #008080;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    transition: background 0.2s ease;
}

.biblioteka-popup-content .biblioteka-book-link a:hover {
    background: #006666;
    text-decoration: none;
}

.biblioteka-popup-content .biblioteka-bookstore-link a {
    display: inline-block;
    margin-top: 8px;
    color: #fff;
    background: #008080;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    letter-spacing: 0.03em;
    transition: background 0.2s ease;
}

.biblioteka-popup-content .biblioteka-bookstore-link a:hover {
    background: #006666;
    text-decoration: none;
}

.biblioteka-empty {
    text-align: center;
    color: #888;
    padding: 40px 0;
    font-style: italic;
}

/* =============================================
   Responsive: mobile expand, desktop popup
   ============================================= */

/* Desktop: hide inline details, use popup */
@media (min-width: 769px) {
    .biblioteka-book-details {
        /* Hidden on desktop - popup is used instead */
    }
    .biblioteka-book-arrow {
        display: none;
    }
}

/* Mobile: hide popup, show inline expand */
@media (max-width: 768px) {
    .biblioteka-popup-overlay {
        display: none !important;
    }
    .biblioteka-book-details-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .biblioteka-search {
        flex-direction: column;
        gap: 14px;
    }
}
