@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Sinhala:wght@400;700&family=Russo+One&display=swap');

:root {
    --navy-blue: #000080;
    --navy-blue-dark: #000055;
    --white: #ffffff;
    --light-bg: #f4f6f9;
    --text-color: #333333;
    --border-color: #dddddd;
    --max-width: 1200px; /* Standard width for Frontend */
}

body {
    font-family: 'Noto Sans Sinhala', sans-serif;
    font-size: 14px;
    background-color: var(--light-bg);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Boxed Layout for Frontend */
.container-boxed {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    background-color: var(--white);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
}

header {
    background-color: var(--navy-blue);
    color: var(--white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Russo One', sans-serif;
    font-size: 28px;
    text-decoration: none;
    color: var(--white);
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 25px;
}

nav ul li a {
    color: var(--white);
    text-decoration: none;
    font-size: 15px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav ul li a:hover {
    background-color: var(--navy-blue-dark);
}

.header-actions .btn-outline {
    color: var(--white);
    border: 1px solid var(--white);
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
}

.header-actions .btn-outline:hover {
    background-color: var(--white);
    color: var(--navy-blue);
}

/* Hamburger Menu Icon */
.hamburger {
    display: none;
    font-size: 24px;
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.main-content {
    padding: 40px;
    flex: 1;
}

footer {
    background-color: var(--navy-blue);
    color: var(--white);
    text-align: center;
    padding: 20px;
    font-size: 13px;
    margin-top: auto;
}

/* Book Grid (3 Columns) */
.book-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 20px;
}

.book-card {
    text-align: center;
    transition: transform 0.2s;
    position: relative;
}

.featured-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #dc3545;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-card:hover {
    transform: translateY(-5px);
}

.book-card img {
    width: 100%;
    aspect-ratio: 1 / 1.41;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.book-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
    color: var(--navy-blue);
}

.book-card .price {
    font-size: 16px;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 15px;
}

.book-card .price strike {
    color: #999;
    font-size: 14px;
    font-weight: normal;
    margin-left: 5px;
}

.btn {
    background-color: var(--navy-blue);
    color: var(--white);
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--navy-blue-dark);
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-buy {
    background-color: #28a745;
}

.btn-buy:hover {
    background-color: #218838;
}

/* Single Book Layout */
.single-book-container {
    display: flex;
    gap: 40px;
    margin-top: 20px;
}

.book-image-gallery {
    flex: 1;
}

.book-image-gallery .main-img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.book-image-gallery .thumb-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.book-image-gallery .thumb-grid img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.book-details {
    flex: 2;
}

.book-details h1 {
    color: var(--navy-blue);
    margin-top: 0;
}

.book-details .authors {
    color: #666;
    margin-bottom: 20px;
    font-size: 16px;
}

.book-details .price-block {
    margin: 20px 0;
    font-size: 24px;
    font-weight: bold;
    color: #28a745;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.book-description {
    line-height: 1.6;
    color: #444;
}

/* Responsive */
@media (max-width: 900px) {
    header {
        flex-wrap: wrap;
        position: relative;
    }
    .hamburger {
        display: block;
        order: 2; /* Move it next to the cart */
    }
    .header-actions {
        order: 1; /* Cart button stays right but before hamburger */
        margin-left: auto;
        margin-right: 15px;
    }
    nav {
        display: none;
        width: 100%;
        order: 3;
        margin-top: 15px;
        background-color: var(--navy-blue-dark);
        border-radius: 5px;
        overflow: hidden;
    }
    nav.active {
        display: block;
    }
    nav ul {
        flex-direction: column;
        gap: 0;
    }
    nav ul li a {
        display: block;
        padding: 15px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    nav ul li:last-child a {
        border-bottom: none;
    }

    .book-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .single-book-container {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .book-grid {
        grid-template-columns: 1fr;
    }
    
    /* Make Action Buttons More Prominent on Mobile */
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-buttons .btn {
        width: 100%;
        padding: 15px;
        font-size: 18px;
        text-align: center;
    }
}

/* Lightbox Modal */
.image-lightbox {
    display: none; /* Hidden by default */
    position: fixed; 
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.85); 
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.image-lightbox.show {
    display: flex;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
    border-radius: 4px;
    animation: zoom 0.3s;
}

@keyframes zoom {
    from {transform:scale(0.8); opacity:0;} 
    to {transform:scale(1); opacity:1;}
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10000;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

@media (max-width: 600px) {
    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 35px;
    }
    .lightbox-content {
        max-width: 95%;
        max-height: 85vh;
    }
}
