/* ==========================================
   DETAILS.CSS - Detail Content Pages (OPTIMIZED & FIXED)
   Pages: book_detail.html, author_detail.html, genre_detail.html
   Dependencies: core.css (must be loaded first)
   ========================================== */

/* ==========================================
   BOOK DETAIL PAGE - MAIN CONTAINER
   ========================================== */

.bk-detail-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}


/* ==========================================
   BOOK HEADER - ENHANCED LAYOUT
   ========================================== */

.bk-detail-header {
  background: linear-gradient(135deg, var(--background-white) 0%, #f8fafc 100%);
  padding: var(--space-10) var(--space-8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.bk-header-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-10);
  align-items: start;
}

.bk-title-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  z-index: 1;
}

.bk-detail-title {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  color: var(--text-color);
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.bk-authors-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.bk-authors-label {
  color: var(--text-muted);
  font-style: italic;
  font-size: var(--text-lg);
}

.bk-author-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-lg);
  transition: var(--transition);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.bk-author-link:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
  text-decoration: none;
}

.bk-book-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 2;
  min-height: 28px; /* Ensure minimum height to prevent collapse */
}

.bk-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  margin-bottom: var(--space-1);
  max-width: 120px;
  text-overflow: ellipsis;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bk-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  z-index: 4;
}

.bk-header-stats {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
  margin-top: var(--space-4);
  clear: both;
}

.bk-stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.bk-stat-item i {
  color: var(--primary-color);
  font-size: var(--text-base);
}

.bk-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-3);
  position: relative;
  z-index: 1;
}

.bk-price-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
}

.bk-price-free {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: linear-gradient(135deg, var(--free-color), #20c997);
  color: white;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-lg);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-md);
}

.bk-price-amount {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
}

.bk-price-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================
   MAIN CONTENT LAYOUT - FIXED
   ========================================== */

.bk-main-content {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--space-10);
  align-items: start;
}

/* ==========================================
   LEFT PANEL - 3D BOOK SHOWCASE
   ========================================== */

.bk-left-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  position: sticky;
  top: var(--space-5);
}

.bk-book-showcase {
  display: flex;
  justify-content: center;
  padding: var(--space-6);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.bk-book-detail {
  width: 260px;
  height: 380px;
  margin: 0;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.bk-book-detail:hover {
  transform: scale(1.02);
}

.bk-book-detail .bk-book-cover {
  box-shadow:
    inset 4px 1px 3px rgba(255, 255, 255, 0.375),
    inset 0 -1px 2px rgba(0, 0, 0, 0.5),
    8px 8px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bk-book-detail:hover .bk-book-cover {
  transform: perspective(2000px) rotateY(-75deg);
  box-shadow:
    inset 4px 1px 3px rgba(255, 255, 255, 0.375),
    inset 0 -1px 2px rgba(0, 0, 0, 0.5),
    12px 12px 25px rgba(0, 0, 0, 0.35);
}

.bk-book-detail .bk-book-inside {
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-3);
  box-shadow:
    15px 50px 50px -15px rgba(0, 0, 0, 0.2),
    inset -2px 0 0 #999,
    inset -3px 0 0 #dbdbdb,
    inset -4px 0 0 white,
    inset -5px 0 0 #dbdbdb,
    inset -6px 0 0 white,
    inset -7px 0 0 #dbdbdb,
    inset -8px 0 0 white,
    inset -9px 0 0 #dbdbdb;
}

.bk-book-inside-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-color);
  text-align: center;
  line-height: 1.3;
  margin: 0;
  padding: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bk-format-info {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.bk-format-badge {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--background-light);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.bk-pages-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: auto;
}

/* ==========================================
   DETAIL ACTIONS - ENHANCED UX
   ========================================== */

.bk-detail-actions {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.bk-user-status-card {
  padding: var(--space-6);
  background: var(--background-light);
  border-bottom: 1px solid var(--border-color);
}

.bk-access-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.bk-access-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-sm);
}

.bk-access-premium {
  background: linear-gradient(135deg, var(--premium-color), #ffed4a);
  color: #8b6914;
}

.bk-access-free {
  background: linear-gradient(135deg, var(--free-color), #20c997);
  color: white;
}

.bk-access-basic {
  background: linear-gradient(135deg, var(--secondary-color), #5a6268);
  color: white;
}

.bk-quota-display {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.bk-quota-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}

.bk-quota-text span {
  color: var(--text-muted);
}

.bk-quota-text strong {
  color: var(--text-color);
  font-weight: 700;
}

.bk-quota-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bk-quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success-color), var(--warning-color));
  transition: width 0.3s ease;
  border-radius: inherit;
}

.bk-quota-remaining {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.bk-primary-actions {
  padding: var(--space-6);
}

/* ==========================================
   ACTION SECTIONS - IMPROVED LAYOUT
   ========================================== */

.bk-owned-section,
.bk-free-section,
.bk-premium-section,
.bk-sample-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.bk-section-header {
  text-align: center;
}

.bk-section-header h4 {
  margin: 0 0 var(--space-2) 0;
  color: var(--text-color);
  font-size: var(--text-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.bk-section-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.bk-owned-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, var(--success-color), #20c997);
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.bk-download-actions,
.bk-purchase-actions,
.bk-sample-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.bk-option-divider {
  position: relative;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
  margin: var(--space-5) 0;
  padding: 0 var(--space-4);
}

.bk-option-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-color);
  z-index: 1;
}

.bk-option-divider span {
  background: white;
  padding: 0 var(--space-3);
  position: relative;
  z-index: 2;
}

.bk-in-cart-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.bk-in-cart-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, var(--success-color), #20c997);
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.bk-cart-actions {
  display: flex;
  gap: var(--space-3);
}

.bk-remove-form {
  display: inline;
  margin: 0;
}

.bk-purchase-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.bk-purchase-actions form {
  margin: 0;
}

.bk-sample-actions {
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  justify-content: center;
}

/* ==========================================
   AUTH REQUIRED SECTION
   ========================================== */

.bk-auth-required {
  padding: var(--space-8);
  text-align: center;
  background: var(--background-light);
  border-radius: var(--radius-lg);
}

.bk-auth-message {
  margin-bottom: var(--space-6);
}

.bk-auth-icon {
  margin-bottom: var(--space-4);
}

.bk-auth-icon i {
  font-size: var(--text-4xl);
  color: var(--text-muted);
}

.bk-auth-message h4 {
  color: var(--text-color);
  margin: 0 0 var(--space-3) 0;
  font-size: var(--text-xl);
  font-weight: 600;
}

.bk-auth-message p {
  color: var(--text-muted);
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.5;
}

.bk-auth-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ==========================================
   RIGHT PANEL - CONTENT SECTIONS
   ========================================== */

.bk-right-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  min-width: 0;
}

.bk-description-section,
.bk-properties-section {
  background: white;
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.bk-section-header {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--border-color);
}

.bk-section-header h2,
.bk-section-header h3 {
  margin: 0;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
}

.bk-section-header h2 {
  font-size: var(--text-2xl);
}

.bk-section-header h3 {
  font-size: var(--text-xl);
}

.bk-description-content {
  color: var(--text-color);
  line-height: 1.7;
  font-size: var(--text-base);
}

.bk-description-content p {
  margin-bottom: var(--space-4);
}

.bk-description-content p:last-child {
  margin-bottom: 0;
}

/* ==========================================
   PROPERTIES GRID - ENHANCED
   ========================================== */

.bk-properties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
}

.bk-prop-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--background-light);
  border-radius: var(--radius);
  transition: var(--transition);
  border: 1px solid transparent;
}

.bk-prop-item:hover {
  background: #e9ecef;
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
}

.bk-prop-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-color);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-lg);
}

.bk-prop-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.bk-prop-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bk-prop-value {
  font-size: var(--text-base);
  color: var(--text-color);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.bk-prop-value:hover {
  color: var(--primary-color);
}

/* ==========================================
   BUTTON STYLES - ENHANCED
   ========================================== */

.bk-btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  min-height: 50px;
}

.bk-btn-get {
  background: linear-gradient(135deg, var(--premium-color), #ffed4a);
  color: #8b6914;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bk-btn-get:hover:not(:disabled) {
  background: linear-gradient(135deg, #e6c200, var(--premium-color));
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 215, 0, 0.4);
}

.bk-btn-download {
  background: linear-gradient(135deg, var(--success-color), #20c997);
  color: white;
  font-weight: 600;
}

.bk-btn-download:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e7e34, var(--success-color));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================
   SECTIONS ACCORDION (MATCHING OLD STYLE)
   ========================================== */

.bk-sections {
  margin-top: 40px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  font-family: 'Open Sans', sans-serif;
}

.bk-sections-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: #f8f9fa;
  cursor: pointer;
  transition: background-color 0.3s ease;
  border-bottom: 1px solid #eee;
}

.bk-sections-header:hover {
  background-color: #eaecef;
}

.bk-sections-header h2 {
  font-size: 20px;
  color: #444;
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.bk-sections-container {
  overflow: hidden;
  max-height: none; /* Always visible by default */
  transition: max-height 0.5s ease;
}

.bk-sections-container.collapsed {
  max-height: 0; /* Hide when collapsed */
}

/* Individual section descriptions */
.bk-section-description {
  display: none; /* Hidden by default */
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease;
  padding: 0 20px;
  background-color: #f8f9fa;
  border-top: 1px solid #e9ecef;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  margin: 0;
  max-height: 0;
  overflow: hidden;
}

.bk-section-description.is-open {
  display: block;
  opacity: 1;
  visibility: visible;
  max-height: 500px; /* Enough height for most descriptions */
  padding: 15px 20px;
  overflow: visible;
}

.bk-section-description.hidden {
  display: none !important; /* Hide when collapsed */
  opacity: 0;
}

.bk-section-description p {
  margin: 0;
  padding: 0;
}

.bk-toggle-icon, .bk-section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.bk-toggle-icon i, .bk-section-icon i {
  color: #666;
  font-size: 14px;
}

.bk-toggle-icon.active i, .bk-section-icon.active i {
  transform: rotate(180deg);
}

.bk-section {
  margin: 10px;
  background-color: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.bk-section:hover {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.bk-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background-color: #f8f8f8;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.bk-section-title:hover {
  background-color: #f0f0f0;
}

.bk-section-title.active {
  background-color: #f0f0f0;
  border-left: 3px solid #278fff;
}

.bk-section-title h3 {
  margin: 0;
  color: #555;
  font-size: 15px;
  font-weight: 500;
}

.bk-section-description.active {
  max-height: 500px;
  display: block;
  visibility: visible;
  opacity: 1;
  padding: 15px 20px;
  overflow: visible;
}

/* Note: .bk-section-description.active is deprecated in favor of .is-open */

.bk-section-description p {
  margin: 0;
  color: #666;
  font-size: 14px;
  text-align: justify;
  letter-spacing: 0.3px;
  line-height: 1.5;
}

/* ==========================================
   SIMILAR BOOKS SECTION
   ========================================== */

.bk-similar-books {
  margin-bottom: var(--space-10);
}

.bk-similar-books .bk-section-header {
  text-align: left;
  margin-bottom: var(--space-8);
  border: none;
  padding: 0;
}

.bk-section-title {
  margin: 0;
  color: var(--text-color);
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-3xl);
  font-weight: 700;
}

.bk-similar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-8);
}

/* ==========================================
   MODAL ENHANCEMENTS
   ========================================== */

.bk-quota-confirmation {
  text-align: center;
  margin-bottom: var(--space-6);
}

.bk-confirmation-icon {
  margin-bottom: var(--space-4);
}

.bk-confirmation-icon i {
  font-size: var(--text-4xl);
  color: var(--primary-color);
}

.bk-quota-confirmation p {
  margin: 0 0 var(--space-3) 0;
  color: var(--text-color);
  line-height: 1.6;
}

.bk-modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

/* ==========================================
   RESPONSIVE DESIGN - ENHANCED
   ========================================== */

/* Tablets and medium screens */
@media (max-width: 1024px) {
  .bk-main-content {
    grid-template-columns: 320px 1fr;
    gap: var(--space-6);
  }
  
  .bk-book-detail {
    width: 220px;
    height: 320px;
  }
  
  .bk-properties-grid {
    grid-template-columns: 1fr;
  }
  
  .bk-detail-container {
    padding: var(--space-4);
  }
}

/* Tablets and small screens */
@media (max-width: 768px) {
  .bk-detail-container {
    padding: var(--space-3);
    gap: var(--space-4);
  }
  
  .bk-detail-header {
    padding: var(--space-5);
  }
  
  .bk-header-content {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .bk-title-section {
    text-align: left;
  }
  
  .bk-detail-title {
    font-size: clamp(var(--text-xl), 5vw, var(--text-2xl));
  }
  
  .bk-header-stats {
    justify-content: flex-start;
    gap: var(--space-4);
  }
  
  .bk-header-actions {
    justify-content: flex-start;
  }
  
  .bk-price-display {
    justify-content: flex-start;
  }
  
  .bk-main-content {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  
  .bk-left-panel {
    order: 1;
    position: static;
    top: auto;
  }
  
  .bk-right-panel {
    order: 2;
  }
  
  .bk-book-showcase {
    padding: var(--space-4);
  }
  
  .bk-book-detail {
    width: 200px;
    height: 290px;
  }
  
  .bk-description-section,
  .bk-properties-section {
    padding: var(--space-5);
  }
  
  .bk-properties-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  
  .bk-prop-item {
    padding: var(--space-3);
  }
  
  .bk-similar-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-4);
  }
  
  .bk-purchase-actions,
  .bk-cart-actions {
    flex-direction: column;
    gap: var(--space-3);
  }
  
  .bk-sample-actions {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .bk-btn-lg {
    width: 100%;
  }
  
  .bk-user-status-card {
    padding: var(--space-4);
  }
  
  .bk-primary-actions {
    padding: var(--space-4);
  }
}

/* ==========================================
   RESPONSIVE DESIGN IMPROVEMENTS
   ========================================== */

/* Tablet and smaller screens */
@media (max-width: 768px) {
  .bk-book-badges {
    gap: var(--space-2);
    justify-content: flex-start;
  }
  
  .bk-badge {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
    max-width: 100px;
  }
  
  .bk-accordion-header {
    padding: var(--space-4) var(--space-4);
  }
  
  .bk-accordion-title {
    font-size: var(--text-lg);
  }
  
  .bk-accordion-item-header {
    padding: var(--space-3) var(--space-4);
  }
  
  .bk-section-number {
    width: 20px;
    height: 20px;
    font-size: var(--text-xs);
  }
  
  /* Modal improvements for tablets */
  .bk-modal-content {
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 500px;
  }
  
  .bk-modal-header {
    padding: var(--space-4);
  }
  
  .bk-modal-body {
    padding: var(--space-4);
  }
  
  /* Auth section improvements */
  .bk-auth-required {
    padding: var(--space-5);
  }
  
  .bk-auth-actions {
    flex-direction: column;
    gap: var(--space-3);
  }
  
  .bk-auth-actions .bk-btn {
    width: 100%;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .bk-detail-container {
    padding: var(--space-2);
    gap: var(--space-3);
  }
  
  .bk-detail-header {
    padding: var(--space-4);
  }
  
  .bk-detail-title {
    font-size: var(--text-xl);
    line-height: 1.3;
  }
  
  .bk-authors-info {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
  
  .bk-book-badges {
    gap: var(--space-1);
    margin-top: var(--space-2);
  }
  
  .bk-badge {
    font-size: 10px;
    padding: 2px 6px;
    max-width: 80px;
    letter-spacing: 0.3px;
  }
  
  .bk-header-stats {
    flex-direction: column;
    gap: var(--space-2);
    align-items: flex-start;
  }
  
  .bk-stat-item {
    font-size: var(--text-xs);
  }
  
  .bk-price-display {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .bk-price-amount {
    font-size: var(--text-2xl);
  }
  
  .bk-book-showcase {
    padding: var(--space-3);
  }
  
  .bk-book-detail {
    width: 160px;
    height: 230px;
  }
  
  .bk-book-inside-title {
    font-size: 11px;
  }
  
  .bk-format-badge {
    font-size: 9px;
    padding: 2px 4px;
  }
  
  .bk-pages-info {
    font-size: 9px;
  }
  
  .bk-description-section,
  .bk-properties-section {
    padding: var(--space-4);
  }
  
  .bk-section-header h2,
  .bk-section-header h3 {
    font-size: var(--text-lg);
  }
  
  .bk-description-content {
    font-size: var(--text-sm);
  }
  
  .bk-prop-item {
    padding: var(--space-2);
  }
  
  .bk-prop-icon {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
  }
  
  .bk-prop-label {
    font-size: var(--text-xs);
  }
  
  .bk-prop-value {
    font-size: var(--text-sm);
  }
  
  .bk-similar-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
  }
  
  .bk-accordion-header {
    padding: var(--space-3);
  }
  
  .bk-accordion-title {
    font-size: var(--text-base);
    gap: var(--space-2);
  }
  
  .bk-accordion-item-header {
    padding: var(--space-2) var(--space-3);
  }
  
  .bk-accordion-item-title {
    font-size: var(--text-sm);
    gap: var(--space-1);
  }
  
  .bk-section-number {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  
  .bk-accordion-item-content {
    padding: var(--space-3);
    font-size: var(--text-sm);
  }
  
  /* Modal improvements for mobile */
  .bk-modal-content {
    margin: 10% auto;
    width: 95%;
    max-width: none;
  }
  
  .bk-modal-header h3 {
    font-size: var(--text-lg);
  }
  
  .bk-modal-body {
    padding: var(--space-3);
  }
  
  .bk-quota-confirmation p {
    font-size: var(--text-sm);
  }
  
  .bk-modal-actions {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .bk-modal-actions .bk-btn {
    width: 100%;
  }
  
  /* Button improvements */
  .bk-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }
  
  .bk-btn-lg {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
  }
  
  .bk-btn-sm {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
  }
  
  /* Section header improvements */
  .bk-section-header {
    padding: var(--space-3);
  }
  
  .bk-section-header h4 {
    font-size: var(--text-base);
  }
  
  .bk-section-header p {
    font-size: var(--text-xs);
  }
  
  /* User status card */
  .bk-user-status-card {
    padding: var(--space-3);
  }
  
  .bk-access-badge {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
  
  .bk-quota-text {
    font-size: var(--text-xs);
  }
  
  .bk-quota-remaining {
    font-size: var(--text-xs);
  }
  
  /* Primary actions */
  .bk-primary-actions {
    padding: var(--space-3);
  }
  
  .bk-owned-section,
  .bk-free-section,
  .bk-premium-section {
    gap: var(--space-3);
  }
  
  .bk-option-divider {
    margin: var(--space-3) 0;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  .bk-detail-container {
    padding: var(--space-1);
    gap: var(--space-2);
  }
  
  .bk-detail-header {
    padding: var(--space-3);
  }
  
  .bk-detail-title {
    font-size: var(--text-lg);
  }
  
  .bk-book-badges {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
  
  .bk-badge {
    max-width: none;
    width: auto;
  }
  
  .bk-book-detail {
    width: 140px;
    height: 200px;
  }
  
  .bk-description-section,
  .bk-properties-section {
    padding: var(--space-3);
  }
  
  .bk-prop-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  
  .bk-similar-grid {
    grid-template-columns: 1fr;
  }
  
  .bk-modal-content {
    width: 98%;
  }
}

/* ==========================================
   RESPONSIVE DESIGN FOR OLD-STYLE ACCORDION
   ========================================== */

/* Tablet and smaller screens */
@media (max-width: 768px) {
  .bk-sections {
    margin-top: 30px;
  }
  
  .bk-sections-header {
    padding: 12px 15px;
  }
  
  .bk-sections-header h2 {
    font-size: 18px;
  }
  
  .bk-section {
    margin: 8px;
  }
  
  .bk-section-title {
    padding: 10px 12px;
  }
  
  .bk-section-title h3 {
    font-size: 14px;
  }
  
  .bk-section-description p {
    font-size: 13px;
  }
  
  .bk-section-description.active {
    padding: 12px;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .bk-sections {
    margin-top: 20px;
  }
  
  .bk-sections-header {
    padding: 10px 12px;
  }
  
  .bk-sections-header h2 {
    font-size: 16px;
    gap: var(--space-2);
  }
  
  .bk-section {
    margin: 6px;
  }
  
  .bk-section-title {
    padding: 8px 10px;
  }
  
  .bk-section-title h3 {
    font-size: 13px;
  }
  
  .bk-section-description p {
    font-size: 12px;
  }
  
  .bk-section-description.active {
    padding: 10px;
  }
}

/* ==========================================
   ACCESSIBILITY & REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
  .bk-book-detail,
  .bk-book-detail .bk-book-cover,
  .bk-prop-item,
  .bk-sections-header,
  .bk-section-title,
  .bk-toggle-icon,
  .bk-section-icon {
    transition: none;
  }
  
  .bk-book-detail:hover {
    transform: none;
  }
  
  .bk-book-detail:hover .bk-book-cover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .bk-detail-header,
  .bk-book-showcase,
  .bk-detail-actions,
  .bk-description-section,
  .bk-properties-section,
  .bk-sections {
    border: 2px solid #000;
  }
  
  .bk-prop-item {
    border: 1px solid #000;
  }
  
  .bk-badge,
  .bk-access-badge,
  .bk-owned-indicator,
  .bk-in-cart-indicator {
    border: 1px solid #000;
  }
}

/* Print styles */
@media print {
  .bk-detail-actions,
  .bk-similar-books,
  .bk-sections {
    display: none !important;
  }
  
  .bk-main-content {
    grid-template-columns: 1fr;
  }
  
  .bk-left-panel {
    display: none;
  }
}

/* ==========================================
   CART BUTTON STYLING
   ========================================== */

.bk-cart-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  transition: var(--transition);
  font-weight: 600;
  min-height: 48px;
}

.bk-cart-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.bk-cart-btn i {
  font-size: 1.1em;
}

.bk-cart-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.bk-cart-btn.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Print styles */
@media print {
  .bk-detail-actions,
  .bk-similar-books,
  .bk-sections {
    display: none !important;
  }
  
  .bk-main-content {
    grid-template-columns: 1fr;
  }
  
  .bk-left-panel {
    display: none;
  }
}