/* ==========================================
   COMPANY PROFILE 3D FLIPBOOK STYLES
   ========================================== */

.company-profile-page {
  background: #f8fafc;
  min-height: 100vh;
}

/* ── Hero Section ── */
.profile-hero-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 60px 0 50px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.profile-hero-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 30%, rgba(37, 99, 235, 0.15), transparent 70%);
  pointer-events: none;
}

.profile-hero-content {
  max-width: 820px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 18px;
}

.profile-hero-content h1 {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
  line-height: 1.25;
  color: #ffffff;
}

.profile-hero-content p {
  font-size: 1.02rem;
  color: #94a3b8;
  line-height: 1.65;
  margin-bottom: 24px;
}

.profile-hero-content strong {
  color: #38bdf8;
}

.profile-quick-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.quick-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
}

.quick-tag svg {
  color: #10b981;
}

/* ── Main Flipbook Section ── */
.flipbook-section {
  padding: 24px 0 70px 0;
}

.flipbook-stage-wrapper {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.flipbook-stage-wrapper.fullscreen-active {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 999999;
  border-radius: 0;
  border: none;
  background: #0b1329;
  display: flex;
  flex-direction: column;
}

/* ── Toolbar ── */
.flipbook-toolbar {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #1e293b;
  flex-wrap: wrap;
}

.doc-title-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-icon {
  color: #3b82f6;
  flex-shrink: 0;
}

.doc-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff;
}

.doc-meta {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
}

.page-counter-badge {
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  text-decoration: none;
}

.toolbar-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.toolbar-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #3b82f6;
}

.toolbar-btn.icon-only {
  padding: 8px;
}

.download-btn {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

.download-btn:hover {
  background: #059669;
  border-color: #059669;
}

.zoom-controls-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 2px 6px;
}

.zoom-controls-group .toolbar-btn {
  background: transparent;
  border: none;
  padding: 4px 6px;
}

.zoom-level-text {
  font-size: 0.78rem;
  font-weight: 800;
  color: #38bdf8;
  min-width: 42px;
  text-align: center;
}

/* ── Thumbnail Drawer ── */
.flipbook-thumbnails-drawer {
  background: #0f172a;
  border-bottom: 2px solid #2563eb;
  padding: 16px 24px;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 700;
}

.close-drawer-btn {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 1.2rem;
  cursor: pointer;
  font-weight: bold;
}

.thumbnails-scroll-grid {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: #3b82f6 #1e293b;
}

.thumbnail-card {
  flex: 0 0 110px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.thumb-img-wrapper {
  width: 100%;
  height: 140px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid #334155;
  background: #ffffff;
  transition: all 0.25s ease;
}

.thumb-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-card:hover .thumb-img-wrapper {
  border-color: #3b82f6;
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.thumbnail-card.active .thumb-img-wrapper {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4);
}

.thumb-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
}

.thumbnail-card.active .thumb-num {
  color: #10b981;
}

/* ── 3D Book Stage ── */
.book-stage-area {
  background: radial-gradient(circle, #f1f5f9 0%, #cbd5e1 100%);
  padding: 40px 60px;
  min-height: 580px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
}

.fullscreen-active .book-stage-area {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 120px);
  padding: 20px 80px;
  background: radial-gradient(circle at center, #1e293b 0%, #0b1329 100%);
  overflow: auto;
}

.book-zoom-viewport {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center center;
}

.book-nav-arrow {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
}

.fullscreen-active .book-nav-arrow {
  background: rgba(30, 41, 59, 0.9);
  border-color: #334155;
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.book-nav-arrow:hover:not(.disabled) {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  transform: translateY(-50%) scale(1.12);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
}

.book-nav-arrow.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.arrow-left { left: 24px; }
.arrow-right { right: 24px; }

/* ── 3D Book Structure ── */
.flipbook-container {
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2000px;
  position: relative;
  transition: all 0.4s ease;
}

/* Cover Single Page View */
.flipbook-container.is-cover-mode .single-cover-page {
  width: min(45vw, 430px);
  height: min(68vh, 580px);
  aspect-ratio: 0.707 / 1;
  background: #ffffff;
  border-radius: 0 8px 8px 0;
  box-shadow: 
    12px 18px 40px rgba(15, 23, 42, 0.28),
    inset -3px 0 10px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-left: 6px solid #1e293b; /* Book Spine Edge */
}

.fullscreen-active .flipbook-container.is-cover-mode .single-cover-page {
  width: min(42vw, 620px);
  height: min(78vh, 840px);
}

.single-cover-page .cover-img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  background: #ffffff;
}

.page-paper-shine {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(115deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 40%);
  pointer-events: none;
}

/* Open 2-Page Spread */
.open-book-spread {
  display: flex;
  width: min(90vw, 860px);
  height: min(68vh, 580px);
  aspect-ratio: 1.414 / 1;
  background: #ffffff;
  box-shadow: 
    0 24px 60px rgba(15, 23, 42, 0.28),
    0 4px 16px rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  position: relative;
  perspective: 2000px;
  transform-style: preserve-3d;
}

.fullscreen-active .open-book-spread {
  width: min(85vw, 1240px);
  height: min(78vh, 840px);
}

.book-page-slot {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.slot-left {
  border-radius: 4px 0 0 4px;
  border-right: 1px solid #e2e8f0;
}

.slot-right {
  border-radius: 0 4px 4px 0;
  border-left: 1px solid #e2e8f0;
}

.book-page-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

/* Center Fold Spine Effect */
.book-center-fold {
  width: 30px;
  height: 100%;
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  background: linear-gradient(90deg, 
    rgba(0,0,0,0.15) 0%, 
    rgba(0,0,0,0.02) 40%, 
    rgba(0,0,0,0.02) 60%, 
    rgba(0,0,0,0.15) 100%
  );
  z-index: 10;
  pointer-events: none;
}

.page-inner-shadow {
  position: absolute;
  top: 0; bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 5;
}

.shadow-left {
  right: 0;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.08));
}

.shadow-right {
  left: 0;
  background: linear-gradient(-90deg, transparent, rgba(0,0,0,0.08));
}

.page-number-footer {
  position: absolute;
  bottom: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.85);
  padding: 2px 8px;
  border-radius: 3px;
  z-index: 6;
}

.left-num { left: 12px; }
.right-num { right: 12px; }

/* ── 3D Leaf Animation ── */
.flip-leaf-animated {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  z-index: 15;
  pointer-events: none;
}

.flip-next {
  right: 0;
  transform-origin: left center;
  animation: flipNextPage 0.6s ease-in-out forwards;
}

.flip-prev {
  left: 0;
  transform-origin: right center;
  animation: flipPrevPage 0.6s ease-in-out forwards;
}

@keyframes flipNextPage {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-180deg); }
}

@keyframes flipPrevPage {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(180deg); }
}

.flip-leaf-front,
.flip-leaf-back {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  backface-visibility: hidden;
  background: #ffffff;
}

.flip-leaf-front img,
.flip-leaf-back img {
  width: 100%; height: 100%;
  object-fit: contain;
}

.flip-leaf-back {
  transform: rotateY(180deg);
}

.flip-glare-effect {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.4), transparent);
}

/* ── Bottom Slider Bar ── */
.flipbook-bottom-bar {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.fullscreen-active .flipbook-bottom-bar {
  background: #0f172a;
  border-top: 1px solid #1e293b;
  color: #ffffff;
}

.fullscreen-active .nav-text-btn {
  background: #1e293b;
  border-color: #334155;
  color: #38bdf8;
}

.fullscreen-active .nav-text-btn:hover:not(:disabled) {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.fullscreen-active .slider-ticks {
  color: #94a3b8;
}

.nav-text-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.nav-text-btn:hover:not(:disabled) {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.nav-text-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.slider-track-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-slider-range {
  width: 100%;
  accent-color: #2563eb;
  cursor: pointer;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
}

.slider-ticks span {
  cursor: pointer;
  transition: color 0.2s ease;
}

.slider-ticks span:hover {
  color: #2563eb;
}

/* ── Bottom CTA Box ── */
.flipbook-cta-box {
  margin-top: 36px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: 12px;
  padding: 32px 40px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid #334155;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.cta-box-text h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: #ffffff;
}

.cta-box-text p {
  font-size: 0.92rem;
  color: #94a3b8;
  margin: 0;
}

.cta-box-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

/* ── Responsive Mobile Styles ── */
@media (max-width: 900px) {
  .open-book-spread {
    width: 100%;
    max-width: 480px;
    height: 480px;
  }
  .slot-left { display: none; }
  .slot-right { border-radius: 4px; border-left: none; }
  .book-center-fold { display: none; }
  .book-nav-arrow { width: 38px; height: 38px; }
  .arrow-left { left: 4px; }
  .arrow-right { right: 4px; }
  .flipbook-cta-box {
    flex-direction: column;
    text-align: center;
    padding: 24px;
    margin-bottom: 50px;
  }
  .cta-box-actions {
    flex-direction: column;
    width: 100%;
  }
  .cta-box-actions a {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .profile-hero-content h1 { font-size: 1.5rem; }
  .flipbook-section { padding: 12px 0 60px 0; }
  .flipbook-toolbar {
    padding: 10px 12px;
    gap: 8px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .doc-title-info .doc-meta { display: none; }
  .doc-name { font-size: 0.8rem; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-counter-badge { font-size: 0.72rem; padding: 4px 10px; }
  .toolbar-right { gap: 4px; }
  .toolbar-btn { padding: 5px 8px; font-size: 0.75rem; }
  .btn-label { display: none; }
  .download-btn span { display: none; }
  .download-btn { padding: 6px 10px; }

  /* Stage & Book Area Responsive Sizing */
  .book-stage-area { 
    padding: 16px 4px; 
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .flipbook-container.is-cover-mode .single-cover-page { 
    width: calc(100vw - 70px); 
    max-width: 290px; 
    height: calc((100vw - 70px) * 1.414); 
    max-height: 410px; 
  }
  .open-book-spread { 
    width: calc(100vw - 70px); 
    max-width: 290px; 
    height: calc((100vw - 70px) * 1.414); 
    max-height: 410px; 
  }

  /* Bottom slider & nav text buttons */
  .flipbook-bottom-bar {
    padding: 10px 12px;
    gap: 8px;
  }
  .nav-text-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .slider-track-wrapper {
    min-width: 0;
  }
  .slider-ticks .tick-mid {
    display: none;
  }
  .slider-ticks {
    font-size: 0.68rem;
  }
  
  /* CTA Box Bottom Margin for WA Floating Button */
  .flipbook-cta-box {
    margin-top: 24px;
    margin-bottom: 80px;
    padding: 20px 16px;
  }
}
