/**
 * LeapsGo Book Publisher - Stylesheet
 * Reusable styles for Book Single Preview Pages and the Admin Upload Form.
 */

/* ==========================================================================
   01. Common Page Wrapper & Base Containers
   ========================================================================== */

.lg-cookbook-page,
.lg-upload-page {
  position: relative !important;
  z-index: 1 !important;
  padding-top: 130px !important;
  padding-bottom: 90px !important;
  min-height: 85vh !important;
}

.lg-cookbook-card,
.lg-upload-card {
  max-width: 1040px;
  margin: 0 auto;
  background: rgba(14, 17, 24, 0.94);
  border: 1px solid var(--lg-border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--lg-radius-island, 24px);
  padding: 40px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  box-sizing: border-box;
}

/* ==========================================================================
   02. Book Single Page - Hero Section (Side-by-Side Desktop)
   ========================================================================== */

.lg-cookbook-hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 44px;
  align-items: center;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lg-cookbook-cover-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 75, 22, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #080a0e;
  line-height: 0;
}

.lg-cookbook-cover-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  aspect-ratio: 682 / 1024;
}

.lg-cookbook-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.lg-cookbook-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lg-primary, #ff4b16);
  background: rgba(255, 75, 22, 0.08);
  border: 1px solid rgba(255, 75, 22, 0.2);
  padding: 6px 14px;
  border-radius: 9999px;
}

.lg-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lg-primary, #ff4b16);
  box-shadow: 0 0 8px var(--lg-primary, #ff4b16);
}

.lg-cookbook-title {
  font-size: clamp(2.2rem, 3.8vw, 3.2rem) !important;
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
  line-height: 1.15 !important;
  color: #ffffff !important;
  margin: 0 !important;
}

.lg-cookbook-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 4px;
}

.lg-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
}

.lg-meta-icon {
  color: var(--lg-primary, #ff4b16);
  flex-shrink: 0;
}

.lg-meta-text strong {
  color: #ffffff;
  font-weight: 600;
}

.lg-cookbook-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
}

.lg-btn-cookbook {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 24px;
  font-size: 0.925rem;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.22s ease;
  cursor: pointer;
}

.lg-btn-cookbook-primary {
  background: var(--lg-primary, #ff4b16);
  color: #ffffff !important;
  border: 1px solid var(--lg-primary, #ff4b16);
  box-shadow: 0 8px 24px rgba(255, 75, 22, 0.35);
}

.lg-btn-cookbook-primary:hover {
  background: #ff5f2e;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 75, 22, 0.45);
}

.lg-btn-cookbook-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.lg-btn-cookbook-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* ==========================================================================
   03. Embedded PDF Preview Section
   ========================================================================== */

.lg-cookbook-preview-section {
  margin-top: 36px;
}

.lg-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.lg-preview-heading {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.lg-preview-counter {
  display: inline-block;
  margin-left: 12px;
  font-size: 0.8rem;
  color: var(--lg-primary, #ff4b16);
  background: rgba(255, 75, 22, 0.08);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 75, 22, 0.2);
}

.lg-preview-header-right {
  display: flex;
  gap: 12px;
}

.lg-preview-link-btn {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.lg-preview-link-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.lg-preview-download-btn {
  color: var(--lg-primary, #ff4b16);
  border-color: rgba(255, 75, 22, 0.3);
  background: rgba(255, 75, 22, 0.06);
}

.lg-preview-download-btn:hover {
  color: #ffffff;
  background: var(--lg-primary, #ff4b16);
  border-color: var(--lg-primary, #ff4b16);
}

/* Scroll Container */
.lg-pdf-scroll-container {
  height: 780px;
  max-height: 80vh;
  overflow-y: auto;
  background: #080a0e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px 16px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.lg-pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
}

.lg-pdf-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 75, 22, 0.15);
  border-top-color: var(--lg-primary, #ff4b16);
  border-radius: 50%;
  animation: lg-pdf-spin 0.8s linear infinite;
}

@keyframes lg-pdf-spin {
  to { transform: rotate(360deg); }
}

.lg-pdf-pages-stream {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.lg-pdf-page-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.lg-pdf-page-wrapper canvas {
  max-width: 100%;
  height: auto !important;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #ffffff;
}

.lg-pdf-page-number {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--lg-font-mono, monospace);
  letter-spacing: 0.05em;
}

/* ==========================================================================
   04. Admin Upload Form (/upload-book/)
   ========================================================================== */

.lg-upload-card {
  max-width: 680px;
  padding: 44px 40px;
}

.lg-upload-header {
  margin-bottom: 28px;
  text-align: center;
}

.lg-upload-title {
  font-size: 2rem !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  margin: 0 0 8px 0 !important;
}

.lg-upload-subtitle {
  font-size: 0.925rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}

.lg-upload-alert {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

.lg-upload-alert-error {
  background: rgba(255, 59, 48, 0.12);
  border: 1px solid rgba(255, 59, 48, 0.35);
  color: #ff6b60;
}

.lg-upload-alert-success {
  background: rgba(52, 199, 89, 0.12);
  border: 1px solid rgba(52, 199, 89, 0.35);
  color: #5cdb7a;
}

.lg-upload-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lg-upload-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lg-upload-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
}

.lg-upload-label .lg-required {
  color: var(--lg-primary, #ff4b16);
  margin-left: 2px;
}

.lg-upload-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  box-sizing: border-box;
  transition: all 0.2s ease;
  outline: none;
}

.lg-upload-input:focus {
  border-color: var(--lg-primary, #ff4b16);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(255, 75, 22, 0.18);
}

/* File input styling */
.lg-upload-file-box {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.lg-upload-file-box:hover {
  border-color: var(--lg-primary, #ff4b16);
  background: rgba(255, 75, 22, 0.03);
}

.lg-upload-file-input {
  width: 100%;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.875rem;
  cursor: pointer;
}

.lg-upload-hint {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 4px;
}

.lg-upload-submit-wrap {
  margin-top: 12px;
}

.lg-btn-upload-submit {
  width: 100%;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--lg-primary, #ff4b16);
  border: 1px solid var(--lg-primary, #ff4b16);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 8px 24px rgba(255, 75, 22, 0.35);
}

.lg-btn-upload-submit:hover {
  background: #ff5f2e;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 75, 22, 0.45);
}

/* ==========================================================================
   05. Responsive Breakpoints
   ========================================================================== */

@media (max-width: 860px) {
  .lg-cookbook-page,
  .lg-upload-page {
    padding-top: 100px !important;
    padding-bottom: 60px !important;
  }

  .lg-cookbook-card,
  .lg-upload-card {
    padding: 24px 18px;
    border-radius: 18px;
  }

  .lg-cookbook-hero {
    grid-template-columns: 1fr;
    gap: 28px;
    text-align: center;
  }

  .lg-cookbook-cover-wrap {
    max-width: 240px;
    margin: 0 auto;
  }

  .lg-cookbook-info {
    align-items: center;
    text-align: center;
  }

  .lg-cookbook-title {
    font-size: 2.1rem !important;
  }

  .lg-cookbook-meta-row {
    justify-content: center;
  }

  .lg-cookbook-actions {
    width: 100%;
    flex-direction: column;
  }

  .lg-btn-cookbook {
    width: 100%;
    padding: 14px 20px;
  }

  .lg-preview-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .lg-preview-header-right {
    width: 100%;
  }

  .lg-preview-link-btn {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
  }

  .lg-pdf-scroll-container {
    height: 580px;
    padding: 14px 8px;
  }
}
