:root {
    --amazon-orange: #FF9900;
    --amazon-yellow: #Febd69;
    --amazon-dark: #131921;
    --amazon-light-bg: #EAEDED;
    --amazon-white: #FFFFFF;
    --amazon-text: #0F1111;
    --amazon-text-blue: #007185;
    --amazon-price: #B12704;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

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

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--amazon-light-bg);
    color: var(--amazon-text);
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: var(--amazon-text-blue);
}

a:hover {
    color: #C7511F;
    text-decoration: underline;
}

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

/* Header */
header {
    background-color: var(--amazon-dark);
    padding: 10px 0;
    color: white;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.logo span {
    color: var(--amazon-orange);
}

.search-bar {
    flex-grow: 1;
    max-width: 600px;
    margin: 0 20px;
    display: flex;
}

.search-bar input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px 0 0 4px;
    outline: none;
}

.search-bar button {
    background-color: var(--amazon-orange);
    border: none;
    padding: 10px 20px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

/* Hero Section */
.hero {
    background-color: #f3f3f3;
    padding: 40px 0;
    text-align: center;
}

.hero h1 {
    font-size: 32px;
    margin-bottom: 15px;
}

.hero p {
    font-size: 18px;
    color: #565959;
    max-width: 800px;
    margin: 0 auto;
}

/* Section Titles */
.section-title {
    font-size: 24px;
    font-weight: bold;
    margin: 30px 0 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

/* Book Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Book Card */
.book-card {
    background: var(--amazon-white);
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.book-card:hover {
    box-shadow: var(--card-shadow);
}

.book-cover-wrapper {
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
}

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

.book-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--amazon-text-blue);
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-meta {
    font-size: 12px;
    color: #565959;
    margin-bottom: 10px;
}

.book-price {
    font-size: 18px;
    font-weight: bold;
    color: var(--amazon-price);
    margin-bottom: 15px;
}

.btn-group {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn {
    display: block;
    width: 100%;
    padding: 8px;
    text-align: center;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid;
}

.btn-primary {
    background: linear-gradient(to bottom, #f7dfa1, #f0c14b);
    border-color: #a88734 #9c7e31 #846a29;
    color: #111;
}

.btn-primary:hover {
    background: linear-gradient(to bottom, #f5d78e, #eeb933);
}

.btn-primary.disabled {
    background: #e7e9ec !important;
    border-color: #adb1b8 !important;
    color: #565959 !important;
    cursor: default;
    pointer-events: none;
    box-shadow: none;
}

.btn-secondary {
    background: linear-gradient(to bottom, #f7f8fa, #e7e9ec);
    border-color: #adb1b8 #a2a6ac #8d9096;
    color: #111;
}

.book-snippet {
    font-size: 13px;
    color: #565959;
    margin: 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
    /* for future compatibility */
}

/* Book Card Hover Effect */
.book-card .book-cover-wrapper {
    position: relative;
}

.book-card .cover-secondary {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    background-color: white;
}

.book-card:hover .cover-secondary.exists {
    opacity: 1;
}

/* Cover Badge */
.cover-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    z-index: 2;
}

/* Gallery Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.gallery-item {
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
}

.gallery-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Lightbox Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    padding: 40px;
    box-sizing: border-box;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* Footer */
footer {
    background-color: var(--amazon-dark);
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-top: 40px;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.category-card {
    background: var(--amazon-white);
    padding: 20px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #ddd;
}

.category-card h3 {
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    .search-bar {
        margin: 10px 0;
        width: 100%;
    }
}