/* --- DARK & SULTRY IN-HOUSE STYLES --- */
:root {
    --bg-deep: #08080a;
    --bg-card: #121216;
    --bg-card-hover: #1a1a20;
    --crimson-accent: #900c3f;
    --crimson-bright: #c70039;
    --crimson-glow: rgba(199, 0, 57, 0.35);
    
    /* Vibrant Gold Accent for Coupon Sticker */
    --gold-bright: #f1c40f;
    --gold-glow: rgba(241, 196, 15, 0.35);
    --gold-bg: #221c08;

    --text-main: #f0f0f5;
    --text-muted: #a0a0b0;
    --border-subtle: #2a2a35;
    
    /* In-house typography */
    --font-heading: 'Georgia', 'Garamond', 'Baskerville', 'Times New Roman', serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- HEADER & NAVIGATION --- */
header {
    background: linear-gradient(180deg, #120509 0%, var(--bg-deep) 100%);
    border-bottom: 1px solid rgba(199, 0, 57, 0.2);
    padding: 2rem 1rem 1rem;
    text-align: center;
}

.site-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    letter-spacing: 4px;
    color: var(--text-main);
    text-transform: uppercase;
    text-shadow: 0 0 15px var(--crimson-glow);
    margin-bottom: 1rem;
    font-weight: normal;
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-title span {
    color: var(--crimson-bright);
    font-style: italic;
}

nav {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.8rem 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    max-width: 900px;
    margin: 0 auto;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

nav a:hover, nav a.active {
    color: var(--crimson-bright);
    text-shadow: 0 0 8px var(--crimson-glow);
}

/* --- MAIN CONTAINER --- */
main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* --- HERO & FILTER HEADERS --- */
.hero-banner {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-banner h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-weight: normal;
}

.hero-banner p {
    color: var(--text-muted);
    font-style: italic;
}

.active-tags-list {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* --- CATALOG & SEARCH GRID --- */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.book-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.book-card:hover {
    transform: translateY(-6px);
    border-color: var(--crimson-bright);
    box-shadow: 0 10px 25px var(--crimson-glow);
    background: var(--bg-card-hover);
}

.book-card img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    filter: brightness(0.9) contrast(1.1);
}

.book-card-info {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-card-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-weight: normal;
}

.book-card-snippet {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card-meta {
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--crimson-bright);
    font-weight: 600;
    letter-spacing: 1px;
}

/* --- TAG PILLS --- */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.tag-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(144, 12, 63, 0.2);
    border: 1px solid var(--crimson-accent);
    color: #e0d0d8;
    font-size: 0.75rem;
    text-transform: lowercase;
    letter-spacing: 1px;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tag-pill:hover {
    background: var(--crimson-bright);
    color: #ffffff;
    border-color: var(--crimson-bright);
    box-shadow: 0 0 10px var(--crimson-glow);
}

.tag-pill.active-filter {
    background: var(--crimson-bright);
    color: white;
    font-weight: 600;
}

/* --- DETAIL VIEW --- */
.detail-view {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
}

.detail-cover-wrapper img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8), 0 0 15px var(--crimson-glow);
    border: 1px solid rgba(199, 0, 57, 0.3);
}

.detail-content {
    display: flex;
    flex-direction: column;
}

.detail-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 0.3rem;
    line-height: 1.2;
    font-weight: normal;
}

.detail-author,.detail-author a {
    color: var(--crimson-bright);
    font-size: 0.95rem;
    letter-spacing: 1.5px;
    margin-bottom: 1.2rem;
    text-transform: uppercase;
}

.metrics-bar {
    display: flex;
    gap: 2rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem 1.25rem;
    border-radius: 6px;
    border-left: 3px solid var(--crimson-bright);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.metric-item {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* --- COMPACT COUPON STICKER --- */
.coupon-container {
    margin-bottom: 1.5rem;
    display: flex;
}

.coupon-sticker {
    background: var(--gold-bg);
    border: 1.5px dashed var(--gold-bright);
    color: var(--gold-bright);
    padding: 0.45rem 0.95rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.25 ease;
    box-shadow: 0 3px 10px rgba(241, 196, 15, 0.15);
    transform: rotate(-1deg);
    user-select: none;
}

.coupon-sticker:hover {
    transform: rotate(0deg) scale(1.02);
    background: #332b0c;
    box-shadow: 0 5px 15px var(--gold-glow);
}

.coupon-sticker.revealed {
    background: var(--gold-bright);
    color: #08080a;
    border: 1.5px solid var(--gold-bright);
    transform: rotate(0deg);
    box-shadow: 0 0 15px var(--gold-glow);
}

.coupon-sticker .sticker-code {
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: bold;
    letter-spacing: 1.5px;
}

.coupon-sticker .sticker-action {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.coupon-sticker.revealed .sticker-action {
    font-weight: bold;
    opacity: 1;
}

/* --- DESCRIPTION & BUTTONS --- */
.detail-description {
    font-size: 1rem;
    color: #d0d0dc;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.action-buttons {
    display: flex;
    gap: 1.25rem;
    margin-top: auto;
    margin-bottom:20px;
}

.btn {
    padding: 0.9rem 1.8rem;
    border-radius: 6px;
    font-family: var(--font-body);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-buy {
    background: linear-gradient(135deg, var(--crimson-accent) 0%, var(--crimson-bright) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px var(--crimson-glow);
}

.btn-buy:hover {
    box-shadow: 0 6px 20px rgba(199, 0, 57, 0.6);
    transform: translateY(-2px);
}

.btn-sample {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.btn-sample:hover {
    border-color: var(--crimson-bright);
    color: var(--crimson-bright);
    transform: translateY(-2px);
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--crimson-bright);
}

.loading-state, .error-state, .no-results {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

@media (max-width: 768px) {
    .detail-view {
        grid-template-columns: 1fr;
    }
    .detail-cover-wrapper {
        max-width: 260px;
        margin: 0 auto;
    }
    .action-buttons {
        flex-direction: column;
    }
}
