:root {
  --primary: #012FB3;
  --primary-dark: #01248A;
  --primary-light: #1E43B0;
}

/* General theme colors */
.text-primary {
  color: var(--primary) !important;
}

.bg-primary {
  background-color: var(--primary) !important;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.btn-primary:hover {
  background-color: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Navigation */
.navbar {
  box-shadow: 0 2px 4px rgba(1, 47, 179, 0.1);
}

/* Form elements */
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(1, 47, 179, 0.25);
}

/* Links */
a {
  color: var(--primary);
}

a:hover {
  color: var(--primary-dark);
}

/* Footer */
#footer {
  background-color: var(--primary);
}

#footer a:hover {
  color: var(--primary-light) !important;
}

/* Flipbook overrides */
.fb3d-modal {
  --fb3d-primary: var(--primary) !important;
  --fb3d-button-color: var(--primary) !important;
  --fb3d-button-hover: var(--primary-dark) !important;
}

.fb3d-button {
  background-color: var(--primary) !important;
}

.fb3d-button:hover {
  background-color: var(--primary-dark) !important;
}

/* Book Card Thumbnail Styles */
.book-card {
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

.book-card .thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-top: 140%; /* Maintains aspect ratio */
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.book-card .thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.book-card:hover .thumbnail {
    transform: scale(1.05);
}

.book-title {
    margin-top: 15px;
    font-weight: 500;
    font-size: 1.1rem;
    color: #012FB3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 3em;
}

.book-author {
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Book overlay styles */
.book-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, 
        rgba(1, 47, 179, 0.95) 0%,
        rgba(1, 47, 179, 0.8) 60%,
        rgba(1, 47, 179, 0) 100%);
    color: white;
    padding: 30px 15px 15px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.book-card:hover .book-overlay {
    opacity: 1;
    transform: translateY(0);
}

.book-overlay-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transform: translateY(10px);
    transition: transform 0.3s ease 0.1s;
}

.book-overlay-author {
    font-size: 0.9rem;
    margin: 8px 0 0;
    opacity: 0.9;
    font-weight: 400;
    color: rgba(255,255,255,0.9);
    transform: translateY(10px);
    transition: transform 0.3s ease 0.2s;
}

.book-card:hover .book-overlay-title,
.book-card:hover .book-overlay-author {
    transform: translateY(0);
}

/* Book Title Below Card */
.book-bottom-title {
    margin-top: 12px;
    padding: 0 10px;
    text-align: center;
}

.book-bottom-title h5 {
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.8em;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.book-card:hover .book-bottom-title h5 {
    color: var(--primary);
}

/* Popular Books Section */
.popular-books .thumbnail-wrapper {
    padding-top: 75%; /* Different aspect ratio for popular books */
}

/* Latest Books Section */
.latest-books .thumbnail-wrapper {
    padding-top: 140%; /* Taller aspect ratio for latest books */
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .book-card .thumbnail-wrapper {
        padding-top: 100%;
    }
}
