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

body {
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin: 2rem 0 1rem 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.style-selector-container {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Inline Select Style */
#style-select {
    font-size: 1.2rem;
    padding: 0.2rem 0.5rem;
    border: none;
    background: transparent;
    border-bottom: 2px solid currentColor;
    color: inherit;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    appearance: none;
    /* Remove default arrow */
    -webkit-appearance: none;
    text-align: center;
}

#style-select:focus {
    outline: none;
    border-bottom-style: dashed;
}

/* Filters Section */
#filters-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 800px;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.filter-label {
    font-weight: bold;
    margin-right: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    background-color: #eee;
    /* Default inactive */
    color: #333;
    transition: all 0.2s ease;
}

.filter-btn.active {
    border-color: #000;
    transform: scale(1.05);
}

/* Target Colors */
.target-btn[data-value="Mass"] {
    background-color: #555;
    color: #fff;
}

.target-btn[data-value="Niche"] {
    background-color: #ddd;
    color: #000;
}

/* Category Colors */
.category-btn[data-value="Econ"] {
    background-color: #dbfadd;
    color: #1e8449;
}

/* Greenish */
.category-btn[data-value="Math"] {
    background-color: #d6eaf8;
    color: #2874a6;
}

/* Blueish */
.category-btn[data-value="SciTech"] {
    background-color: #e8daef;
    color: #884ea0;
}

/* Purpleish */
.category-btn[data-value="LiberalArts"] {
    background-color: #fcf3cf;
    color: #b7950b;
}

/* Yellowish */


.bookshelf-container {
    width: 100%;
    max-width: 1200px;
    /* Constrain width for 4 cols */
    margin: 0 auto;
    padding: 1rem;
}

.bookshelf {
    display: grid;
    /* Force 4 columns on PC */
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    width: 100%;
}

/* Responsive for smaller screens */
@media (max-width: 1024px) {
    .bookshelf {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .bookshelf {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .bookshelf {
        grid-template-columns: 1fr;
    }
}

.book-cover {
    width: 250px;
    height: 200px;
    object-fit: contain;
    display: block;
}

/* Base Card Styles shared if needed, but mostly art styles override */
.book-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.card-image-container {
    width: 100%;
    display: flex;
    justify-content: center;
    background-color: #eee;
    overflow: hidden;
}

.book-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-align: center;
}

.book-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0;
}

.book-eng {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.book-meta {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.book-date {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 0.5rem;
}

/* Category Colors for Text/Badges */
.cat-Econ {
    color: #2ecc71;
}

.cat-Math {
    color: #3498db;
}

.cat-SciTech {
    color: #9b59b6;
}

.cat-LiberalArts {
    color: #f1c40f;
}

/* Target Colors */
.tgt-Mass {
    color: #333;
}

.tgt-Niche {
    color: #888;
}


/* =========================================
   1. Neo-Brutalism (.art-neobrutalism)
   ========================================= */
.art-neobrutalism {
    --bg-color: #ffffff;
    --primary-color: #FF5A5F;
    --secondary-color: #3D5AFE;
    --border-color: #000000;
    --border-width: 3px;
    --shadow-offset: 5px;
    background-color: var(--bg-color);
    font-family: 'Space Mono', monospace;
    color: var(--border-color);
    padding: 2rem;
}

.art-neobrutalism header {
    border: var(--border-width) solid var(--border-color);
    background-color: rgb(0, 217, 255);
    padding: 1.5rem;
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--border-color);
    transform: rotate(-1deg);
    max-width: 600px;
    margin: 0 auto 3rem auto;
}

.art-neobrutalism header h1 {
    font-family: 'Archivo', sans-serif;
    font-weight: 900;
    font-size: 3rem;
    text-transform: uppercase;
    line-height: 0.9;
}

.art-neobrutalism .book-card {
    background-color: #ffffff;
    border: var(--border-width) solid var(--border-color);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--border-color);
    transition: all 0.2s ease;
    position: relative;
    top: 0;
    left: 0;
}

.art-neobrutalism .book-card:hover {
    box-shadow: 2px 2px 0px var(--border-color);
    transform: translate(3px, 3px);
    background-color: var(--secondary-color);
    color: #fff;
}

.art-neobrutalism .card-image-container {
    border-bottom: var(--border-width) solid var(--border-color);
}

.art-neobrutalism .book-title {
    text-transform: uppercase;
    font-family: 'Archivo', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
}


/* =========================================
   2. Glassmorphism (.art-glassmorphism)
   ========================================= */
.art-glassmorphism {
    --bg-color: #efefef;
    background-color: var(--bg-color);
    font-family: 'Poppins', sans-serif;
    padding: 2rem;
    color: #1f2937;
    position: relative;
    overflow-x: hidden;
}

.art-glassmorphism::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    z-index: -1;
    background-image: radial-gradient(circle, rgba(69, 97, 220, 0.6), transparent 60%);
    filter: blur(150px);
    animation: backgroundAnimation 30s linear infinite;
}

@keyframes backgroundAnimation {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.art-glassmorphism header {
    text-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.art-glassmorphism h1 {
    font-size: 2.2rem;
    font-weight: 500;
}

.art-glassmorphism .bookshelf {
    grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    max-width: 1200px;
    perspective: 1000px;
}

.art-glassmorphism .book-card {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1rem;
    will-change: transform;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.4s ease;
}

.art-glassmorphism .book-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.3);
}

.art-glassmorphism .book-cover {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 0.8rem;
}


/* =========================================
   3. Minecraft (.art-minecraft)
   ========================================= */
.art-minecraft {
    background-color: #1e1e1e;
    font-family: 'VT323', monospace;
    color: #fff;
    padding: 2rem;
    image-rendering: pixelated;
}

.art-minecraft .minecraft-bg {
    display: block;
    /* Visible only here */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: #6e4a3b;
    background-image:
        linear-gradient(45deg, #5c4033 25%, transparent 25%, transparent 75%, #5c4033 75%, #5c4033),
        linear-gradient(45deg, #5c4033 25%, transparent 25%, transparent 75%, #5c4033 75%, #5c4033);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    opacity: 0.3;
}

.art-minecraft header {
    border: 4px solid #fff;
    background-color: #6c6c6c;
    padding: 1rem 2rem;
    box-shadow: inset -4px -4px 0px #3a3a3a, inset 4px 4px 0px #a8a8a8;
    max-width: 800px;
    margin: 0 auto 3rem auto;
}

/* Match select wrapper to header bg */
.art-minecraft .custom-select-wrapper {
    background-color: #6c6c6c;
    display: inline-block;
    padding: 0 10px;
}

.art-minecraft #style-select {
    background-color: #6c6c6c;
    color: #fff;
    border: none;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    cursor: pointer;
}

.art-rainbowgradients #style-select {
    background-color: #5b5b5b;
}

.art-minecraft header h1 {
    font-size: 4rem;
    font-weight: 400;
    text-shadow: 4px 4px 0px #3f3f3f;
}

.art-minecraft .bookshelf-container {
    max-width: 1200px;
    /* Increased max-width to allow 4 columns comfortably */
    background-color: #c6c6c6;
    padding: 20px;
    border: 4px solid #000;
    box-shadow: inset 4px 4px 0px #fff, inset -4px -4px 0px #555;
    margin: 0 auto;
}

.art-minecraft .bookshelf {
    /* Enforce 4 columns by slightly reducing min-width or ensuring container is wide enough */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    /* 220px ensures 4 columns fit in 1000px+ container */
    gap: 1.5rem;
}

.art-minecraft .book-card {
    background-color: #8b8b8b;
    border: 4px solid #373737;
    border-right-color: #fff;
    border-bottom-color: #fff;
    padding: 8px;
    transition: background-color 0.1s;
    /* Removed height: 100% to let content dictate height */
}

.art-minecraft .book-card:hover {
    background-color: #a0a0a0;
}

.art-minecraft .card-image-container {
    background-color: #000;
    border: 2px solid #555;
    padding: 4px;
    margin-bottom: 0.5rem;
    position: relative;
    /* Removed aspect-ratio: 2/3 to just fit the 250x200 image */
    width: auto;
    height: auto;
    display: flex;
    justify-content: center;
}

.art-minecraft .book-cover {
    image-rendering: pixelated;
}

.art-minecraft .book-info {
    margin-top: auto;
    background-color: #6b6a70;
    border: 2px solid #808dad;
    padding: 4px 6px;
    color: #fff;
    opacity: 0.9;
    text-shadow: 2px 2px 0px #3f3f3f;
    font-family: 'VT323', monospace;
}

.art-minecraft .book-title {
    color: #ffff55;
    text-shadow: 2px 2px 0 #000;
    font-size: 1.4rem;
    line-height: 1.1;
    margin-bottom: 2px;
}

.art-minecraft .book-author {
    font-size: 1.2rem;
    color: #aaaaaa;
}


/* =========================================
   4. Rainbow Gradients (.art-rainbowgradients)
   ========================================= */
.art-rainbowgradients {
    background: linear-gradient(125deg, #19578d, #554398, #386c8f, #1eedb2);
    background-size: 300% 300%;
    animation: modernGradientFlow 5s ease infinite;
    font-family: 'Segoe UI', sans-serif;
    color: #fff;
    padding: 2rem;
}

@keyframes modernGradientFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.art-rainbowgradients header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #ffafbd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.art-rainbowgradients .bookshelf {
    max-width: 1200px;
    margin: 0 auto;
}

.art-rainbowgradients .book-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.art-rainbowgradients .book-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.art-rainbowgradients .card-image-container {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.art-rainbowgradients .book-cover {
    transition: transform 0.6s ease;
}

.art-rainbowgradients .book-card:hover .book-cover {
    transform: scale(1.1);
}

.art-rainbowgradients .book-info {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.art-rainbowgradients .book-title {
    background: linear-gradient(90deg, #ff9a9e, #fad0c4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: rainbowFlow 3s linear infinite;
    font-size: 1.1rem;
    font-weight: 700;
}

.art-rainbowgradients .book-author {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}


/* =========================================
   5. Retro Cyberpunk (.art-retrocyberpunk)
   ========================================= */
.art-retrocyberpunk {
    background-color: #0a0a0a;
    font-family: 'VT323', monospace;
    color: #ff00ff;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

.art-retrocyberpunk::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 999;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.art-retrocyberpunk h1 {
    font-size: 3.5rem;
    text-transform: uppercase;
    animation: text-glitch 0.2s infinite;
}

.art-retrocyberpunk .book-card {
    background-color: #111;
    border: 1px solid #00ffff;
    box-shadow: 0 0 5px #00ffff;
    padding: 1.2rem;
    text-align: center;
    transition: box-shadow 0.3s, border-color 0.3s;
}

.art-retrocyberpunk .book-card:nth-child(2n) {
    animation-delay: 0.2s;
}

.art-retrocyberpunk .book-card:nth-child(3n) {
    animation-delay: 0.5s;
}

.art-retrocyberpunk .book-card:hover {
    box-shadow: 0 0 15px #ff00ff;
    border-color: #ff00ff;
}

.art-retrocyberpunk .book-cover {
    height: 192px;
    border: 1px dashed #ff00ff;
    filter: grayscale(50%) contrast(1.2);
    margin-bottom: 0.8rem;
}

.art-retrocyberpunk .book-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
}


/* =========================================
   6. Skeuomorphism (.art-skeuomorphism)
   ========================================= */
.art-skeuomorphism {
    background-color: #f4f4f4;
    background-image: url('img/AdobeStock_407451671.jpeg');
    /* Updated path */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;

    font-family: 'Crimson Text', serif;
    color: #333;
    padding: 3rem;
}

.art-skeuomorphism header h1 {
    font-size: 3rem;
    font-weight: 600;
    color: #222;
    text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.8);
    letter-spacing: 1px;
}

.art-skeuomorphism .book-card {
    position: relative;
    display: flex;
    flex-direction: column;
    /* Removed aspect-ratio: 9/16 to fix excessive height */
    width: 100%;
    /* No fixed aspect ratio, sizing like glassmorphism */
    background-color: #fcfcfc;
    text-decoration: none;
    color: #333333;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 30px, 100% 100%, 0 100%);
    background-image: repeating-linear-gradient(transparent, transparent 23px, #e5e5e5 24px);
    filter: drop-shadow(5px 5px 8px rgba(0, 0, 0, 0.1));
    padding-bottom: 1.5rem;
    /* Add some bottom padding like paper */
}

.art-skeuomorphism .book-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 30px;
    background: linear-gradient(225deg, transparent 50%, #e0e0e0 50%);
    box-shadow: -2px 2px 3px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 2;
}

.art-skeuomorphism .book-card:hover {
    transform: translateY(-3px) rotate(1deg);
    box-shadow: 8px 8px 15px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.art-skeuomorphism .card-image-container {
    background: #fff;
    padding: 5px;
    border: 1px solid #ddd;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
    width: 100%;
    /* Removed aspect-ratio: 2/3 */
    height: auto;
    overflow: hidden;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.art-skeuomorphism .book-cover {
    filter: sepia(0.2);
}

.art-skeuomorphism .book-info {
    text-align: center;
    padding: 0 1rem;
}

.art-skeuomorphism .book-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

.art-skeuomorphism .book-author {
    font-size: 0.95rem;
    font-style: italic;
    color: #665;
}


/* Animations */
@keyframes text-glitch {

    0%,
    100% {
        transform: none;
        opacity: 1;
    }

    25% {
        transform: skew(-0.5deg, -0.5deg);
        opacity: 0.75;
    }

    50% {
        transform: none;
        opacity: 1;
    }

    75% {
        transform: skew(0.5deg, 0.5deg);
        opacity: 0.75;
    }
}

@keyframes card-glitch {

    0%,
    100% {
        transform: none;
        opacity: 1;
    }

    8% {
        transform: skewX(2deg);
        opacity: 0.9;
    }

    9% {
        transform: none;
        opacity: 1;
    }

    15% {
        transform: skewX(-1deg) translateY(-5px);
        opacity: 0.95;
    }

    16% {
        transform: none;
        opacity: 1;
    }

    40% {
        transform: skewY(1.5deg);
        opacity: 1;
    }

    41% {
        transform: none;
        opacity: 1;
    }
}