/* Base Styles */
:root {
  --primary-color: #3a6ea5;
  --primary-dark: #2c5282;
  --secondary-color: #f0f4f8;
  --accent-color: #6b46c1;
  --text-color: #2d3748;
  --text-light: #718096;
  --white: #ffffff;
  --light-gray: #f7fafc;
  --gray: #e2e8f0;
  --success: #48bb78;
  --warning: #ed8936;
  --danger: #e53e3e;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  background-color: var(--light-gray);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-color);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

.btn {
  transition: var(--transition);
  border-radius: 6px;
  font-weight: 500;
  padding: 0.5rem 1.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  color: var(--white);
}

section {
  padding: 5rem 0;
}

.section-header {
  margin-bottom: 3rem;
}

.section-header h2 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  position: relative;
  display: inline-block;
}

.section-header h2:after {
  content: '';
  position: absolute;
  width: 50px;
  height: 3px;
  background-color: var(--primary-color);
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
}

.section-header p {
  color: var(--text-light);
  font-size: 1.1rem;
}

/* Navbar */
.navbar {
  padding: 1rem 0;
  transition: var(--transition);
  background-color: #F0F4F8;
}

.navbar.scrolled {
  background-color: var(--white);
  box-shadow: var(--shadow);
  padding: 0.7rem 0;
}

.navbar-brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--primary-color);
  font-size: 1.5rem;
}

.navbar-brand span {
  margin-left: 0.5rem;
}

.nav-link {
  color: var(--text-color);
  font-weight: 500;
  margin: 0 0.5rem;
  padding: 0.5rem 0.8rem;
  position: relative;
}

.nav-link:hover {
  color: var(--primary-color);
}

.nav-link:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  transition: var(--transition);
}

.nav-link:hover:after {
  width: 80%;
}

.btn-login {
  background-color: var(--primary-color);
  color: var(--white) !important;
  border-radius: 6px;
  padding: 0.5rem 1.5rem !important;
}

.btn-login:hover {
  background-color: var(--primary-dark);
}

.btn-login:after {
  display: none;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--light-gray) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 5rem;
}

.hero-section h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

.hero-section .lead {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: var(--text-light);
}

.hero-cta {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.hero-image {
  text-align: center;
}

.hero-image img {
  max-width: 100%;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0px); }
}

/* Stats Section */
.stats-section {
  background-color: var(--white);
  padding: 3rem 0;
}

.stat-card {
  padding: 2rem 1rem;
  text-align: center;
  transition: var(--transition);
  border-radius: 8px;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.stat-card i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.stat-card h3 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.stat-card p {
  color: var(--text-light);
  font-size: 1.1rem;
}

/* Search Section */
.search-section {
  background-color: var(--secondary-color);
  padding: 3rem 0;
}

.search-container {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.search-container h2 {
  margin-bottom: 1.5rem;
}

.search-box {
  display: flex;
  gap: 0.5rem;
  background-color: var(--white);
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: var(--shadow);
}

.search-box input, .search-box select {
  flex: 1;
  border: none;
  padding: 0.8rem 1rem;
  border-radius: 6px;
  outline: none;
}

.search-box button {
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: 6px;
  padding: 0.8rem 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.search-box button:hover {
  background-color: var(--primary-dark);
}

/* Collections Section */
.collections-section {
  background-color: var(--white);
}

.nav-pills .nav-link {
  color: var(--text-color);
  background-color: transparent;
  border-radius: 30px;
  padding: 0.5rem 1.5rem;
  margin: 0 0.3rem;
  transition: var(--transition);
}

.nav-pills .nav-link.active {
  background-color: var(--primary-color);
  color: var(--white);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 4 buku per baris untuk semua ukuran layar */
  gap: 10px; /* Gap lebih kecil untuk mobile */
}

.book-cover {
  position: relative;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8f9fa;
}

.book-cover img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  padding: 10px;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.book-card:hover .book-cover img {
  transform: scale(1.05);
}

.book-status {
  position: absolute;
  top: 10px;
  right: 10px;
}

.book-info {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.book-info h4 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.6rem;
}

.book-info p {
  margin-bottom: 5px;
  color: #666;
  font-size: 0.9rem;
}

.book-info .author {
  font-style: italic;
  color: #555;
}

.book-info .category {
  color: #0066cc;
}

.book-info .id {
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 15px;
}

.btn-detail {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s;
  margin-top: auto;
}

.btn-detail:hover {
  background-color: var(--primary-dark);
}


/* Features Section */
.features-section {
  background-color: var(--secondary-color);
}

.feature-card {
  background-color: var(--white);
  padding: 2.5rem 1.5rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  height: 100%;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-card i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

.feature-card h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.feature-card p {
  color: var(--text-light);
}

/* Team Section */
.team-section {
  background-color: var(--white);
}

.team-card {
  background-color: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  text-align: center;
  transition: var(--transition);
}

.team-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.team-card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.team-card h4 {
  margin-top: 1.5rem;
  font-size: 1.3rem;
}

.team-card .position {
  color: var(--primary-color);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.team-card .description {
  color: var(--text-light);
  padding: 0 1.5rem;
  margin-bottom: 1.5rem;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--light-gray);
  color: var(--primary-color);
  transition: var(--transition);
}

.social-links a:hover {
  background-color: var(--primary-color);
  color: var(--white);
}

/* Footer */
.footer {
  background-color: #2d3748;
  color: var(--light-gray);
  padding: 4rem 0 2rem;
}

.footer h5 {
  color: var(--white);
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.footer h5:after {
  content: '';
  position: absolute;
  width: 30px;
  height: 2px;
  background-color: var(--primary-color);
  bottom: -8px;
  left: 0;
}

.footer p {
  color: #a0aec0;
  margin-bottom: 1rem;
}

.footer ul {
  list-style: none;
  padding: 0;
}

.footer ul li {
  margin-bottom: 0.8rem;
}

.footer ul li a {
  color: #a0aec0;
  transition: var(--transition);
}

.footer ul li a:hover {
  color: var(--white);
  padding-left: 5px;
}

.footer i {
  margin-right: 0.5rem;
  color: var(--primary-color);
}

.footer hr {
  border-color: #4a5568;
  margin: 2rem 0;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-bottom p {
  margin-bottom: 0;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
}

/* Fix for SweetAlert2 modal */
.swal2-popup {
  padding: 2rem;
}

.swal2-html-container {
  margin: 1rem 0;
}

.book-status {
  position: absolute;
  top: 10px;
  right: 10px;
}

.book-info .id {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 8px;
}

.book-info .stock {
  font-size: 0.9rem;
  margin-bottom: 5px;
}

/* Responsive Styles */
@media (max-width: 991px) {
    .hero-section {
        text-align: center;
        padding-top: 7rem;
    }
    
    .hero-cta {
        justify-content: center;
    }
    
    .hero-image {
        margin-top: 3rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-box input, 
    .search-box select, 
    .search-box button {
        width: 100%;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-bottom .social-links {
        margin-top: 1rem;
    }
}

@media (max-width: 767px) {
  .hero-section h1 {
      font-size: 2.5rem;
  }
  
  .section-header h2 {
      font-size: 1.8rem;
  }
  
  .stat-card {
      margin-bottom: 2rem;
  }
  
  .feature-card {
      margin-bottom: 2rem;
      padding: 1.5rem;
      margin-left: 0.5rem;
      margin-right: 0.5rem;
  }
  
  .col-md-4 {
      padding-left: 15px;
      padding-right: 15px;
      margin-bottom: 20px;
  }
  
  .team-card {
      margin-bottom: 2rem;
  }
}

@media (max-width: 575px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-cta {
        flex-direction: column;
    }
    
    .hero-cta .btn {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
}

/* Stats Section Mobile Styling */
@media (max-width: 768px) {
  .stats-section .row {
      display: flex;
      flex-wrap: nowrap;
      overflow-x: auto;
      padding-bottom: 15px;
      margin: 0 -10px;
      -webkit-overflow-scrolling: touch; /* Untuk scrolling yang smooth di iOS */
  }
  
  .stats-section .col-md-3 {
      flex: 0 0 auto;
      width: 200px;
      padding: 0 10px;
  }
  
  .stats-section .stat-card {
      height: 100%;
      padding: 15px 10px;
  }
  
  .stats-section .stat-card h3 {
      font-size: 1.5rem;
  }
  
  .stats-section .stat-card p {
      font-size: 0.9rem;
  }
  
  /* Buku layout - 2 buku per baris di mobile */
  .collections-section .row .col-md-3,
  #physical-books .row .col-md-3,
  #ebooks .row .col-md-3 {
      width: 50%;
  }
}

@media (max-width: 767px) {
  .book-item, .ebook-item {
      width: 50% !important;
      padding: 0 8px !important;
      flex: 0 0 50% !important;
      max-width: 50% !important;
  }
  
  .book-card {
      margin-bottom: 15px;
      height: 100%;
  }
  
  .book-cover img {
      height: 250px !important;
      object-fit: cover;
  }
  
  .book-info h4 {
      font-size: 14px !important;
      margin-bottom: 5px !important;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      height: 40px;
  }
  
  .book-info p {
      font-size: 12px !important;
      margin-bottom: 4px !important;
  }
  
  .book-info .btn-detail {
      padding: 5px 10px !important;
      font-size: 12px !important;
  }
  
  .row.g-4 {
      margin: 0 -8px;
      display: flex;
      flex-wrap: wrap;
  }
  
  /* Fix for the book status badge */
  .book-status .badge {
      font-size: 10px !important;
      padding: 3px 6px !important;
  }
  
  /* Improve spacing in collections section */
  .collections-section {
      padding: 40px 0;
  }
  
  .section-header {
      margin-bottom: 20px;
  }
  
  .section-header h2 {
      font-size: 24px;
  }
  
  .section-header p {
      font-size: 14px;
  }
  
  /* Improve tab navigation on mobile */
  .nav-pills {
      margin-bottom: 15px !important;
  }
  
  .nav-pills .nav-link {
      padding: 6px 12px !important;
      font-size: 14px !important;
  }
}

/* Book Detail Modal Styling */
.book-detail-modal {
  display: flex;
  flex-direction: row;
  gap: 30px;
  text-align: left;
  margin-top: 20px;
}

/* Book cover container */
.book-detail-modal .book-cover {
  flex: 0 0 35%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Book cover image - standardized size */
.book-detail-modal .book-cover > img:first-child {
  width: 200px;
  height: 280px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  margin-bottom: 20px;
}

/* QR Code container */
.book-detail-modal .qr-container {
  width: 200px;
  margin: 0 auto 20px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
  text-align: center;
  display: block !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* QR Code image */
.book-detail-modal .qr-container img {
  width: 150px;
  height: 150px;
  display: block !important;
  margin: 0 auto 10px;
  background-color: white;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* QR Code text */
.book-detail-modal .qr-container p {
  margin: 5px 0 0;
  text-align: center;
  font-size: 14px;
  color: #555;
}

/* Book info container */
.book-detail-modal .book-info {
  flex: 0 0 60%;
  padding-top: 10px;
}

.book-detail-modal .book-info p {
  margin-bottom: 12px;
  line-height: 1.5;
}

.book-detail-modal .book-description {
  margin-top: 20px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.book-detail-modal .book-description h5 {
  margin-bottom: 15px;
  font-weight: 600;
  color: #333;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .book-detail-modal {
      flex-direction: column;
  }
  
  .book-detail-modal .book-cover {
      flex: 0 0 100%;
      margin-bottom: 20px;
  }
  
  /* Keep cover image size consistent on mobile */
  .book-detail-modal .book-cover > img:first-child {
      width: 180px;
      height: 250px;
  }
  
  .book-detail-modal .book-info {
      flex: 0 0 100%;
      padding-top: 0;
  }
  
  /* Adjust SweetAlert width for mobile */
  .swal2-popup {
      width: 95% !important;
      padding: 15px !important;
  }
  
  /* Ensure QR code is visible and properly sized on mobile */
  .book-detail-modal .qr-container {
      width: 180px;
      margin: 0 auto 20px;
  }
  
  .book-detail-modal .qr-container img {
      width: 130px;
      height: 130px;
  }
}

/* Badge styling */
.book-detail-modal .badge {
  padding: 5px 10px;
  border-radius: 4px;
  font-weight: 500;
}

.book-detail-modal .badge.bg-success {
  background-color: #28a745;
}

.book-detail-modal .badge.bg-danger {
  background-color: #dc3545;
}

/* Improve SweetAlert styling */
.swal2-title {
  font-size: 1.5rem !important;
  margin-bottom: 15px !important;
  color: #333 !important;
}

.swal2-html-container {
  margin: 0 !important;
  padding: 0 !important;
}

.swal2-popup {
  padding: 20px !important;
}
/* Tambahkan scrollbar yang lebih baik untuk stats section di mobile */
.stats-section .row::-webkit-scrollbar {
  height: 4px;
}

.stats-section .row::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.stats-section .row::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 10px;
}

.stats-section .row::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Additional Utility Classes */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-light {
    background-color: var(--light-gray) !important;
}

.shadow {
    box-shadow: var(--shadow) !important;
}

.rounded {
    border-radius: 8px !important;
}

.transition {
    transition: var(--transition) !important;
}

/* Hover Effects */
.hover-lift {
    transition: var(--transition);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}
