/* ============================================================
   WRITERS HUB — MOBILE RESPONSIVENESS ENHANCEMENTS
   Additional responsive styles for better mobile experience
   Include this after app.css
   ============================================================ */

/* Enhanced Book Card Styles */
.book-card {
    display: block;
    background: var(--glass, rgba(255,255,255,.72));
    border-radius: var(--radius-md, 14px);
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    box-shadow: var(--shadow-sm, 0 12px 28px -18px rgba(49,46,129,.45));
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow, 0 22px 48px -26px rgba(49,46,129,.5));
}

.book-cover-wrap {
    position: relative;
    aspect-ratio: 2/3;
    background: linear-gradient(135deg, #f3e7ff 0%, #e0d4f7 100%);
    overflow: hidden;
}

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

.book-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary, #6366f1) 0%, var(--color-secondary, #ec4899) 100%);
    color: white;
    font-size: 3rem;
    font-weight: 700;
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    text-transform: uppercase;
}

.book-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.badge-featured {
    background: rgba(236, 72, 153, 0.9);
    color: white;
}

.badge-trending {
    background: rgba(245, 158, 11, 0.9);
    color: white;
}

.book-overlay {
    position: absolute;
    inset: 0;
    background: rgba(30, 27, 75, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s;
}

.book-card:hover .book-overlay {
    opacity: 1;
}

.btn-read {
    padding: 10px 24px;
    background: white;
    color: var(--ink, #1e1b4b);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transform: translateY(8px);
    transition: transform .25s;
}

.book-card:hover .btn-read {
    transform: translateY(0);
}

.book-info {
    padding: 16px;
}

.book-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink, #1e1b4b);
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 0.85rem;
    color: var(--muted, #6b7091);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--faint, #9aa0bf);
}

.book-reads,
.book-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.book-reads svg,
.book-pages svg {
    opacity: 0.6;
}

/* Book Grid Improvements */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.books-grid-featured {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Category Card Improvements */
.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
    background: var(--glass, rgba(255,255,255,.72));
    border-radius: var(--radius-md, 14px);
    border: 1px solid var(--glass-brd, rgba(255,255,255,.65));
    transition: transform .2s, box-shadow .2s;
    box-shadow: var(--shadow-sm, 0 12px 28px -18px rgba(49,46,129,.45));
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow, 0 22px 48px -26px rgba(49,46,129,.5));
}

.cat-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.cat-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink, #1e1b4b);
    margin-bottom: 6px;
}

.cat-count {
    font-size: 0.85rem;
    color: var(--muted, #6b7091);
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 24px;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 1024px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 18px;
    }
    
    .book-info {
        padding: 14px;
    }
    
    .book-title {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
    }
    
    .books-grid-featured {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .book-info {
        padding: 12px;
    }
    
    .book-title {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }
    
    .book-author {
        font-size: 0.8rem;
    }
    
    .book-meta {
        gap: 10px;
        font-size: 0.75rem;
    }
    
    .book-badge {
        padding: 3px 8px;
        font-size: 0.65rem;
        top: 8px;
        right: 8px;
    }
    
    .cat-icon {
        font-size: 2rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 14px;
    }
    
    .category-card {
        padding: 20px 12px;
    }
    
    /* Improve header on mobile */
    .header-inner {
        height: 56px;
        gap: 12px;
    }
    
    .site-logo img {
        height: 32px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
    
    /* Hero improvements */
    .hero {
        padding: 48px 0 40px;
    }
    
    .hero-title {
        font-size: 1.9rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
    }
    
    .btn-hero {
        padding: 12px 28px;
        font-size: 0.95rem;
    }
}

@media (max-width: 640px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 14px;
    }
    
    .books-grid-featured {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    
    .book-info {
        padding: 10px;
    }
    
    .book-title {
        font-size: 0.85rem;
    }
    
    .book-author {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }
    
    .book-meta {
        gap: 8px;
        font-size: 0.7rem;
    }
    
    .book-cover-placeholder {
        font-size: 2.5rem;
    }
    
    .book-overlay {
        display: none; /* Remove overlay on small mobile */
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .book-info {
        padding: 8px;
    }
    
    .book-title {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        margin-bottom: 4px;
    }
    
    .book-author {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }
    
    .book-meta {
        gap: 6px;
        font-size: 0.65rem;
    }
    
    .book-reads svg,
    .book-pages svg {
        width: 12px;
        height: 12px;
    }
    
    .book-badge {
        padding: 2px 6px;
        font-size: 0.6rem;
        top: 6px;
        right: 6px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .category-card {
        padding: 16px 10px;
    }
    
    .cat-icon {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .cat-name {
        font-size: 0.9rem;
    }
    
    .cat-count {
        font-size: 0.75rem;
    }
    
    .hero {
        padding: 40px 0 32px;
    }
    
    .hero-title {
        font-size: 1.6rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .btn-hero {
        padding: 10px 24px;
        font-size: 0.9rem;
    }
    
    .section {
        padding: 32px 0;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 375px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .book-title {
        font-size: 0.75rem;
    }
    
    .book-author {
        font-size: 0.65rem;
    }
    
    .book-meta {
        display: none; /* Hide metadata on very small screens */
    }
    
    .hero-title {
        font-size: 1.4rem;
    }
}

/* Touch improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    .book-card {
        -webkit-tap-highlight-color: transparent;
    }
    
    .book-card:active {
        transform: scale(0.98);
    }
    
    .category-card:active {
        transform: scale(0.98);
    }
    
    .btn-hero:active,
    .nav-link:active {
        transform: scale(0.98);
    }
}

/* Prevent layout shift */
.book-cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Loading state */
.book-card.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Empty state */
.books-grid:empty::after,
.categories-grid:empty::after {
    content: "No items to display";
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--muted, #6b7091);
    font-size: 1rem;
}

/* Improved section spacing */
.section {
    padding: 60px 0;
}

.section-alt {
    background: rgba(255, 255, 255, 0.4);
    border-top: 1px solid var(--hairline, rgba(99,102,241,.14));
    border-bottom: 1px solid var(--hairline, rgba(99,102,241,.14));
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--ink, #1e1b4b);
}

.section-link {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-primary, #6366f1);
    transition: color .2s;
}

.section-link:hover {
    color: var(--color-secondary, #ec4899);
}

@media (max-width: 768px) {
    .section {
        padding: 48px 0;
    }
    
    .section-header {
        margin-bottom: 24px;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .section-link {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 36px 0;
    }
    
    .section-header {
        margin-bottom: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
}
