/* Dark Mode Toggle */
.color-mode-wrapper {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 9999;
}

.color-mode-wrapper .color-mode {
  cursor: pointer;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(212, 163, 90, 0.2);
  width: 50px;
  height: 50px;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(212, 163, 90, 0.1);
}

.color-mode-wrapper .color-mode:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(212, 163, 90, 0.3);
}

.color-mode-icon {
  font-size: 24px;
  color: #2c2c2c;
  transition: color 0.3s ease;
}

.color-mode-icon.active {
  color: #d4a35a;
}

.dark-mode .color-mode-wrapper .color-mode {
  background: rgba(30, 30, 30, 0.95);
  border-color: rgba(212, 163, 90, 0.3);
}

.dark-mode .color-mode-icon {
  color: #ffffff;
}

.dark-mode .color-mode-icon.active {
  color: #d4a35a;
}

@media (max-width: 767px) {
  .color-mode-wrapper {
    top: 20px;
    right: 20px;
  }
  
  .color-mode-wrapper .color-mode {
    width: 45px;
    height: 45px;
  }
  
  .color-mode-icon {
    font-size: 20px;
  }
  
  .floating-home-btn {
    bottom: 80px;
  }
}

@media (max-width: 575px) {
  .color-mode-wrapper {
    top: 15px;
    right: 15px;
  }
  
  .color-mode-wrapper .color-mode {
    width: 40px;
    height: 40px;
    padding: 8px;
  }
  
  .color-mode-icon {
    font-size: 18px;
  }
}

/* Floating Home Button */
.floating-home-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #d4a35a 0%, #c49350 100%);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(212, 163, 90, 0.4);
  transition: all 0.3s ease;
  font-size: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.floating-home-btn:hover {
  background: #c49350;
  transform: translateY(-2px) translateX(-2px);
  box-shadow: 0 6px 20px rgba(212, 163, 90, 0.5);
  color: #ffffff;
  text-decoration: none;
}

.floating-home-btn i {
  font-size: 18px;
}

.floating-home-btn span {
  display: inline-block;
}

/* Hide text on smaller screens */
@media (max-width: 480px) {
  .floating-home-btn {
    bottom: 20px;
    right: 20px;
    padding: 12px;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    justify-content: center;
  }
  
  .floating-home-btn span {
    display: none;
  }
  
  .floating-home-btn i {
    margin: 0;
  }
}

/* Book Flip Styles */
.book-container-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
  background: linear-gradient(135deg, #faf8f3 0%, #f5f1e8 50%, #faf8f3 100%);
  position: relative;
  overflow: hidden;
}

.book-container-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(212, 163, 90, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(71, 69, 89, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.book-container-wrapper > * {
  position: relative;
  z-index: 1;
}

.book-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  height: 600px;
  perspective: 2000px;
  margin: 0 auto 40px;
}

.book-page {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #ffffff;
  box-shadow: 0 10px 40px rgba(212, 163, 90, 0.25), 0 0 20px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1),
              opacity 0.5s ease,
              z-index 0.3s ease,
              box-shadow 0.8s ease;
  opacity: 0;
  z-index: 1;
  cursor: pointer;
  transform: rotateY(0deg) translateZ(0);
  border: 1px solid rgba(212, 163, 90, 0.1);
}

.book-page.active {
  opacity: 1;
  z-index: 10;
  transform: rotateY(0deg) translateZ(0) scale(1);
  cursor: pointer;
  box-shadow: 0 15px 50px rgba(212, 163, 90, 0.3), 0 0 30px rgba(0, 0, 0, 0.15);
  border: 2px solid rgba(212, 163, 90, 0.2);
}

.book-page.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: linear-gradient(to bottom, 
    transparent 0%, 
    rgba(212, 163, 90, 0.3) 20%, 
    rgba(212, 163, 90, 0.3) 80%, 
    transparent 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.book-page.active:hover::before {
  opacity: 1;
}

.book-page.prev {
  opacity: 0;
  z-index: 1;
  transform: rotateY(-180deg) translateZ(-200px) scale(0.8);
  pointer-events: none;
}

.book-page.next {
  opacity: 0;
  z-index: 1;
  transform: rotateY(180deg) translateZ(-200px) scale(0.8);
  pointer-events: none;
}

.book-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #f9f9f9;
}

/* Turning animation */
.book-container.turning .book-page.active {
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1),
              opacity 0.5s ease,
              box-shadow 0.8s ease;
}

/* Book Controls */
.book-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(212, 163, 90, 0.15), 0 0 10px rgba(0, 0, 0, 0.05);
  max-width: 600px;
  width: 100%;
  border: 1px solid rgba(212, 163, 90, 0.1);
}

.book-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #d4a35a 0%, #c49350 100%);
  color: #ffffff;
  border: none;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(212, 163, 90, 0.3);
  position: relative;
  overflow: hidden;
}

.book-nav-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.book-nav-btn:hover::before {
  width: 300px;
  height: 300px;
}

.book-nav-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #c49350 0%, #b58547 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(212, 163, 90, 0.4);
}

.book-nav-btn i {
  position: relative;
  z-index: 1;
}

.book-nav-btn span {
  position: relative;
  z-index: 1;
}

.book-nav-btn:active:not(:disabled) {
  transform: translateY(0);
}

.book-nav-btn:disabled {
  background: #cccccc;
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.book-nav-btn i {
  font-size: 18px;
}

.page-navigation-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.page-indicator {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  min-width: 80px;
  text-align: center;
  padding: 8px 16px;
  background: #f5f5f5;
  border-radius: 20px;
}

.page-indicator span {
  color: #d4a35a;
}

.page-jump {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-jump label {
  font-size: 14px;
  color: #666;
  font-weight: normal;
}

.page-jump input {
  width: 60px;
  padding: 6px 10px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  text-align: center;
  transition: border-color 0.3s ease;
}

.page-jump input:focus {
  outline: none;
  border-color: #d4a35a;
}

.page-jump-btn {
  padding: 6px 12px;
  background: #d4a35a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.page-jump-btn:hover {
  background: #c49350;
  transform: translateY(-1px);
}

.zoom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(71, 69, 89, 0.15), 0 0 10px rgba(0, 0, 0, 0.05);
  max-width: 400px;
  width: 100%;
  border: 1px solid rgba(71, 69, 89, 0.1);
}

.zoom-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #474559 0%, #3a3847 100%);
  color: #ffffff;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 12px rgba(71, 69, 89, 0.3);
  position: relative;
  overflow: hidden;
}

.zoom-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.zoom-btn:hover::before {
  width: 200px;
  height: 200px;
}

.zoom-btn i,
.zoom-btn span {
  position: relative;
  z-index: 1;
}

.zoom-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a5770 0%, #4a4857 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 5px 15px rgba(71, 69, 89, 0.4);
}

.zoom-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.zoom-btn i {
  font-size: 16px;
}

.book-page img.page-image {
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  touch-action: pan-x pan-y;
}

.book-page.active img.page-image.zoomed {
  cursor: grab;
  touch-action: none;
}

.book-page.active img.page-image.zoomed:active,
.book-page.active img.page-image.zoomed[style*="grabbing"] {
  cursor: grabbing !important;
}

.book-page.active {
  overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
  .book-container {
    height: 500px;
    max-width: 100%;
  }

  .book-controls {
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
  }

  .book-nav-btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .book-nav-btn span {
    display: none;
  }

  .page-navigation-group {
    width: 100%;
    order: 3;
  }

  .page-indicator {
    font-size: 16px;
    min-width: 60px;
  }

  .page-jump {
    width: 100%;
    justify-content: center;
  }

  .zoom-controls {
    flex-wrap: wrap;
    gap: 10px;
  }

  .zoom-btn span {
    display: none;
  }

  .zoom-btn {
    padding: 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .book-container {
    height: 400px;
  }

  .book-container-wrapper {
    padding: 20px 10px;
  }

  .book-controls {
    gap: 10px;
    padding: 12px;
  }

  .book-nav-btn {
    padding: 8px 16px;
    font-size: 12px;
  }

  .page-jump label {
    display: none;
  }

  .zoom-controls {
    padding: 10px;
  }
}

/* Loading State */
.book-page img {
  transition: opacity 0.3s ease;
}

.book-page img[loading="lazy"] {
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Dark Mode Support */
.dark-mode .book-container-wrapper {
  background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 50%, #1a1a1a 100%);
}

.dark-mode .book-container-wrapper::before {
  background: 
    radial-gradient(circle at 20% 30%, rgba(212, 163, 90, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(71, 69, 89, 0.1) 0%, transparent 50%);
}

.dark-mode .book-page {
  background: #2a2a2a;
  border-color: rgba(212, 163, 90, 0.3);
}

.dark-mode .book-page.active {
  border-color: rgba(212, 163, 90, 0.4);
  box-shadow: 0 15px 50px rgba(212, 163, 90, 0.2), 0 0 30px rgba(0, 0, 0, 0.5);
}

.dark-mode .book-page img {
  background: #1f1f1f;
}

.dark-mode .book-controls,
.dark-mode .zoom-controls {
  background: rgba(30, 30, 30, 0.95);
  border-color: rgba(212, 163, 90, 0.2);
}

.dark-mode .page-indicator {
  background: #3a3a3a;
  color: #ffffff;
}

.dark-mode .page-indicator span {
  color: #d4a35a;
}

.dark-mode .page-jump label {
  color: rgba(255, 255, 255, 0.7);
}

.dark-mode .page-jump input {
  background: #3a3a3a;
  border-color: rgba(212, 163, 90, 0.3);
  color: #ffffff;
}

.dark-mode .page-jump input:focus {
  border-color: #d4a35a;
  background: #404040;
}

.dark-mode .floating-home-btn {
  background: linear-gradient(135deg, #d4a35a 0%, #c49350 100%);
}

/* Portfolio Header */
.portfolio-header {
  text-align: center;
  padding: 60px 20px 40px;
  position: relative;
  z-index: 1;
}

.portfolio-badge {
  display: inline-block;
  padding: 6px 18px;
  background: linear-gradient(135deg, rgba(212, 163, 90, 0.1) 0%, rgba(71, 69, 89, 0.1) 100%);
  border-radius: 30px;
  color: #d4a35a;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 1px;
  margin-bottom: 15px;
  border: 1px solid rgba(212, 163, 90, 0.2);
}

.dark-mode .portfolio-badge {
  background: linear-gradient(135deg, rgba(212, 163, 90, 0.2) 0%, rgba(71, 69, 89, 0.2) 100%);
  border-color: rgba(212, 163, 90, 0.3);
}

.portfolio-header h1 {
  font-family: "Playfair Display", serif;
  font-size: 3em;
  font-weight: 700;
  color: #2c2c2c;
  margin: 20px 0;
  background: linear-gradient(135deg, #d4a35a 0%, #c49350 50%, #474559 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.portfolio-header p {
  font-size: 1.2em;
  color: #666;
  max-width: 600px;
  margin: 20px auto 0;
  line-height: 1.6;
}

.dark-mode .portfolio-header h1 {
  background: linear-gradient(135deg, #d4a35a 0%, #c49350 50%, #ffffff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dark-mode .portfolio-header p {
  color: rgba(255, 255, 255, 0.7);
}

/* Enhanced Responsive Design */
@media (max-width: 991px) {
  .portfolio-header h1 {
    font-size: 2.5em;
  }
  
  .portfolio-header p {
    font-size: 1.1em;
  }
}

@media (max-width: 767px) {
  .portfolio-header {
    padding: 40px 15px 30px;
  }
  
  .portfolio-header h1 {
    font-size: 2em;
  }
  
  .portfolio-header p {
    font-size: 1em;
  }
  
  .book-container-wrapper {
    padding: 20px 15px;
  }
  
  .floating-home-btn {
    bottom: 80px;
  }
}

@media (max-width: 575px) {
  .portfolio-header {
    padding: 30px 10px 20px;
  }
  
  .portfolio-header h1 {
    font-size: 1.75em;
  }
  
  .portfolio-header p {
    font-size: 0.95em;
  }
}

@media (max-width: 360px) {
  .portfolio-header h1 {
    font-size: 1.5em;
  }
  
  .portfolio-header p {
    font-size: 0.9em;
  }
}

/* Portfolio Footer */
.portfolio-footer {
  background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
  color: #ffffff;
  padding: 30px 20px;
  text-align: center;
  border-top: 2px solid rgba(212, 163, 90, 0.2);
}

.portfolio-footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.portfolio-copyright {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.portfolio-designer {
  margin: 10px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

.portfolio-designer a {
  color: #d4a35a;
  text-decoration: none;
  transition: color 0.3s ease;
}

.portfolio-designer a:hover {
  color: #c49350;
  text-decoration: underline;
}

.dark-mode .portfolio-footer {
  background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
  border-top-color: rgba(212, 163, 90, 0.3);
}

