/**
 * Book Archive Styles
 * Custom styling for the book archive shortcode
 */

/* Main container */
.book-archive-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Quicksand', sans-serif;
}

/* Year level tabs */
.book-year-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 30px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.year-tab {
    flex: 1;
    min-width: 120px;
    padding: 15px 20px;
    border: none;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.year-tab:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.year-tab.active {
    color: white;
    z-index: 2;
}

.year-tab.no-books {
    opacity: 0.5;
    cursor: not-allowed;
}

.year-tab.no-books:hover {
    transform: none;
    background: #f8f9fa;
}

/* Year level color schemes */
.year-tab.color-kindergarten.active {
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
}

.year-tab.color-year-1.active {
    background: linear-gradient(135deg, #1976d2, #42a5f5);
}

.year-tab.color-year-2.active {
    background: linear-gradient(135deg, #388e3c, #66bb6a);
}

.year-tab.color-year-3.active {
    background: linear-gradient(135deg, #f57c00, #ffb74d);
}

.year-tab.color-year-4.active {
    background: linear-gradient(135deg, #e64a19, #ff8a65);
}

.year-tab.color-year-5.active {
    background: linear-gradient(135deg, #c62828, #ef5350);
}

.year-tab.color-year-6.active {
    background: linear-gradient(135deg, #ad1457, #ec407a);
}

/* Book grids container */
.book-grids-container {
    position: relative;
}

/* Individual book grid */
.book-grid {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    animation: fadeIn 0.4s ease-in-out;
}

.book-grid.active {
    display: grid;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Book card */
.book-card {
    background: white;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Book cover */
.book-cover {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px 15px 0 0;
}

.book-cover img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
    border-radius: 15px 15px 0 0;
    object-fit: cover;
}

.book-card:hover .book-cover img {
    transform: scale(1.02);
}

.book-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 60px;
    font-weight: bold;
    color: #6c757d;
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
}

/* Book info */
.book-info {
    padding: 15px 20px;
    text-align: center;
}

.book-year {
    font-size: 24px;
    color: #343a40;
    margin: 0 0 5px 0;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.book-part {
    font-size: 20px;
    color: #6c757d;
    margin: 0 0 5px 0;
    font-weight: 500;
}

/* Go to Book button */
.book-read-btn {
    display: inline-block;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    text-decoration: none;
    text-align: center;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-read-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    color: white;
    text-decoration: none;
}

.book-read-btn i,
.book-read-btn .rocket-icon {
    margin-left: 8px;
    font-size: 1.1em;
    vertical-align: middle;
}

.rocket-icon {
    display: inline-block;
    font-style: normal;
}

/* Color accents for book cards */
.book-card.color-kindergarten {
    border-top: 4px solid #6a1b9a;
}

.book-card.color-year-1 {
    border-top: 4px solid #1976d2;
}

.book-card.color-year-2 {
    border-top: 4px solid #388e3c;
}

.book-card.color-year-3 {
    border-top: 4px solid #f57c00;
}

.book-card.color-year-4 {
    border-top: 4px solid #e64a19;
}

.book-card.color-year-5 {
    border-top: 4px solid #c62828;
}

.book-card.color-year-6 {
    border-top: 4px solid #ad1457;
}

/* No books message */
.book-archive-no-books {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.book-archive-no-books p {
    font-size: 18px;
    margin: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .book-archive-container {
        padding: 15px;
    }
    
    .book-year-tabs {
        margin-bottom: 20px;
    }
    
    .year-tab {
        min-width: 100px;
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .book-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .book-cover {
        /* No fixed height */
    }
    
    .book-info {
        padding: 15px;
    }
    
    .book-title {
        font-size: 16px;
    }
}

@media (max-width: 600px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .book-year-tabs {
        flex-direction: column;
        border-radius: 10px;
    }
    
    .year-tab {
        min-width: auto;
        border-radius: 0;
    }
    
    .year-tab:first-child {
        border-radius: 10px 10px 0 0;
    }
    
    .year-tab:last-child {
        border-radius: 0 0 10px 10px;
    }
    
    .book-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .book-cover {
        /* No fixed height */
    }
}

/* --- Grade-specific button colors --- */
.book-read-btn.color-kindergarten { background: linear-gradient(135deg, #6a1b9a, #8e24aa); }
.book-read-btn.color-kindergarten:hover { background: linear-gradient(135deg, #5e1687, #7e1aa0); box-shadow: 0 4px 12px rgba(142, 36, 170, 0.3); }

.book-read-btn.color-year-1 { background: linear-gradient(135deg, #1976d2, #42a5f5); }
.book-read-btn.color-year-1:hover { background: linear-gradient(135deg, #1565c0, #2196f3); box-shadow: 0 4px 12px rgba(66, 165, 245, 0.3); }

.book-read-btn.color-year-2 { background: linear-gradient(135deg, #388e3c, #66bb6a); }
.book-read-btn.color-year-2:hover { background: linear-gradient(135deg, #2e7d32, #4caf50); box-shadow: 0 4px 12px rgba(102, 187, 106, 0.3); }

.book-read-btn.color-year-3 { background: linear-gradient(135deg, #f57c00, #ffb74d); }
.book-read-btn.color-year-3:hover { background: linear-gradient(135deg, #ef6c00, #ffa726); box-shadow: 0 4px 12px rgba(255, 183, 77, 0.3); }

.book-read-btn.color-year-4 { background: linear-gradient(135deg, #e64a19, #ff8a65); }
.book-read-btn.color-year-4:hover { background: linear-gradient(135deg, #d84315, #ff7043); box-shadow: 0 4px 12px rgba(255, 138, 101, 0.3); }

.book-read-btn.color-year-5 { background: linear-gradient(135deg, #c62828, #ef5350); }
.book-read-btn.color-year-5:hover { background: linear-gradient(135deg, #b71c1c, #e53935); box-shadow: 0 4px 12px rgba(239, 83, 80, 0.3); }

.book-read-btn.color-year-6 { background: linear-gradient(135deg, #ad1457, #ec407a); }
.book-read-btn.color-year-6:hover { background: linear-gradient(135deg, #9c114d, #e91e63); box-shadow: 0 4px 12px rgba(236, 64, 122, 0.3); }

/* --- Book Header Styles --- */
.book-header {
    background: white;
    padding: 15px 0;
    margin-bottom: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 2px solid transparent;
}

.book-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.book-text-content {
    flex: 1;
}

.book-title {
    margin: 0 0 5px 0;
    font-size: 28px;
    font-weight: 700;
}

.book-metadata {
    margin: 0;
    font-size: 20px; /* Increased from 16px */
    font-weight: 600; /* Made bolder */
    white-space: nowrap;
}

.book-cover-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center bottom; /* Crop from bottom */
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 3px solid transparent;
    /* Improve image quality and smoothness */
    image-rendering: auto;
    image-rendering: smooth;
    image-rendering: high-quality;
    image-rendering: -webkit-optimize-contrast;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0) scale(1.001);
    transform: translateZ(0) scale(1.001);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Book Viewer Responsive Styles --- */
/* Ensure book viewer container stays at 800px height */
.book-viewer-container {
    height: 800px !important;
    max-height: 800px !important;
    min-height: 800px !important;
}

/* Mobile book viewer adjustments */
@media (max-width: 768px) {
    .book-viewer-container {
        height: calc(100vh - 140px) !important;
        max-height: calc(100vh - 140px) !important;
        min-height: 500px !important;
    }
    
    .book-header {
        padding: 15px 0 !important;
        margin-bottom: 15px !important;
    }
    
    .book-header h1 {
        font-size: 24px !important;
    }
    
    .book-header div {
        font-size: 14px !important;
    }
    
    /* Responsive header layout - adjust for mobile */
    .book-header-inner {
        flex-direction: column !important;
        text-align: center !important;
        gap: 15px !important;
    }
    
    .book-cover-circle {
        width: 80px !important;
        height: 80px !important;
        margin: 0 auto !important;
        order: -1 !important; /* Show image first on mobile */
    }
    
    .book-metadata {
        font-size: 18px !important; /* Slightly smaller on mobile */
    }
}

@media (max-width: 480px) {
    .book-viewer-container {
        height: calc(100vh - 120px) !important;
        min-height: 450px !important;
        border-radius: 4px !important;
    }
    
    .book-header {
        padding: 12px 0 !important;
        margin-bottom: 12px !important;
        border-radius: 6px !important;
    }
    
    .book-header h1 {
        font-size: 20px !important;
    }
    
    .book-header div {
        font-size: 13px !important;
    }
    
    /* Ensure book viewer is full width on small screens */
    .book-viewer-container,
    .book-header {
        margin-left: -15px !important;
        margin-right: -15px !important;
        border-radius: 0 !important;
    }
} 