/* ============================================
   Components - Reusable UI Elements
   ============================================ */

/* --- Buttons & Controls --- */

/* Carousel navigation buttons */
.carousel-nav,
.photo-carousel-nav {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.carousel-nav button,
.photo-carousel-nav button {
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  margin: 0 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

/* Carousel dots */
.carousel-dots,
.photo-carousel-dots {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.dot,
.photo-dot {
  height: 12px;
  width: 12px;
  margin: 0 5px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dot:hover,
.photo-dot:hover {
  background-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.2);
}

.dot.active,
.photo-dot.active {
  background-color: white;
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

/* Photo carousel dots */
.photo-carousel-dots .photo-dot {
  height: 10px;
  width: 10px;
  margin: 0 4px;
}

.photo-carousel-dots .photo-dot.active {
  height: 12px;
  width: 12px;
}

/* Pagination controls */
.pagination {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

.pagination button {
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.7);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.9rem;
}

/* --- Cards --- */

.card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.3s ease;
  color: #fff;
  backdrop-filter: blur(10px);
}

.card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* --- Tables --- */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

thead {
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

td {
  padding: 0.5rem 0.75rem;
  color: #fff;
  opacity: 0.95;
  white-space: normal;
  word-break: break-word;
}

/* --- Forms --- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

input,
textarea {
  padding: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: white;
  border-radius: 4px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #008791;
  background: rgba(255, 255, 255, 0.06);
}

/* --- Expandable Content --- */

.expandable-text {
  position: relative;
  color: #f0f0f0;
  line-height: 1.6;
}

.expandable-text.collapsed {
  max-height: 3em;
  overflow: hidden;
}

.expandable-text.collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.2em;
  background: linear-gradient(to bottom, transparent 70%, rgba(0, 0, 0, 0.85) 100%);
}

.expand-toggle {
  background: rgba(0, 135, 145, 0.15);
  border: 1px solid #008791;
  color: #008791;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.expand-toggle:hover {
  background: rgba(0, 135, 145, 0.25);
  transform: translateY(-1px);
}

/* --- Field Labels --- */

.field-label {
  font-weight: 600;
  color: #008791;
  margin-right: 0.25rem;
}

/* --- Scroll Behavior --- */

.smooth-scroll {
  scroll-behavior: smooth;
}

.scrollable {
  overflow-y: auto;
}

/* Scroll Progress Bar at Top */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.scroll-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #008791, #00b4d8);
  transition: width 0.1s ease-out;
}

/* Section Navigation Sidebar */
.section-nav-sidebar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 998;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.nav-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 135, 145, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

.nav-dot::after {
  content: attr(data-title);
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 135, 145, 0.95);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
  pointer-events: none;
}

.nav-dot:hover::after {
  opacity: 1;
  visibility: visible;
}

.nav-dot:hover,
.nav-dot.active {
  background: #00b4d8;
  transform: scale(1.3);
}

.nav-dot.active::after {
  content: attr(data-title) ' ✓';
}

@media (max-width: 768px) {
  .section-nav-sidebar {
    right: 10px;
    gap: 10px;
  }
  
  .nav-dot::after {
    display: none;
  }

}

/* ============================================
   Responsive Component Adjustments
   ============================================ */

@media (max-width: 768px) {
  .card {
    padding: 0.75rem;
  }

  table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.4rem;
  }

  .carousel-nav,
  .photo-carousel-nav {
    bottom: 10px;
  }

  .pagination button {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
}

/* Scroll Indicator Button - stacked text layout */
@keyframes pulseButton {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 10px rgba(0, 135, 145, 0.3);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 135, 145, 0.6), 0 0 15px rgba(0, 135, 145, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 2px 10px rgba(0, 135, 145, 0.3);
  }
}

.scroll-indicator-btn,
.back-to-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: auto;
  height: auto;
  padding: 10px 15px;
  background: rgba(0, 135, 145, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 999;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.scroll-indicator-btn.visible,
.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  animation: pulseButton 1.5s ease-in-out infinite;
}

/* Stack text into two lines */
.btn-line-1,
.btn-line-2 {
  line-height: 1.2;
  white-space: nowrap;
}

/* Scroll Progress Bar */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.2);
  z-index: 9999;
}

.scroll-progress-fill {
  height: 100%;
  background: #e74c3c;
  width: 0%;
  transition: width 0.1s ease;
}

/* Section Navigation Sidebar */
.section-nav-sidebar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 9999;
}

.nav-dot {
  width: 12px;
  height: 12px;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: block;
  transition: all 0.3s ease;
}

.nav-dot:hover {
  background-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.3);
}

.nav-dot.active {
  background-color: #0b7a83;
  transform: scale(1.4);
}

/* Scroll Down Indicator - Large centered text */
.scroll-down-indicator {
  pointer-events: none;
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;

  opacity: 0;
  animation: scrollIndicatorIn 1s ease-in forwards;
}

.scroll-down-indicator.is-hiding {
  animation: scrollIndicatorOut 0.6s ease-out forwards;
}

.scroll-down-text {
  font-size: 1.5rem;
  color: #0b7a83;
  animation: floatText 3s ease-in-out infinite;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 10px rgba(11, 122, 131, 0.4);
  text-wrap: nowrap;
}

@keyframes floatText {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.arrow-scroll {
  position: relative;
  height: 4em;
}

.arrow {
  border: solid #0b7a83;
  border-width: 0 4px 4px 0;
  display: inline-block;
  padding: 12px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  filter:
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 6px rgba(11, 122, 131, 0.4));
}

.arrow:nth-child(2) {
  animation:
    arrow1 1.5s
    ease-in-out infinite;
}

.arrow:nth-child(3) {
  animation:
    arrow2 1.5s
    ease-in-out infinite;
}

@keyframes arrow1 {
  100% {
    opacity: 0;
    top: 100%;
  }
}

@keyframes arrow2 {
  100% {
    opacity: 0;
    top: 50%;
  }
}

/* Parent fade in */
@keyframes scrollIndicatorIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Parent fade out */
@keyframes scrollIndicatorOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

@media (max-width: 768px) {
  .scroll-down-text {
    font-size: 1.5rem;
  }

  .scroll-down-icon-wrapper {
    width: 30px;
    height: 35px;
  }

}
