:root {
    --primary-color: #6B5B95;
    --accent-color: #8B7FA8;
    --accent-hover: #7A6B9A;
    --accent-light: #A89BC4;
    --secondary-color: #9B8DB5;
    --bg-color: #F8F9FA;
    --card-bg: #FFFFFF;
    --text-color: #2D3748;
    --text-light: #718096;
    --border-color: #D1D5DB;
    --border-radius: 12px;
    --shadow: 0 1px 3px rgba(107, 91, 149, 0.05);
    --shadow-hover: 0 4px 12px rgba(107, 91, 149, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, button, a {
    -webkit-user-select: auto;
    user-select: auto;
    touch-action: manipulation;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #8B7FA8 0%, #A89BC4 100%);
    color: white;
    padding: 20px;
    text-align: center;
    margin: 0;
    box-shadow: 0 1px 6px rgba(107, 91, 149, 0.1);
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

header .container {
    padding: 0;
    margin: 0;
}

header p {
    font-size: 1.2rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Container */
.search-container {
    margin: 30px 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

#bookSearch {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
}

#bookSearch:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(139, 127, 168, 0.1);
}

#bookSearch::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

/* Book Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

/* Book Card */
.book-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(107, 91, 149, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(107, 91, 149, 0.18), 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.book-cover {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    font-size: 3rem;
    font-weight: bold;
    position: relative;
    overflow: hidden;
    border-bottom: 3px solid var(--border-color);
}

.book-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.1);
    z-index: 1;
}

.book-cover.has-image::before {
    display: none; /* Hide overlay when image is present */
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    position: relative;
    z-index: 0;
    display: block;
    filter: saturate(0.7) brightness(1.05);
}

.book-info {
    padding: 28px;
    background: #FFFFFF;
    border-top: 2px solid var(--border-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.book-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--primary-color);
    letter-spacing: -0.01em;
}

.book-author {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 15px;
}

.book-description {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-progress-container {
    margin: 15px 0;
    padding-top: 15px;
    border-top: 1.5px solid #E5E7EB;
    background: #FFFFFF;
}

.book-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.book-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.book-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 1px 3px rgba(107, 91, 149, 0.2);
}

.book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 18px;
    border-top: 1.5px solid #E5E7EB;
    font-size: 0.9rem;
    background: #FFFFFF;
}

.book-chapters {
    color: var(--accent-color);
    font-weight: 500;
}

.book-duration {
    color: var(--text-light);
}

.play-button {
    background: var(--accent-color);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.play-button:hover {
    background: var(--accent-hover);
}

/* Footer */
footer {
    background: linear-gradient(135deg, #8B7FA8 0%, #9B8DB5 100%);
    color: white;
    text-align: center;
    padding: 30px 20px;
    margin-top: 60px;
}

footer p {
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }

    .book-cover {
        height: 300px;
    }
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

