/* MyLibrary Public Styles */

/* Reset and Base Styles */
.mylibrary-container {
    font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.mylibrary-header {
    background: #ffffff;
    color: white;
    padding: 40px 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.mylibrary-header h1 {
    font-size: 2.5em;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.mylibrary-header p {
    font-size: 1.2em;
    opacity: 0.9;
    margin: 0;
}

/* Navigation */
.mylibrary-nav {
    background: transparent;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.mylibrary-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.mylibrary-nav li {
    margin: 0;
}

.mylibrary-nav a {
    display: inline-block;
    padding: 12px 24px;
    background: #f8f9fa;
    color: #495057;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mylibrary-nav a:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.mylibrary-nav a.active {
    background: #667eea;
    color: white;
}

/* Dashboard Grid */
.mylibrary-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.mylibrary-card {
    background: transparent;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mylibrary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.mylibrary-card h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin-bottom: 12px;
    color: #4a4a4a;
}

/* Book Grid and Card Styles */
.mylibrary-books-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: 1 column by default */
    gap: 25px;
    margin: 20px 0;
    padding: 0;
    max-width: 1200px; /* Prevents excessive spreading on very wide screens */
    margin: 20px auto; /* Center the grid */
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
    .mylibrary-books-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }
}

/* Desktop: Prevent stretching for few items */
@media (min-width: 1024px) {
    .mylibrary-books-grid {
        grid-template-columns: repeat(auto-fill, 280px) !important;
        gap: 25px;
        justify-content: start;
        width: fit-content;
        max-width: none;
        margin: 20px auto;
    }
}

.mylibrary-book-card {
    background: transparent;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    /* cursor: pointer; - Removed to prevent mobile touch interference with buttons */
    height: auto;
    display: flex;
    flex-direction: column;
}

.mylibrary-book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.mylibrary-book-card .book-cover {
    position: relative;
    flex: 0 0 auto;
    height: auto;
    max-height: 665px;
    min-height: 200px;
    background: #ffffff;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 1;
    padding: 0;
}

/* Only show purple gradient when there's a placeholder (no cover image) */
.mylibrary-book-card .book-cover:has(.book-cover-placeholder) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 280px;
    min-height: 280px;
    max-height: 280px;
    flex: 0 0 280px;
    align-items: center;
}

.mylibrary-book-card .book-cover img {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center top;
    display: block;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    background: #fff;
    transition: transform 0.3s ease;
    margin-left: auto;
    margin-right: auto;
}

.mylibrary-book-card:hover .book-cover img {
    transform: scale(1.05);
}

.mylibrary-book-card .book-cover-placeholder {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.mylibrary-book-card .book-cover-placeholder span {
    font-size: 2em;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
}

.mylibrary-book-card .book-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
}

.mylibrary-book-card .book-info {
    padding: 20px;
    flex: 0 0 300px;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: none;
    overflow: auto;
    z-index: 2;
}

.mylibrary-book-card .book-title {
    font-size: 1.2em;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mylibrary-book-card .book-author {
    color: #666;
    font-size: 0.9em;
    margin: 0 0 12px 0;
    font-style: italic;
}

.mylibrary-book-card .book-description {
    color: #555;
    font-size: 0.85em;
    margin: 0 0 12px 0;
    line-height: 1.4;
    max-height: 150px;
    overflow-y: auto;
}

.mylibrary-book-card .book-genre {
    display: inline-block;
    background: #f8f9fa;
    color: #495057;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-bottom: 12px;
}

.mylibrary-book-card .book-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    margin: 0 0 12px 0;
}

.mylibrary-book-card .book-badge.gutenberg {
    background: #e3f2fd;
    color: #1976d2;
}

.mylibrary-book-card .book-badge.new {
    background: #e8f5e8;
    color: #2e7d2e;
}

.mylibrary-book-card .book-badge.popular {
    background: #fff3e0;
    color: #f57c00;
}

.mylibrary-book-card .book-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.mylibrary-book-card .book-actions .btn {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 6px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: center;
}

.mylibrary-book-card .book-actions .btn-primary {
    background: #667eea;
    color: white;
}

.mylibrary-book-card .book-actions .btn-primary:hover {
    background: #5a6fd8;
}

.mylibrary-book-card .book-actions .btn-secondary {
    background: #6c757d;
    color: white;
}

.mylibrary-book-card .book-actions .btn-secondary:hover {
    background: #5a6268;
}

.mylibrary-book-card .book-actions .btn-outline {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}

.mylibrary-book-card .book-actions .btn-outline:hover {
    background: #667eea;
    color: white;
}

.mylibrary-book-card .book-actions .btn-sm {
    padding: 4px 8px;
    font-size: 0.75em;
}

.mylibrary-book-card .book-actions .btn-danger {
    background: #dc3545;
    color: white;
    margin-left: 5px;
}

.mylibrary-book-card .book-actions .btn-danger:hover {
    background: #c82333;
}

.mylibrary-book-card .book-actions .btn-danger:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.mylibrary-book-card .book-actions .btn-info {
    background: #17a2b8;
    color: white;
}

.mylibrary-book-card .book-actions .btn-info:hover {
    background: #138496;
}

/* Also support for .button class used in some JS functions */
.button.disabled {
    background: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.button.disabled:hover {
    background: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
}

/* Buttons */
.mylibrary-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    text-align: center;
}

.mylibrary-btn-primary {
    background: #667eea;
    color: white;
}

.mylibrary-btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.mylibrary-btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.mylibrary-btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.mylibrary-btn-success {
    background: #28a745;
    color: white;
}

.mylibrary-btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

.mylibrary-btn-danger {
    background: #dc3545;
    color: white;
}

.mylibrary-btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.mylibrary-btn-small {
    padding: 6px 12px;
    font-size: 0.8em;
}

/* Forms */
.mylibrary-form {
    background: transparent;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mylibrary-form-group {
    margin-bottom: 20px;
}

.mylibrary-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

.mylibrary-form-input,
.mylibrary-form-textarea,
.mylibrary-form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.mylibrary-form-input:focus,
.mylibrary-form-textarea:focus,
.mylibrary-form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 3px rgba(102, 126, 234, 0.1);
}

.mylibrary-form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Language Combobox Styles */
.language-combobox {
    position: relative;
}

.language-combobox select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    background: transparent;
}

.language-combobox select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 3px rgba(102, 126, 234, 0.1);
}

.language-combobox input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9em;
    background: #f8f9fa;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    box-sizing: border-box;
    display: none;
}

.language-combobox input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    background: transparent;
    box-shadow: 0 0 3px rgba(102, 126, 234, 0.1);
}

.language-combobox .form-help {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 4px;
    display: block;
}

/* Search */
.mylibrary-search {
    background: transparent;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mylibrary-search-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.mylibrary-search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.mylibrary-search-input:focus {
    outline: none;
    border-color: #667eea;
}

.mylibrary-search-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

/* Tables */
.mylibrary-table {
    width: 100%;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mylibrary-table th,
.mylibrary-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.mylibrary-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.mylibrary-table tr:hover {
    background: #f8f9fa;
}

/* Pagination */
.mylibrary-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}

.mylibrary-pagination a,
.mylibrary-pagination span {
    display: inline-block;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.mylibrary-pagination a {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.mylibrary-pagination a:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.mylibrary-pagination .current {
    background: #667eea;
    color: white;
}

/* Alerts */
.mylibrary-alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.mylibrary-alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.mylibrary-alert-error {
    background: #f8d7da;
    color: #721c;
    border-left-color: #dc3545;
}

.mylibrary-alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.mylibrary-alert-info {
    background: #d1ecf1;
    color: #0056b3;
    border-left-color: #17a2b8;
}

/* Loading States */
.mylibrary-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.mylibrary-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .mylibrary-container {
        padding: 15px;
    }
    
    .mylibrary-header {
        padding: 30px 15px;
    }
    
    .mylibrary-header h1 {
        font-size: 2em;
    }
    
    .mylibrary-nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    .mylibrary-nav a {
        width: 100%;
        text-align: center;
    }
    
    .mylibrary-dashboard {
        grid-template-columns: 1fr;
    }
    
    .mylibrary-search-form {
        flex-direction: column;
    }
    
    .mylibrary-search-input {
        min-width: auto;
    }
    
    .mylibrary-table {
        font-size: 0.9em;
    }
    
    .mylibrary-table th,
    .mylibrary-table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .mylibrary-book-card .book-actions {
        flex-direction: column;
    }
    
    .mylibrary-form {
        padding: 20px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mylibrary-container {
        color: #e9ef;
    }
    
    .mylibrary-card,
    .mylibrary-book-card,
    .mylibrary-form,
    .mylibrary-search,
    .mylibrary-table {
        background: #2d3748;
        color: #e9ef;
    }
    
    .mylibrary-nav {
        background: #2d3748;
    }
    
    .mylibrary-nav a {
        background: #4a5568;
        color: #e9ef;
    }
    
    .mylibrary-form-input,
    .mylibrary-form-textarea,
    .mylibrary-form-select {
        background: #4a5568;
        border-color: #718096;
        color: #e9ef;
    }
    
    .mylibrary-table th {
        background: #4a5568;
    }
    
    .mylibrary-table tr:hover {
        background: #4a5568;
    }
}

/* Accessibility */
.mylibrary-btn:focus,
.mylibrary-form-input:focus,
.mylibrary-form-textarea:focus,
.mylibrary-form-select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .mylibrary-nav,
    .mylibrary-book-actions,
    .mylibrary-btn {
        display: none !important;
    }
    
    .mylibrary-container {
        max-width: none;
        padding: 0;
    }
    
    .mylibrary-card,
    .mylibrary-book-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
} 

.mylibrary-modal {
  display: none;
} 

.mylibrary-dashboard-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    margin-bottom: 40px;
}
.mylibrary-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.08);
    padding: 32px 24px 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s, transform 0.2s;
    min-height: 180px;
}
.mylibrary-card:hover {
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.18);
    transform: translateY(-4px) scale(1.02);
}
.mylibrary-card h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin-bottom: 12px;
    color: #4a4a4a;
}
.mylibrary-card-count {
    font-size: 2.5em;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 18px;
}
.mylibrary-dashboard-dynamic-section {
    margin-top: 10px;
    margin-bottom: 30px;
}
@media (max-width: 900px) {
    .mylibrary-dashboard-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Load More Section Styles */
.mylibrary-load-more-section {
    background: transparent;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.mylibrary-load-more-info {
    margin-bottom: 20px;
    color: #6c757d;
    font-size: 0.95em;
}

.mylibrary-load-more-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.mylibrary-load-more-controls .mylibrary-btn {
    min-width: 120px;
}

/* Filters Section */
.mylibrary-filters {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.mylibrary-search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.95em;
}

.mylibrary-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.mylibrary-filter-select {
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: transparent;
    font-size: 0.95em;
    min-width: 150px;
}

.mylibrary-filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Responsive adjustments for filters */
@media (max-width: 768px) {
    .mylibrary-filters {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 12px;
    }
    
    .mylibrary-search-container {
        margin-bottom: 0;
        order: 1;
    }
    
    .mylibrary-search-input {
        min-width: auto;
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .mylibrary-search-hint {
        font-size: 0.75em;
        margin-top: 6px;
        margin-bottom: 8px;
        line-height: 1.3;
    }
    
    .mylibrary-search-actions {
        justify-content: center;
        margin-top: 10px;
    }
    
    .mylibrary-filter-select {
        min-width: auto;
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
        margin-bottom: 8px;
        order: 2;
    }
    
    #public-filter-btn {
        order: 3;
        width: 100%;
        margin-top: 8px;
    }
    
    .mylibrary-load-more-controls {
        flex-direction: column;
    }
    
    .mylibrary-load-more-controls .mylibrary-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* Additional mobile improvements for smaller screens */
@media (max-width: 480px) {
    .mylibrary-filters {
        padding: 12px;
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .mylibrary-search-container {
        margin-bottom: 0;
    }
    
    .mylibrary-search-hint {
        font-size: 0.7em;
        margin-top: 4px;
        margin-bottom: 6px;
    }
    
    .mylibrary-search-actions .mylibrary-btn {
        font-size: 0.9em;
        padding: 8px 16px;
        min-height: 44px; /* Better touch target */
    }
    
    .mylibrary-filter-select {
        padding: 8px 12px;
        margin-bottom: 6px;
        min-height: 44px; /* Better touch target */
    }
    
    #public-filter-btn {
        padding: 10px;
        font-size: 0.95em;
        min-height: 44px; /* Better touch target */
    }
    
    /* Improve touch targets for mobile */
    .mylibrary-search-input {
        min-height: 44px;
        padding: 10px 15px;
    }
    
    /* Section headers mobile optimization */
    .mylibrary-section-content h2 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .mylibrary-section-content p {
        font-size: 0.9em;
        margin-bottom: 15px;
        line-height: 1.4;
    }
    
    /* Dashboard sections mobile optimization */
    .mylibrary-dashboard-dynamic-section {
        margin-top: 5px;
        margin-bottom: 20px;
        padding: 0;
    }
    
    /* Ensure sections are properly displayed on mobile */
    #public-library-section,
    #my-library-section,
    #my-uploads-section,
    #currently-reading-section,
    #completed-section {
        display: block;
        width: 100%;
        overflow-x: hidden;
    }
    
    #public-library-section.active,
    #my-library-section.active,
    #my-uploads-section.active,
    #currently-reading-section.active,
    #completed-section.active {
        display: block !important;
    }
} 

.mylibrary-book-card .book-cover {
    position: relative;


/* Only show purple gradient when there's a placeholder (no cover image) */
.mylibrary-book-card .book-cover:has(.book-cover-placeholder) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.mylibrary-book-card .book-cover .book-number,
.book-card .book-cover .book-number,
.search-result-item .book-cover .book-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background-color: #764ba2;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
    border: 2px solid white;
}

.mylibrary-book-card .book-cover img {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center top;
    display: block;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    background: #fff;
    transition: transform 0.3s ease;
    margin-left: auto;
    margin-right: auto;
}

/* Real-time search styles */
.mylibrary-search-container {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-bottom: 15px;
}

.mylibrary-search-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
    gap: 10px;
    flex-wrap: wrap;
}

.mylibrary-search-hint {
    font-size: 0.8em;
    color: #666;
    margin-top: 8px;
    margin-bottom: 5px;
    font-style: italic;
    line-height: 1.4;
}

.mylibrary-loading {
    padding: 20px;
    text-align: center;
    color: #555;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 6px;
    margin: 20px 0;
}

/* Audio Player Modal Styles */
.mylibrary-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow-y: auto;
}

/* Prevent hidden modal overlays from intercepting pointer events */
.mylibrary-modal:not(.active) {
    pointer-events: none;
}

/* Login modal overlay - black with 70% opacity and higher stacking order */
#mylibrary-login-modal.mylibrary-modal {
    background-color: rgba(0, 0, 0, 0.7) !important;
    z-index: 10050 !important;
}

/* Make login modal title and body text visually prominent */
#mylibrary-login-modal.mylibrary-modal .modal-header h3 {
    color: #fff9c4 !important; /* light yellow */
    font-size: calc(1.5em + 2pt) !important;
}

#mylibrary-login-modal.mylibrary-modal .modal-body p {
    color: #fff9c4 !important; /* light yellow */
    font-size: calc(1em + 2pt) !important;
}

/* Ensure close button renders with light yellow text on the login modal */
#mylibrary-login-modal.mylibrary-modal .modal-close {
    color: #fff9c4 !important;
}

/* Avoid forcing all text to yellow - only target specific elements. */
/* This keeps button text customizable while preserving title/body styling. */

/* Only style the login/register buttons' text to blue */
#mylibrary-login-modal.mylibrary-modal .modal-content a#mylibrary-login-btn,
#mylibrary-login-modal.mylibrary-modal .modal-content a#mylibrary-register-btn {
    color: #007bff !important;
    -webkit-text-fill-color: #007bff !important;
}

.mylibrary-modal .modal-content {
    position: relative;
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease-out;
}

.mylibrary-modal .modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    background: none;
    border: none;
    color: #555;
    transition: color 0.2s;
}

.mylibrary-modal .modal-close:hover {
    color: #000;
}

.audio-player-container {
    margin-top: 20px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.audio-player-container audio {
    width: 100%;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Audio Player Modal Styles */
.listen-btn {
    background-color: #f50057;
    color: white;
    border: none;
    transition: background-color 0.3s;
}

.listen-btn:hover {
    background-color: #c51162;
}

#audio-player-modal .modal-content {
    max-width: 500px;
}

#audio-player-modal .modal-body {
    padding: 20px;
}

#audio-player {
    width: 100%;
    outline: none;
}

/* Book Grid and Card Styles - Permanent Design */
.mylibrary-books-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: 1 column by default */
    gap: 25px;
    margin: 20px 0;
    padding: 0;
    max-width: 1200px; /* Prevents excessive spreading on very wide screens */
    margin: 20px auto; /* Center the grid */
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
    .mylibrary-books-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }
}

/* Desktop: Prevent stretching for few items */
@media (min-width: 1024px) {
    .mylibrary-books-grid {
        grid-template-columns: repeat(auto-fill, 280px) !important;
        gap: 25px;
        justify-content: start;
        width: fit-content;
        max-width: none;
        margin: 20px auto;
    }
}

.mylibrary-book-card {
    background: transparent;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    /* cursor: pointer; - Removed to prevent mobile touch interference with buttons */
    height: auto;
    display: flex;
    flex-direction: column;
}

.mylibrary-book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.mylibrary-book-card .book-cover {
    position: relative;
    flex: 0 0 auto;
    height: auto;
    max-height: 665px;
    min-height: 200px;
    background: #ffffff;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 1;
    padding: 0;
}

/* Only show purple gradient when there's a placeholder (no cover image) */
.mylibrary-book-card .book-cover:has(.book-cover-placeholder) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 280px;
    min-height: 280px;
    max-height: 280px;
    flex: 0 0 280px;
    align-items: center;
}

.mylibrary-book-card .book-cover img {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center top;
    display: block;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    background: #fff;
    transition: transform 0.3s ease;
    margin-left: auto;
    margin-right: auto;
}

.mylibrary-book-card:hover .book-cover img {
    transform: scale(1.05);
}

.mylibrary-book-card .book-cover-placeholder {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.mylibrary-book-card .book-cover-placeholder span {
    font-size: 2em;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
}

.mylibrary-book-card .book-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
}

.mylibrary-book-card .book-info {
    padding: 20px;
    flex: 0 0 300px;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: none;
    overflow: auto;
    z-index: 2;
}

.mylibrary-book-card .book-title {
    font-size: 1.2em;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mylibrary-book-card .book-author {
    color: #666;
    font-size: 0.9em;
    margin: 0 0 12px 0;
    font-style: italic;
}

.mylibrary-book-card .book-description {
    color: #555;
    font-size: 0.85em;
    margin: 0 0 12px 0;
    line-height: 1.4;
    max-height: 150px;
    overflow-y: auto;
}

.mylibrary-book-card .book-genre {
    display: inline-block;
    background: #f8f9fa;
    color: #495057;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-bottom: 12px;
}

.mylibrary-book-card .book-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    margin: 0 0 12px 0;
}

.mylibrary-book-card .book-badge.gutenberg {
    background: #e3f2fd;
    color: #1976d2;
}

.mylibrary-book-card .book-badge.new {
    background: #e8f5e8;
    color: #2e7d2e;
}

.mylibrary-book-card .book-badge.popular {
    background: #fff3e0;
    color: #f57c00;
}

.mylibrary-book-card .book-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.mylibrary-book-card .book-actions .btn {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 6px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: center;
}

.mylibrary-book-card .book-actions .btn-primary {
    background: #667eea;
    color: white;
}

.mylibrary-book-card .book-actions .btn-primary:hover {
    background: #5a6fd8;
}

.mylibrary-book-card .book-actions .btn-secondary {
    background: #6c757d;
    color: white;
}

.mylibrary-book-card .book-actions .btn-secondary:hover {
    background: #5a6268;
}

.mylibrary-book-card .book-actions .btn-outline {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}

.mylibrary-book-card .book-actions .btn-outline:hover {
    background: #667eea;
    color: white;
}

.mylibrary-book-card .book-actions .btn-sm {
    padding: 4px 8px;
    font-size: 0.75em;
}

/* Responsive Design for Book Cards */
@media (max-width: 768px) {
    .mylibrary-book-card .book-cover {
        flex: 0 0 auto;
        height: auto;
        min-height: 300px;
        max-height: 450px;
    

/* Only show purple gradient when there's a placeholder (no cover image) */
.mylibrary-book-card .book-cover:has(.book-cover-placeholder) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
    
    .mylibrary-book-card .book-info {
        padding: 3px;
        flex: 1 1 auto;
        min-height: 150px;
        max-height: none;
    }
    
    .mylibrary-book-card .book-title {
        font-size: 1em;
        line-height: 1.2;
        -webkit-line-clamp: 3;
    }
}

@media (max-width: 480px) {
    .mylibrary-book-card .book-actions {
        flex-direction: column;
    }
    
    .mylibrary-book-card .book-actions .btn {
        width: 100%;
    }
}

/* Fix for button click issues - ensure buttons are clickable */
.mylibrary-book-card .book-actions {
    position: relative;
    z-index: 10;
}

.mylibrary-book-card .book-actions .btn {
    position: relative;
    z-index: 11;
    pointer-events: auto;
}

.mylibrary-book-card .book-actions .add-to-library-btn {
    z-index: 12;
    pointer-events: auto;
}

/* Remove from Library Button Styles */
.mylibrary-book-card .book-actions .btn-danger {
    background: #dc3545;
    color: white;
    margin-left: 5px;
}

.mylibrary-book-card .book-actions .btn-danger:hover {
    background: #c82333;
}

.mylibrary-book-card .book-actions .btn-danger:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* No books message styling */
.no-books-message {
    padding: 40px;
    text-align: center;
    color: #666;
}

.no-books-message h4 {
    margin-bottom: 10px;
    color: #333;
}

/* Modal Specific Styles */
.mylibrary-modal .go-back-btn {
    display: none !important;
}

.mylibrary-modal {
    display: none !important;
    position: fixed !important;
    z-index: 999999 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.mylibrary-modal.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mylibrary-modal .modal-content {
    background-color: #fff;
    border-radius: 8px;
    padding: 0;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}

/* Custom scrollbar styling for public modals */
.mylibrary-modal .modal-content::-webkit-scrollbar {
    width: 8px;
}

.mylibrary-modal .modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.mylibrary-modal .modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.mylibrary-modal .modal-content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.mylibrary-modal .modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mylibrary-modal .modal-header h3 {
    margin: 0;
    font-size: 1.5em;
    color: #333;
}

.mylibrary-modal .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.mylibrary-modal .modal-close:hover {
    color: #333;
}

.mylibrary-modal .modal-body {
    padding: 20px 30px;
}

/* Inline tooltip for share/copy actions */
.mylibrary-inline-tooltip {
    position: fixed;
    z-index: 1200000;
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Upload Modal Specific Styles */
#upload-book-modal .modal-content {
    max-width: 800px;
}

#upload-book-modal .mylibrary-upload-header h2 {
    margin-top: 0;
}

/* Mobile Button Fixes for Touch Events */
@media (max-width: 768px) {
    .mylibrary-book-card .btn {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 8px 12px !important;
        margin: 2px !important;
        font-size: 0.9em !important;
        line-height: 1.2 !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        touch-action: manipulation;
        /* cursor: pointer; - Removed to prevent mobile touch interference */
        pointer-events: auto !important;
        position: relative;
        z-index: 10;
    }
    
    .mylibrary-book-card .btn.processing {
        pointer-events: none;
        opacity: 0.7;
    }
    
    .mylibrary-book-card .btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        pointer-events: none;
    }
    
    .mylibrary-book-card .btn:active {
        transform: scale(0.98);
    }
    
    /* Ensure book action buttons are properly spaced on mobile */
    .mylibrary-book-card .book-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-start;
        margin-top: 8px;
        position: relative;
        z-index: 10;
        pointer-events: auto !important;
    }
    
    /* Prevent card background from interfering with button touches */
    .mylibrary-book-card .book-actions .btn {
        isolation: isolate;
        background-color: #007cba;
        border: 2px solid #007cba;
        color: white;
        text-decoration: none;
        display: inline-block;
        position: relative;
    }
    
    /* Ensure button hover states work properly on mobile */
    .mylibrary-book-card .book-actions .btn:hover,
    .mylibrary-book-card .book-actions .btn:focus {
        background-color: #005a87;
        border-color: #005a87;
        outline: none;
    }
    
    .mylibrary-book-card .book-actions .btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    /* Reading status actions mobile optimization */
    .reading-status-actions {
        margin-top: 8px !important;
        padding-top: 6px !important;
        border-top: 1px solid #eee !important;
    }
    
    .reading-status-actions .btn {
        width: 100% !important;
        text-align: center !important;
    }
    
    /* Mobile touch feedback */
    .btn.btn-touching {
        background-color: rgba(0, 0, 0, 0.1) !important;
        transform: scale(0.95) !important;
    }
}

/* ========================================
   NEWS STAND STYLES - Modern & Clean
   ======================================== */

/* Modern News Ticker */
.mylibrary-news-ticker {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.mylibrary-news-ticker::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.ticker-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    white-space: nowrap;
    padding-right: 20px;
    border-right: 2px solid rgba(255,255,255,0.3);
}

.ticker-icon {
    font-size: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.ticker-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.ticker-text {
    flex: 1;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
}

.ticker-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ticker-prev,
.ticker-next {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticker-prev:hover,
.ticker-next:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.ticker-indicator {
    font-size: 13px;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

/* News Stand Header */
.mylibrary-news-header {
    text-align: center;
    margin-bottom: 35px;
}

.mylibrary-news-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.mylibrary-news-header p {
    font-size: 16px;
    color: #7f8c8d;
}

/* Clean, modern news grid */
.mylibrary-news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.mylibrary-news-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.mylibrary-news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.news-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.mylibrary-news-card:hover .news-image img {
    transform: scale(1.05);
}

.news-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.news-image-placeholder span {
    font-size: 60px;
    opacity: 0.5;
}

.news-content {
    padding: 20px;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
}

.news-category {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
}

.news-date {
    color: #95a5a6;
}

.news-title {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    line-height: 1.4;
}

.news-excerpt {
    color: #7f8c8d;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.news-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.read-indicator {
    color: #27ae60;
    font-size: 13px;
    font-weight: 600;
}

/* Responsive News Stand */
@media (max-width: 768px) {
    .mylibrary-news-ticker {
        flex-direction: column;
        gap: 12px;
        padding: 12px 15px;
    }
    
    .ticker-label {
        border-right: none;
        border-bottom: 2px solid rgba(255,255,255,0.3);
        padding-right: 0;
        padding-bottom: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .ticker-content {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .ticker-text {
        text-align: center;
        font-size: 14px;
    }
    
    .mylibrary-news-header h2 {
        font-size: 24px;
    }
    
    .mylibrary-news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Book Language Display Styles */
.mylibrary-book-card .book-language {
    color: #666;
    font-size: 0.9em;
    margin: 0 0 10px 0;
    font-style: italic;
    display: block;
}

/* Clickable book cover */
.mylibrary-book-card .book-cover {
    cursor: pointer;
}

.mylibrary-book-card .book-cover:hover {
    opacity: 0.95;
}

/* EMERGENCY FIX: Absolutely prevent book card stretching on desktop */
@media (min-width: 1024px) {
    .mylibrary-books-grid,
    div.mylibrary-books-grid,
    .mylibrary-books-grid[class] {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, 280px) !important;
        gap: 25px !important;
        justify-content: start !important;
        width: fit-content !important;
        max-width: none !important;
        margin: 20px auto !important;
        justify-items: start !important;
        align-content: start !important;
    }
}