/* Browse Page Styles */
.browse-page {
    padding: 2vw;
    max-width: 1200px;
    margin: 0 auto;
}

.browse-header {
    margin-bottom: 24px;
    background: #2a2a2a;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.browse-search {
    margin-bottom: 16px;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 600px;
}

.search-container .search-input {
    flex: 1;
}

/* Filter toggle button styles */
.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #4ade80;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 48px;
}

.filter-toggle-btn:hover {
    background: #22c55e;
    transform: translateY(-1px);
}

.filter-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* Responsive filter toggle button */
@media (max-width: 768px) {
    .browse-header {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .browse-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }
    
    .view-toggle {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }
    
    .sort-controls {
        justify-content: space-between;
    }
    
    .filter-toggle-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .filter-toggle-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .browse-header {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .browse-search .search-container {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-toggle-btn {
        padding: 10px 12px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }
    
    .filter-toggle-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .browse-controls {
        padding: 10px;
    }
    
    .sort-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .sort-select {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
}

.browse-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background: #2a2a2a;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.view-toggle {
    display: flex;
    align-items: center;
}



.results-info {
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-select {
    background-color: #1a1a1a;
    color: white;
    border: 1px solid #333;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

.sort-select:focus {
    border-color: #4ade80;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}

.browse-content {
    display: flex;
    gap: 2.4vw;
}

.filters-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.filters-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.6vw;
}

.filter-group {
    margin-bottom: 2.4vw;
}

.filter-group h4 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1.2vw;
    color: #d1d5db;
}

.filter-scrollable {
    max-height: 200px;
    overflow-y: auto;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.8vw;
    margin-bottom: 0.8vw;
    cursor: pointer;
    font-size: 0.875rem;
    color: #d1d5db;
}

.filter-checkbox input {
    margin: 0;
}

.novels-content {
    flex: 1;
}

/* Horizontal novel articles for browse page */
.browse-novels-grid {
    display: flex;
    flex-direction: column;
    gap: 1.6vw;
    padding: 2vw 0;
}

.browse-grid {
    display: flex;
    flex-direction: column;
    gap: 1.6vw;
}

/* Horizontal novel article layout */
.browse-novel-article {
    display: flex;
    background: #3c3c3c;
    border-radius: 12px;
    overflow: hidden;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    min-height: 280px;
    width: 100%;
}

.browse-novel-article:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.browse-novel-article .novel-cover {
    width: 180px;
    height: 280px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    line-height: 0;
    font-size: 0;
}

.browse-novel-article .novel-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.browse-novel-article:hover .novel-cover img {
    transform: scale(1.05);
}

.browse-novel-article .cover-placeholder {
    color: #666;
    text-align: center;
}

.browse-novel-article .novel-content { 
    flex: 1;
    padding: 1.2vw 1.5vw 0.8vw 1.5vw;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    color: #ffffff;
    min-width: 0;
    overflow: hidden;
    gap: 0; /* removes flex gap between children */
}

.browse-novel-article .novel-content > * {
    margin: 0; /* removes default margins from child divs */
}


.browse-novel-article .novel-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
    color: #ffffff;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    max-width: 100%;
}

.browse-novel-article .novel-meta {
    display: flex;
    align-items: center;
    gap: 1.6vw;
    margin-bottom: 0.6vw;
    font-size: 0.85rem;
    color: #b3b3b3;
    flex-wrap: wrap;
}

.browse-novel-article .rating {
    display: flex;
    align-items: center;
    gap: 0.6vw;
    color: #fbbf24;
    font-weight: 600;
}

.browse-novel-article .rating svg {
    color: #fbbf24;
    width: 16px;
    height: 16px;
    fill: #fbbf24;
}

.browse-novel-article .status-badge {
    padding: 0;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: none;
    border: none;
    color: #b3b3b3;
}

.browse-novel-article .novel-synopsis {
    margin-bottom: 0.6vw;
}

.browse-novel-article .synopsis-text {
    color: #ffffff;
    font-size: 0.9rem;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    max-width: 100%;
}

.browse-novel-article .novel-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6vw;
    margin-bottom: 2vw;
}

.browse-novel-article .genre-tag {
    background: transparent;
    color: #b3b3b3;
    padding: 0;
    border-radius: 0;
    font-size: 0.875rem;
    font-weight: 400;
    border: none;
}

.browse-novel-article .genre-tag:not(:last-child)::after {
    content: ", ";
    color: #b3b3b3;
}

.browse-novel-article .novel-actions {
    display: flex;
    gap: 1.2vw;
    align-items: center;
    margin-bottom: 0.4vw;
}

.browse-novel-article .read-now-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #4ade80;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    flex: 1;
    justify-content: center;
    min-height: 48px;
}

.browse-novel-article .read-now-btn:hover {
    background: #22c55e;
    transform: translateY(-1px);
}

.browse-novel-article .bookmark-btn,
.browse-novel-article .reading-list-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #374151;
    color: #d1d5db;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 48px;
    min-height: 48px;
}

.browse-novel-article .bookmark-btn:hover,
.browse-novel-article .reading-list-btn:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.browse-novel-article .bookmark-btn.bookmarked {
    background: #fbbf24;
    color: #1a1a1a;
}

.browse-novel-article .bookmark-btn.bookmarked:hover {
    background: #f59e0b;
}

.browse-novel-article .reading-list-btn {
    background: #8b5cf6;
    color: white;
}

.browse-novel-article .reading-list-btn:hover {
    background: #7c3aed;
}

.browse-novel-article .bookmark-btn:disabled,
.browse-novel-article .reading-list-btn:disabled {
    opacity: 0.6;
    transform: none;
    cursor: not-allowed;
}

/* Enhanced Responsive Design for Browse Page */
/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .browse-page {
        padding: 16px;
        max-width: 100%;
    }
    
    .browse-content {
        gap: 20px;
    }
    
    .filters-sidebar {
        width: 220px;
    }
    
    .browse-novel-article .novel-cover {
        width: 140px;
        height: 220px;
    }
    
    .browse-novel-article .novel-content {
        padding: 12px 16px;
    }
    
    .browse-novel-article .novel-title {
        font-size: 1.125rem;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .browse-page {
        padding: 12px;
    }
    
    .browse-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .filters-sidebar {
        width: 100%;
        order: 2;
    }
    
    .novels-content {
        order: 1;
    }
    
    .browse-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .sort-controls {
        justify-content: space-between;
    }
    
    .browse-novel-article {
        flex-direction: column;
        min-height: auto;
    }
    
    .browse-novel-article .novel-cover {
        width: 100%;
        height: 280px;
    }
    
    .browse-novel-article .novel-content {
        padding: 16px;
        min-width: 0;
        overflow: hidden;
    }
    
    .browse-novel-article .novel-title {
        word-wrap: break-word;
        word-break: break-word;
    }
    
    .browse-novel-article .synopsis-text {
        word-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        overflow-wrap: break-word;
    }
    
    .browse-novel-article .novel-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .browse-novel-article .read-now-btn,
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        width: 100%;
        justify-content: center;
        max-width: none;
        padding: 12px 16px;
        font-size: 14px;
        min-width: 0;
    }
    
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        min-width: 48px;
        min-height: 48px;
        padding: 12px;
    }
    
    .browse-novel-article .novel-meta {
        gap: 12px;
        flex-wrap: wrap;
    }
    
    .browse-novel-article .novel-genres {
        margin-bottom: 12px;
        flex-wrap: wrap;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .browse-page {
        padding: 8px;
    }
    
    .browse-header {
        margin-bottom: 16px;
    }
    
    .browse-search {
        margin-bottom: 12px;
    }
    
    .browse-controls {
        gap: 8px;
    }
    
    .results-info {
        font-size: 0.8rem;
        text-align: center;
    }
    
    .sort-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .sort-select {
        width: 100%;
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .browse-novel-article {
        border-radius: 8px;
        margin-bottom: 12px;
        min-height: auto;
    }
    
    .browse-novel-article .novel-cover {
        height: 180px;
    }
    
    .browse-novel-article .novel-content {
        padding: 12px;
        min-width: 0;
        overflow: hidden;
    }
    
    .browse-novel-article .novel-title {
        font-size: 1rem;
        margin-bottom: 6px;
        word-wrap: break-word;
        word-break: break-word;
    }
    
    .browse-novel-article .novel-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 8px;
    }
    
    .browse-novel-article .synopsis-text {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 8px;
        word-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        overflow-wrap: break-word;
    }
    
    .browse-novel-article .novel-genres {
        margin-bottom: 8px;
        flex-wrap: wrap;
    }
    
    .browse-novel-article .genre-tag {
        font-size: 0.8rem;
    }
    
    .browse-novel-article .novel-actions {
        gap: 8px;
        margin-bottom: 8px;
        flex-wrap: wrap;
    }
    
    .browse-novel-article .read-now-btn,
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        padding: 10px 12px;
        font-size: 14px;
        min-width: 0;
        flex: 1;
        min-width: 120px;
    }
    
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
}

/* Small mobile phones */
@media (max-width: 360px) {
    .browse-page {
        padding: 6px;
    }
    
    .browse-novel-article .novel-cover {
        height: 160px;
    }
    
    .browse-novel-article .novel-content {
        padding: 10px;
        min-width: 0;
        overflow: hidden;
    }
    
    .browse-novel-article .novel-title {
        font-size: 0.95rem;
        word-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        overflow-wrap: break-word;
    }
    
    .browse-novel-article .synopsis-text {
        font-size: 0.8rem;
        word-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        overflow-wrap: break-word;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    .browse-novel-article .read-now-btn,
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        padding: 8px 10px;
        font-size: 14px;
        min-height: 44px; /* Better touch target */
        min-width: 0;
        flex: 1;
    }
    
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        min-width: 44px;
        padding: 8px;
    }
    
    .browse-novel-article .novel-actions {
        flex-wrap: wrap;
        gap: 6px;
    }
}

/* Touch-friendly improvements for mobile */
@media (max-width: 768px) {
    .browse-novel-article .read-now-btn,
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        min-height: 44px; /* iOS recommended touch target size */
    }
    
    .sort-select {
        min-height: 44px;
        padding: 12px;
    }
    
    .filter-toggle-btn {
        min-height: 44px;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .browse-novel-article {
        flex-direction: row;
        min-height: 120px;
    }
    
    .browse-novel-article .novel-cover {
        width: 100px;
        height: 120px;
    }
    
    .browse-novel-article .novel-content {
        padding: 12px;
        min-width: 0;
        overflow: hidden;
    }
    
    .browse-novel-article .novel-title {
        font-size: 0.95rem;
        -webkit-line-clamp: 1;
        line-clamp: 1;
        word-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        overflow-wrap: break-word;
    }
    
    .browse-novel-article .synopsis-text {
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 6px;
        word-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        overflow-wrap: break-word;
    }
    
    .browse-novel-article .novel-actions {
        flex-direction: row;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .browse-novel-article .read-now-btn,
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        width: auto;
        padding: 6px 10px;
        font-size: 12px;
        min-width: 0;
        flex: 1;
        min-width: 80px;
    }
    
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        min-width: 44px;
        padding: 6px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .browse-novel-article .novel-cover img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .browse-novel-article,
    .browse-novel-article:hover,
    .browse-novel-article .novel-cover img,
    .browse-novel-article:hover .novel-cover img,
    .browse-novel-article .read-now-btn:hover,
    .browse-novel-article .bookmark-btn:hover,
    .browse-novel-article .reading-list-btn:hover {
        transition: none;
        transform: none;
    }
}

/* Dark mode support (if not already dark) */
@media (prefers-color-scheme: dark) {
    .browse-novel-article {
        background: #2a2a2a;
    }
    
    .browse-novel-article .novel-cover {
        background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    }
}

/* Loading state improvements */
.browse-novel-article.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Focus states for accessibility */
.browse-novel-article:focus-within {
    outline: 2px solid #4ade80;
    outline-offset: 2px;
}

.sort-select:focus,
.filter-toggle-btn:focus,
.search-input:focus,
.browse-novel-article .read-now-btn:focus,
.browse-novel-article .bookmark-btn:focus,
.browse-novel-article .reading-list-btn:focus {
    outline: 2px solid #4ade80;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .browse-novel-article {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .filter-toggle-btn,
    .browse-novel-article .read-now-btn,
    .browse-novel-article .bookmark-btn,
    .browse-novel-article .reading-list-btn {
        display: none;
    }
}

/* Simple Responsive Scaling */
@media (max-width: 1200px) {
    .browse-page {
        padding: 3vw;
    }
    
    .browse-novel-article .novel-cover {
        width: 140px;
        height: 190px;
    }
}

@media (max-width: 900px) {
    .browse-page {
        padding: 4vw;
    }
    
    .browse-content {
        flex-direction: column;
        gap: 3vw;
    }
    
    .filters-sidebar {
        width: 100%;
    }
    
    .browse-novel-article .novel-cover {
        width: 120px;
        height: 170px;
    }
}

@media (max-width: 600px) {
    .browse-page {
        padding: 5vw;
    }
    
    .browse-novel-article {
        flex-direction: column;
    }
    
    .browse-novel-article .novel-cover {
        width: 100%;
        height: 280px;
    }
    
    .browse-novel-article .novel-content {
        padding: 4vw;
    }
    
    .browse-controls {
        flex-direction: column;
        gap: 2vw;
    }
    
    .browse-novel-article .novel-actions {
        flex-direction: column;
        gap: 2vw;
    }
    
    .browse-novel-article .read-now-btn,
    .browse-novel-article .bookmark-btn {
        width: 100%;
        max-width: none;
        padding: 3vw 4vw;
    }
}

@media (max-width: 400px) {
    .browse-page {
        padding: 6vw;
    }
    
    .browse-novel-article .novel-content {
        padding: 5vw;
    }
    
    .browse-novel-article .novel-title {
        font-size: 1.1rem;
    }
    
    .browse-novel-article .synopsis-text {
        font-size: 0.85rem;
    }
}
