/* Casa Library — Frontend Styles */

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

/* Toolbar */
.cl-front-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.cl-search-input {
    padding: 7px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    width: 260px;
    max-width: 100%;
}

.cl-filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 15px;
}

/* Book Grid */
.cl-front-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
}

.cl-book-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

.cl-book-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.cl-book-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    background: #f0f0f0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cl-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cl-book-cover-placeholder {
    color: #bbb;
    font-size: 48px;
    line-height: 1;
}

.cl-book-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cl-book-title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.3;
    margin: 0;
}

.cl-book-author {
    font-size: 13px;
    color: #666;
    margin: 0;
}

.cl-book-casa-id {
    font-size: 12px;
    color: #999;
    font-family: monospace;
    margin: 2px 0 0;
}

.cl-book-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    align-self: flex-start;
}

.cl-badge-available {
    background: #d4edda;
    color: #155724;
}

.cl-badge-unavailable {
    background: #f8d7da;
    color: #721c24;
}

.cl-book-actions {
    padding: 10px 12px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cl-active-loans-count {
    font-size: 12px;
    color: #888;
    padding: 0 12px 10px;
}

/* Buttons */
.cl-btn {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f8f8;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.4;
    text-decoration: none;
    transition: background 0.15s;
}

.cl-btn:hover {
    background: #eee;
}

.cl-btn-primary {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #fff;
}

.cl-btn-primary:hover {
    background: #1d4ed8;
}

.cl-btn-danger {
    background: #dc2626;
    border-color: #b91c1c;
    color: #fff;
}

.cl-btn-danger:hover {
    background: #b91c1c;
}

.cl-btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Empty message */
.cl-empty-msg {
    color: #888;
    font-style: italic;
    padding: 32px 0;
    text-align: center;
}

/* Modal */
.cl-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cl-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.cl-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 28px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.cl-modal-narrow {
    max-width: 400px;
}

.cl-modal-content h2 {
    margin: 0 0 20px;
    font-size: 20px;
}

.cl-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cl-modal-body label {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
    display: block;
}

.cl-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.cl-input-small {
    width: 80px;
}

.cl-modal-footer {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* Loan list inside return modal */
.cl-loan-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
}

.cl-loan-item:last-child {
    border-bottom: none;
}

.cl-loan-book-name {
    font-weight: 600;
    margin: 0 0 12px;
    color: #333;
}
