:root {
    --content-margin-left: 20px;
    --content-margin-right: 180px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: white;
    color: black;
    line-height: 1.4;
}

/* Link styles */
a {
    color: black !important;
    text-decoration: underline;
}

a:visited {
    color: black !important;
}

a:hover {
    color: #333 !important;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 0;
}

.header {
    padding-bottom: 10px;
    margin-bottom: 0px;
    margin-right: var(--content-margin-right);
    margin-left: var(--content-margin-left);
}

.title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 2px;
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.subtitle {
    font-size: 16px;
    color: #666;
    font-style: italic;
    font-weight: normal;
    letter-spacing: normal;
}

.beta-notice {
    margin-top: 15px;
    padding: 10px 15px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 14px;
    color: #856404;
}

.beta-notice a {
    color: #0066cc;
    text-decoration: underline;
}

.beta-notice a:hover {
    color: #004499;
}

.search-container {
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 5px;
    padding: 15px 0;
    background-color: white;
}

.search-nav {
    margin-top: 10px;
    margin-left: var(--content-margin-left);
    width: calc(100% - var(--content-margin-left) - var(--content-margin-right));
}

.search-nav-title {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: #666;
}

.search-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-nav-link {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    text-transform: uppercase;
    padding: 4px 8px;
    border: 1px solid #ccc;
    background-color: white;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
    text-decoration: none;
}

.search-nav-link:hover {
    background-color: #f0f0f0;
    border-color: #999;
    color: #333;
}

.browse-section {
    margin-bottom: 30px;
}

.search-box {
    margin-left: var(--content-margin-left);
    width: calc(100% - var(--content-margin-left) - var(--content-margin-right));
    margin-bottom: 15px;
    padding: 15px;
    border: 2px solid black;
    background-color: white;
    font-family: 'Courier New', monospace;
    font-size: 16px;
}

.search-box:focus {
    outline: none;
    background-color: black;
    color: white;
}

.category-filters {
    margin-bottom: 15px;
    margin-top: 35px;
}

.platform-filters {
    margin-bottom: 15px;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    transition: all 0.3s ease;
    overflow: hidden;
    margin-left: var(--content-margin-left);
    margin-right: var(--content-margin-right);
}

.filter-buttons.collapsed {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
}

.filter-btn {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    text-transform: uppercase;
    padding: 8px 12px;
    border: 1px solid black;
    background-color: white;
    color: black;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.filter-btn:hover {
    background-color: black;
    color: white;
}

.filter-btn.active {
    background-color: black;
    color: white;
}

.random-pick-section {
    margin-bottom: 20px;
}

.section-header {
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid black;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    width: calc(100% - var(--content-margin-left) - var(--content-margin-right));
    margin-left: var(--content-margin-left);
}

.clear-search-btn {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    padding: 0;
    margin: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    line-height: 1;
}

.clear-search-btn:hover {
    color: #000;
}

.section-header.collapsible {
    cursor: pointer;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    user-select: none;
    padding: 5px 0;
}

.collapse-indicator {
    font-size: 16px;
    font-weight: bold;
    transition: transform 0.2s ease;
    margin-right: 8px;
    order: -1;
}

.section-header.collapsible:hover {
    background-color: #f9f9f9;
}

.section-header.expanded .collapse-indicator {
    transform: rotate(45deg);
}

.random-pick-card {
    width: 280px;
    border: 1px solid black;
    padding: 15px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 180px;
    /* Book spine effect */
    border-left: 4px solid black;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.random-pick-card::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #f0f0f0 0%, #d0d0d0 50%, #f0f0f0 100%);
    border-right: 1px solid #ccc;
}

.random-pick-card:hover {
    background-color: black;
    color: white;
    transform: translateX(2px);
}

.random-pick-name {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
}

.random-pick-meta {
    font-size: 10px;
    margin-bottom: 5px;
    color: #666;
}

.random-pick-card:hover .random-pick-meta {
    color: #ccc;
}

.random-pick-description {
    font-size: 12px;
    margin-bottom: 10px;
    line-height: 1.3;
}

.random-pick-details {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.random-pick-category {
    font-size: 11px;
    text-transform: uppercase;
    border: 1px solid black;
    padding: 3px 8px;
}

.random-pick-card:hover .random-pick-category {
    border-color: white;
    color: white;
}

.refresh-random {
    font-size: 11px;
    text-transform: uppercase;
    border: 1px solid black;
    padding: 3px 8px;
    background: none;
    font-family: 'Courier New', monospace;
    cursor: pointer;
}

.refresh-random:hover {
    background-color: black;
    color: white;
}

.sort-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: var(--content-margin-left);
    width: calc(100% - var(--content-margin-left) - var(--content-margin-right));
    justify-content: space-between;
}

.sort-btn {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    text-transform: uppercase;
    padding: 10px 15px;
    border: 2px solid black;
    background-color: white;
    color: black;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
    font-weight: bold;
}

.sort-btn:hover {
    background-color: black;
    color: white;
}

.sort-btn.active {
    background-color: black;
    color: white;
}

.active-filters {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #e8e8e8;
    border: 1px solid #999;
    border-radius: 4px;
}

.active-filters-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.clear-filters-btn {
    padding: 4px 8px;
    border: 1px solid #666;
    background-color: white;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
    border-radius: 3px;
}

.clear-filters-btn:hover {
    background-color: #f0f0f0;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 280px);
    gap: 15px;
    grid-auto-rows: 180px;
    justify-content: space-between;
    margin-left: var(--content-margin-left);
    width: calc(100% - var(--content-margin-left) - var(--content-margin-right));
}

/* Search grouping styles */
.search-group {
    margin-bottom: 30px;
    width: 100%;
}

.search-group-header {
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid black;
    color: black;
    width: 100%;
}

.search-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 280px);
    gap: 15px;
    grid-auto-rows: 180px;
    justify-content: space-between;
    width: 100%;
}

.library-card {
    border: 1px solid black;
    padding: 15px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 180px;
    /* Book spine effect */
    border-left: 4px solid black;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.library-card::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #f0f0f0 0%, #d0d0d0 50%, #f0f0f0 100%);
    border-right: 1px solid #ccc;
}

.library-card:hover {
    background-color: black;
    color: white;
    transform: translateX(2px);
    box-shadow: -2px 2px 0px rgba(0,0,0,0.3);
}

.library-card:hover::before {
    background: linear-gradient(to bottom, #333 0%, #111 50%, #333 100%);
    border-right-color: #555;
}

.library-name {
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 5px;
    /* Book title styling */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.library-version {
    font-size: 11px;
    margin-bottom: 3px;
    color: #666;
    font-weight: normal;
}

.library-card:hover .library-version {
    color: #ccc;
}

.library-author {
    font-size: 11px;
    margin-bottom: 8px;
    font-style: italic;
    color: #333;
}

.library-updated {
    font-size: 10px;
    margin-bottom: 3px;
    color: #666;
}

.library-stars {
    font-size: 10px;
    margin-bottom: 8px;
    color: #666;
    font-weight: bold;
}

.library-card:hover .library-updated,
.library-card:hover .library-stars {
    color: #ccc;
}

.library-card:hover .library-author {
    color: #ccc;
}

.library-description {
    font-size: 12px;
    margin-bottom: 8px;
    line-height: 1.3;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    color: #333;
}

.library-category {
    font-size: 10px;
    text-transform: uppercase;
    border: 1px solid black;
    padding: 2px 5px;
    display: inline-block;
    margin-top: auto;
    align-self: flex-start;
}

.library-card:hover .library-category {
    border-color: white;
    color: white;
}

.loading {
    text-align: center;
    padding: 50px;
    font-size: 16px;
}

.no-results {
    text-align: center;
    padding: 50px;
    border: 1px solid black;
    margin-top: 20px;
}

/* Load More Button Styles */
.load-more-container {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
}

.load-more-btn {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-transform: uppercase;
    padding: 15px 30px;
    border: 2px solid black;
    background-color: white;
    color: black;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
    font-weight: bold;
    margin-bottom: 10px;
}

.load-more-btn:hover {
    background-color: black;
    color: white;
}

.load-more-info {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .library-grid {
        grid-template-columns: repeat(auto-fill, 250px);
    }
    
    .search-group-grid {
        grid-template-columns: repeat(auto-fill, 250px);
    }
}

@media (max-width: 768px) {
    :root {
        --content-margin-left: 10px;
        --content-margin-right: 10px;
    }
    
    .library-grid {
        grid-template-columns: repeat(auto-fill, 220px);
        gap: 10px;
    }
    
    .search-group-grid {
        grid-template-columns: repeat(auto-fill, 220px);
        gap: 10px;
    }
    
    .search-nav-links {
        gap: 6px;
    }
    
    .search-nav-link {
        font-size: 9px;
        padding: 3px 6px;
    }
    
    .container {
        padding: 15px 0;
    }
    
    .title {
        font-size: 24px;
    }
    
    .random-pick-card {
        padding: 20px;
    }
    
    .random-pick-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .filter-buttons {
        gap: 5px;
    }
    
    .filter-btn {
        padding: 6px 10px;
        font-size: 10px;
    }
    
    .sort-buttons {
        gap: 6px;
    }
    
    .sort-btn {
        padding: 8px 12px;
        font-size: 10px;
    }
}

/* Library Detail Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    border: 3px solid black;
    max-width: 900px;
    max-height: 90vh;
    width: 90%;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    position: relative;
}

.modal-header {
    padding: 20px;
    border-bottom: 2px solid black;
    background-color: #f9f9f9;
}

.modal-title {
    font-size: 40px;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.copy-name-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 7px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
}

.copy-name-btn:hover {
    background-color: #f0f0f0;
    border-color: #999;
}

.modal-subtitle {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: 2px solid black;
    border-radius: 2px;
    font-size: 18px;
    font-weight: bold;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: black;
    color: white;
}

.modal-body {
    padding: 20px;
}

.detail-section {
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    color: #666;
}

.detail-value {
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
}

.detail-value a {
    color: black;
    text-decoration: underline;
}

.detail-value a:hover {
    background-color: black;
    color: white;
}

.neighbors-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid black;
}

.neighbors-title {
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.neighbors-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
}

.neighbor-card {
    min-width: 120px;
    border: 1px solid black;
    padding: 8px;
    background-color: #f9f9f9;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
}

.neighbor-card:hover {
    background-color: black;
    color: white;
}

.neighbor-card.current {
    background-color: black;
    color: white;
    font-weight: bold;
}

.neighbor-name {
    font-weight: bold;
    margin-bottom: 3px;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.neighbor-author {
    font-size: 9px;
    color: #666;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.neighbor-card:hover .neighbor-author {
    color: #ccc;
}

.neighbor-card.current .neighbor-author {
    color: #ccc;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-title {
        font-size: 24px;
        gap: 8px;
    }
    
    .modal-close {
        top: 10px;
        right: 20px;
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .copy-name-btn {
        font-size: 11px;
        padding: 3px 5px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .neighbors-grid {
        gap: 8px;
    }
    
    .neighbor-card {
        min-width: 100px;
        padding: 6px;
    }
}

@media (max-width: 480px) {
    :root {
        --content-margin-left: 8px;
        --content-margin-right: 8px;
    }
    
    .library-grid {
        grid-template-columns: repeat(auto-fill, 170px);
        gap: 8px;
    }
    
    .search-group-grid {
        grid-template-columns: repeat(auto-fill, 170px);
        gap: 8px;
    }
    
    .library-card {
        padding: 12px;
    }
    
    .library-name {
        font-size: 13px;
    }
    
    .library-description {
        font-size: 11px;
        min-height: 30px;
    }
    
    .modal-title {
        font-size: 18px;
        gap: 6px;
    }
    
    .modal-close {
        top: 8px;
        right: 16px;
        width: 26px;
        height: 26px;
        font-size: 14px;
    }
    
    .copy-name-btn {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    .modal-header {
        padding: 12px;
    }
    
    .modal-body {
        padding: 12px;
    }
}

/* About section */
.about-section {
    margin-bottom: 10px;
}

.about-section .section-header {
    border-bottom: none;
    padding-bottom: 0;
}

.about-content {
    transition: all 0.3s ease;
    overflow: hidden;
    margin-top: 15px;
    padding: 0;
    margin-left: var(--content-margin-left);
    margin-right: var(--content-margin-right);
}

.about-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.about-content p {
    margin: 0;
    line-height: 1.6;
    font-size: 14px;
    color: #333;
}

.about-content a {
    color: #0066cc;
    text-decoration: underline;
}

/* Library of the Day styles */
.library-of-the-day-section {
    margin-bottom: 30px;
}

.library-of-the-day-section #libraryOfTheDay {
    display: flex;
    justify-content: flex-start;
    margin-left: var(--content-margin-left);
    width: calc(100% - var(--content-margin-left) - var(--content-margin-right));
}

.library-of-the-day-section .library-card {
    width: 280px;
    flex-shrink: 0;
}

/* Accessibility - Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* SEO and semantic improvements */
h1, h2, h3, h4, h5, h6 {
    font-weight: bold;
}

/* Improve focus indicators for accessibility */
button:focus,
input:focus,
a:focus {
    outline: 2px solid #00979D;
    outline-offset: 2px;
}

/* Skip link for accessibility (add if needed) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #00979D;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}
