/* Free Library Plugin Styles */
.free-library-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    border: 1px solid #ddd;
    padding: 20px;
    background-color: #f9f9f9;
    position: relative; /* For loader */
    max-width: 900px; /* Or your preferred max width */
    margin: 20px auto;
}

.free-library-tabs {
    margin-bottom: 20px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
}

.free-library-tab-button {
    background-color: #eee;
    border: 1px solid #ccc;
    padding: 10px 15px;
    cursor: pointer;
    margin-right: 5px;
    font-size: 1em;
    transition: background-color 0.3s, color 0.3s;
}

.free-library-tab-button:hover {
    background-color: #ddd;
}

.free-library-tab-button.active {
    background-color: #fff;
    border-bottom-color: #fff;
    font-weight: bold;
    color: #333;
}

.free-library-tab-pane {
    display: none;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-top: none;
}

.free-library-tab-pane.active {
    display: block;
}

/* Catalogue Styles */
.free-library-catalogue-filters {
    background-color: #f1f1f1;
    padding: 15px;
    margin-bottom: 20px;
}

.free-library-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.free-library-filter-header h4 {
    margin-top: 0;
    margin-bottom: 0;
}

.free-library-toggle-icon {
    transition: transform 0.3s ease;
}

.free-library-toggle-icon.expanded {
    transform: rotate(180deg);
}

.free-library-filter-body {
    margin-top: 15px;
    display: none;
}

.free-library-filter-body.expanded {
    display: block;
}

.free-library-filter-group {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 10px;
    vertical-align: top;
}
.free-library-filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.free-library-filter-group input[type="text"],
.free-library-filter-group select {
    padding: 8px;
    border: 1px solid #ccc;
    min-width: 150px;
}

.free-library-filter-actions {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.free-library-catalogue-filters button {
    margin-right: 5px;
}
.free-library-catalogue-filters button[type="reset"] {
    border-color: #777;
    color: #777 !important;
}
.free-library-catalogue-filters button[type="reset"]:hover {
    background-color: #777;
    color: white !important;
}

/* Item Card Styles */
.free-library-item-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.free-library-item-card-inner {
    display: flex;
    gap: 15px;
}
.free-library-item-thumbnail {
    flex-shrink: 0;
    width: 30%; /* Adjust as needed */
    height: auto; /* Adjust as needed */
}
.free-library-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.free-library-item-thumbnail-placeholder {
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 0.9em;
}
.free-library-item-thumbnail a {
    display: flex;
    width: 100%;
    height: 100%;
}

.free-library-item-details {
    flex-grow: 1;
}
.free-library-item-title {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.3em;
}
.free-library-item-title a {
    text-decoration: none;
    color: #384D68;
}
.free-library-item-title a:hover {
    text-decoration: underline;
}
.free-library-item-meta-row {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 8px;
}
.free-library-meta-separator {
    margin: 0 5px;
    color: #ccc;
}
.free-library-item-description-truncated,
.free-library-item-description-full {
    font-size: 0.95em;
    color: #333;
    line-height: 1.5;
    margin-bottom: 10px;
}
.free-library-item-description-full p:last-child {
    margin-bottom: 0;
}
.free-library-item-actions button,
.free-library-item-admin-actions button,
.free-library-item-actions .button,
.free-library-item-admin-actions .button {
    padding: 6px 12px;
    font-size: 0.9em;
}
.free-library-share-link {
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    min-width: 0;
    line-height: 1;
    vertical-align: middle;
}
.free-library-item-actions .free-library-share-link {
     padding: 6px !important;
}
.free-library-item-admin-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}
.free-library-item-admin-actions button {
    margin-right: 5px;
}
.button-danger, .button-danger:hover {
    color: white !important;
}
.button-danger {
    background-color: #d63638;
    border-color: #d63638;
}
.button-danger:hover {
    background-color: #b02a2c;
    border-color: #b02a2c;
}
.free-library-expand-description, .free-library-collapse-description {
    color: #384D68;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 5px;
}

/* Book-specific styles */
.free-library-item-book-meta {
    margin-top: 5px;
}
.free-library-item-meta-row.book-meta {
    font-style: italic;
    color: #666;
    background-color: #f9f9f9;
    padding: 5px 8px;
    border-left: 3px solid #384D68;
}

/* Item View Styles */
.free-library-item-view-container {
    padding: 10px;
}
.free-library-item-view-container h2 .free-library-share-link {
    font-size: 0.6em;
    padding: 4px !important;
    margin-left: 10px;
}
.free-library-item-view-thumbnail {
    float: right;
    margin: 0 0 15px 15px;
    max-width: 250px;
}
.free-library-item-view-thumbnail img {
    max-width: 100%;
    height: auto;
}
.free-library-item-view-meta p {
    margin: 5px 0;
    color: #555;
    display: flex;
    align-items: center;
}
.free-library-item-view-meta p .dashicons {
    margin-right: 8px;
    color: #384D68;
}
.free-library-item-view-meta p strong {
    margin-right: 5px;
}
.free-library-item-view-description {
    clear: both;
    margin-top: 20px;
    line-height: 1.6;
}
.free-library-item-view-action {
    margin-top: 20px;
}
.free-library-back-to-catalogue {
    display: block;
    margin: 20px auto 0;
    text-align: center;
    width: -moz-fit-content;
    width: fit-content;
    border-color: #6c757d;
    color: #6c757d !important;
}
.free-library-back-to-catalogue:hover {
    background-color: #6c757d;
    color: #fff !important;
}

.free-library-item-view-book-meta {
    background-color: #f9f9f9;
    padding: 10px 15px;
    margin: 10px 0;
    border-left: 3px solid #384D68;
}

/* Form Styles */
.free-library-form .free-library-form-field {
    margin-bottom: 15px;
}
.free-library-form label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}
.free-library-form input[type="text"],
.free-library-form input[type="url"],
.free-library-form input[type="email"],
.free-library-form select,
.free-library-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}
.free-library-form textarea {
    min-height: 100px;
}
.free-library-form .wp-editor-wrap { /* Style WP editor if used */
    border: 1px solid #ccc;
}
.free-library-form .free-library-required {
    color: red;
}
.free-library-image-uploader img,
.free-library-media-uploader span {
    display: block;
    margin-bottom: 10px;
}
.free-library-checkbox-group ul {
    list-style: none;
    padding-left: 0;
}
.free-library-checkbox-group ul ul {
    padding-left: 20px; /* Indent child categories */
}
.free-library-checkbox-group li {
    margin-bottom: 5px;
}
.free-library-checkbox-group label {
    font-weight: normal;
}

/* Book-specific fields */
.free-library-book-fields {
    background-color: #f9f9f9;
    padding: 15px;
    margin: 15px 0;
    border-left: 3px solid #384D68;
}
.free-library-book-fields h4 {
    margin-top: 0;
    color: #384D68;
}

/* Taxonomy Management Styles */
.free-library-taxonomy-manager {
    margin-bottom: 30px;
    padding: 15px;
    border: 1px solid #e5e5e5;
    background: #fdfdfd;
}
.free-library-taxonomy-manager h5 {
    margin-top:0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}
.free-library-add-term-form {
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #eee;
}
.free-library-add-term-form input[type="text"],
.free-library-add-term-form select,
.free-library-add-term-form textarea {
    width: calc(100% - 22px); /* Account for padding */
    margin-bottom: 10px;
}
.free-library-terms-list {
    list-style: none;
    padding-left: 0;
}
.free-library-terms-list li {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.free-library-terms-list li:last-child {
    border-bottom: none;
}
.free-library-terms-list .free-library-term-name {
    font-weight: bold;
}
.free-library-terms-list .free-library-term-actions button {
    margin-left: 5px;
}
.free-library-edit-term-inline-form {
    width: 100%;
    padding: 10px;
    background: #fefefe;
    border: 1px solid #ddd;
    margin-top: 10px;
}
.free-library-edit-term-inline-form input,
.free-library-edit-term-inline-form select,
.free-library-edit-term-inline-form textarea {
    width: calc(100% - 22px);
    margin-bottom: 5px;
}

/* Moderation Styles */
#free-library-moderation-list ul {
    list-style: none;
    padding: 0;
}
#free-library-moderation-list li {
    padding: 10px;
    border-bottom: 1px solid #eee;
}
#free-library-moderation-list li:last-child {
    border-bottom: none;
}
.free-library-moderation-actions button {
    margin-right: 5px;
}

/* Pagination */
.free-library-pagination {
    margin-top: 20px;
    text-align: center;
}
.free-library-pagination .page-numbers {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 2px;
    border: 1px solid #ccc;
    text-decoration: none;
    color: #384D68;
}
.free-library-pagination .page-numbers.current,
.free-library-pagination .page-numbers:hover {
    background-color: #384D68;
    color: white;
    border-color: #384D68;
}
.free-library-pagination .dots {
    border: none;
}


/* Loader and Messages */
.free-library-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.free-library-spinner {
    border: 5px solid #f3f3f3; /* Light grey */
    border-top: 5px solid #384D68;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: free-library-spin 1s linear infinite;
}
@keyframes free-library-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.free-library-loader p {
    margin-top: 10px;
    font-size: 1.1em;
    color: #333;
}

.free-library-message-area {
    padding: 10px 15px;
    margin-bottom: 15px;
    text-align: center;
}
.free-library-message-area.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.free-library-message-area.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* General button styling if not using WP default button class */
.free-library-app button, .free-library-app input[type="submit"], .free-library-app .button {
    background-color: #fff;
    border: 2px solid #384D68;
    color: #384D68 !important;
    text-decoration: none;
    padding: 8px 15px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s, color 0.2s;
    line-height: normal;
}
.free-library-app button:hover, .free-library-app input[type="submit"]:hover, .free-library-app .button:hover {
    background-color: #384D68;
    color: #fff !important;
}

.free-library-app .button.button-primary {
    background-color: #384D68;
    border-color: #384D68;
    color: white !important;
}
.free-library-app .button.button-primary:hover {
    background-color: #2a394f;
    border-color: #2a394f;
}

/* Responsive adjustments (basic) */
@media (max-width: 768px) {
    .free-library-filter-group {
        display: block;
        width: 100%;
        margin-right: 0;
    }
    .free-library-filter-group input[type="text"],
    .free-library-filter-group select {
        width: 100%;
    }
    .free-library-item-card-inner {
        flex-direction: column;
    }
    .free-library-item-thumbnail {
        width: 100%; /* Full width on small screens */
        height: auto; /* Adjust height proportionally */
        max-height: 200px; /* Or a fixed height */
        margin-bottom: 10px;
    }
     .free-library-item-view-thumbnail {
        float: none;
        margin: 0 auto 15px auto; /* Center it */
    }
}
