/* ==========================================================================
   components.css — Reusable UI components: navbar, footer, cards, buttons
   Depends on: main.css (CSS custom properties must be loaded first)
   ========================================================================== */

/* === NAVBAR === */

.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--color-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-2) var(--spacing-4);
  min-height: 56px;
  transition: padding 0.3s ease;
}

/* Logo — ukuran layout tetap kecil, gambar di-scale agar navbar tidak ikut membesar */
.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  line-height: 0;
  width: 76px;
  height: 36px;
  overflow: visible;
  margin-right: var(--spacing-2);
}

.nav-logo img {
  height: 36px;
  width: auto;
  object-fit: contain;
  display: block;
  transform: scale(2);
  transform-origin: left center;
}

.nav-logo:hover img {
  opacity: 0.85;
}

/* Desktop nav links */
.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--spacing-2);
  margin: 0;
  padding: 0;
  align-items: center;
}

.nav-link {
  display: block;
  padding: var(--spacing-2) var(--spacing-3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-dark);
  text-decoration: none;
  border-radius: 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
  color: var(--color-primary-dark);
  background-color: rgba(0, 0, 0, 0.04);
  border-bottom-color: var(--color-primary);
}

/* Active page link */
.nav-link.active {
  color: var(--color-primary-dark);
  border-bottom-color: var(--color-primary-dark);
  font-weight: 600;
}

/* Hamburger toggle button — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-2);
  border-radius: 4px;
  color: var(--color-primary-dark);
}

.nav-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Hamburger icon — three stacked lines built from a single span + pseudo-elements */
.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--color-primary-dark);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger {
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
}

.hamburger::before {
  top: -7px;
}

.hamburger::after {
  top: 7px;
}

/* Animate hamburger → ✕ when menu is open */
.nav-toggle[aria-expanded="true"] .hamburger {
  background-color: transparent;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
  transform: translateY(-7px) rotate(-45deg);
}

/* -----------------------------------------------------------------------
   Mobile layout — hamburger visible, menu collapses
   ----------------------------------------------------------------------- */
@media (max-width: 767px) {
  .nav-toggle {
    display: flex;
  }

  .nav-logo {
    width: 62px;
  }

  .nav-logo img {
    transform: scale(1.6);
  }

  .nav-menu {
    /* Hidden by default on mobile */
    display: flex;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: var(--spacing-2) 0;

    /* Collapse via max-height for smooth animation */
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, visibility 0.3s ease;
  }

  /* Open state — toggled by JS adding .open class */
  .nav-menu.open {
    max-height: 400px;
    padding: var(--spacing-2) 0;
    visibility: visible;
  }

  .nav-link {
    padding: var(--spacing-3) var(--spacing-6);
    border-radius: 0;
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: var(--text-base);
  }

  .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.04);
    border-left-color: var(--color-primary);
    border-bottom-color: transparent;
  }

  .nav-link.active {
    border-left-color: var(--color-primary);
    border-bottom-color: transparent;
    background-color: rgba(45, 106, 79, 0.08);
  }
}

/* -----------------------------------------------------------------------
   Desktop layout — hamburger hidden, menu shown as horizontal row
   ----------------------------------------------------------------------- */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  .nav-menu {
    /* Ensure menu is always visible on desktop regardless of JS state */
    display: flex;
    flex-direction: row;
    position: static;
    max-height: none;
    overflow: visible;
    visibility: visible;
    box-shadow: none;
    padding: 0;
    background-color: transparent;
  }

  .nav-container {
    padding: var(--spacing-4) var(--spacing-8);
  }
}

/* === END NAVBAR === */

/* === FOOTER === */

/* --------------------------------------------------------------------------
   Site footer — dark background, three-column layout
   Requirements: 1.4, 10.2
   -------------------------------------------------------------------------- */

.site-footer {
  background-color: var(--color-primary-dark);
  color: var(--color-gray-100);
  padding-top: var(--spacing-12);
}

/* Three-column flex layout → stacks on mobile */
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-8) var(--spacing-10);
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-8);
}

.footer-section {
  flex: 1 1 200px;
  min-width: 0;
}

.footer-section h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-white);
  margin-bottom: var(--spacing-4);
}

.footer-section p {
  font-size: var(--text-sm);
  color: var(--color-gray-400);
  line-height: 1.7;
}

/* Footer quick-links list */
.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
  padding: 0;
  margin: 0;
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--color-gray-400);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-primary-light);
}

/* Social media icon row */
.social-icons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-3);
  margin-top: var(--spacing-2);
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;   /* 40px */
  height: 2.5rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.social-icons a:hover {
  background-color: var(--color-primary-light);
  transform: translateY(-2px);
}

.social-icons img {
  width: 1.25rem;   /* 20px */
  height: 1.25rem;
  object-fit: contain;
}

/* Copyright bar */
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: var(--spacing-4) var(--spacing-8);
  text-align: center;
}

.footer-bottom p {
  font-size: var(--text-sm);
  color: var(--color-gray-400);
}

/* Responsive: stack columns on narrow screens */
@media (max-width: 767px) {
  .footer-container {
    flex-direction: column;
    padding: 0 var(--spacing-4) var(--spacing-8);
  }

  .footer-section {
    flex: none;
    width: 100%;
  }

  .footer-bottom {
    padding: var(--spacing-4);
  }
}

/* === END FOOTER === */


/* === BUTTONS === */

/* --------------------------------------------------------------------------
   Base button + variants
   Requirements: 2.7
   -------------------------------------------------------------------------- */

/**
 * .btn — base: shared shape, spacing, font, transitions.
 * All variants add a modifier class alongside .btn.
 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  padding: var(--spacing-3) var(--spacing-6);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: 0.375rem;   /* 6px */
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease,
              transform       0.15s ease,
              box-shadow      0.2s ease;
  white-space: nowrap;
  -webkit-user-select: none;
          user-select: none;
}

.btn:focus-visible {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
}

.btn:active {
  transform: translateY(1px);
}

/* Primary button — forest green */
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.35);
}

/* Success button — bright green */
.btn-success {
  background-color: var(--color-whatsapp);
  color: var(--color-white);
}

.btn-success:hover {
  background-color: var(--color-whatsapp-dark);
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

/* WhatsApp button — brand green #25D366 */
.btn-whatsapp {
  background-color: var(--color-whatsapp);      /* #25D366 */
  color: var(--color-white);
}

.btn-whatsapp:hover {
  background-color: var(--color-whatsapp-dark); /* #128C7E */
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

/* Keep inline icon from distorting */
.btn-whatsapp img,
.btn img {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
  flex-shrink: 0;
}

/* === END BUTTONS === */


/* === DESTINATION / CATEGORY TAGS (shared) === */

.dest-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
}

.dest-tag-alam       { background-color: #D1FAE5; color: var(--color-primary-dark); }
.dest-tag-air        { background-color: #DBEAFE; color: #1E40AF; }
.dest-tag-petualang  { background-color: #FEE2E2; color: #991B1B; }
.dest-tag-panorama   { background-color: #EDE9FE; color: #5B21B6; }
.dest-tag-foto       { background-color: #FFEDD5; color: #9A3412; }
.dest-tag-sunset     { background-color: #FFF7ED; color: #92400E; }
.dest-tag-budaya     { background-color: #FEF3C7; color: #92400E; }
.dest-tag-default    { background-color: #F3F4F6; color: #4B5563; }

/* === CARDS === */

/* --------------------------------------------------------------------------
   Shared card base + per-type variants
   Requirements: 2.7
   -------------------------------------------------------------------------- */

/* --- Shared card shell --- */
.destination-card,
.package-card,
.product-card,
.news-card {
  background-color: var(--color-white);
  border-radius: 1rem;
  border: 1px solid rgba(26, 92, 42, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
}

.destination-card:hover,
.package-card:hover,
.product-card:hover,
.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* --- Card images (destination / product / news) --- */
.destination-card > img,
.product-card > img,
.news-card > img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

/* --- Generic content area --- */
.card-content {
  padding: var(--spacing-6);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--spacing-4);
  min-height: 0;
}

.card-content h2 {
  font-size: var(--text-xl);
  color: var(--color-dark);
  margin: 0;
}

.card-content h3 {
  font-size: var(--text-base);
  color: var(--color-gray-600);
  font-weight: 600;
  margin: 0;
}

/* Short text paragraph inside card */
.card-description {
  font-size: var(--text-sm);
  color: var(--color-gray-600);
  line-height: 1.65;
  flex: 1;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Push a .btn that is a direct child of .card-content to the bottom */
.card-content > .btn {
  margin-top: auto;
}

/* --- Embedded Google Maps iframe --- */
.card-map {
  border-radius: 0.5rem;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.card-map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* --- Card Tags and Detail Link --- */
.card-tag {
  position: absolute;
  top: var(--spacing-4);
  left: var(--spacing-4);
  background-color: var(--color-primary-light);
  color: var(--color-white);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.card-tag.tag-air {
  background-color: var(--color-secondary-light);
}

.card-detail-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: auto; /* Pushes it to the bottom if inside a flex col */
  padding-top: var(--spacing-4);
  transition: color 0.2s ease;
}

.card-detail-link:hover {
  color: var(--color-primary-dark);
}

/* ---- Package card (legacy layout in components; paket page overrides in paket.css) ---- */

.card-header {
  padding: var(--spacing-6) var(--spacing-6) 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.card-header h2 {
  font-size: var(--text-xl);
  color: var(--color-dark);
}

.package-price {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary);
}

/* Itinerary list inside package card */
.itinerary-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
  padding: 0;
  margin: 0;
}

.itinerary-list li {
  font-size: var(--text-sm);
  color: var(--color-gray-600);
  padding-left: var(--spacing-4);
  position: relative;
  line-height: 1.6;
}

.itinerary-list li::before {
  content: "●";
  position: absolute;
  left: 0;
  color: var(--color-primary-light);
  font-size: 0.5rem;
  top: 0.35em;
}

/* Action button sits outside .card-content in the package card */
.package-card > .btn {
  margin: 0 var(--spacing-6) var(--spacing-6);
}

/* ---- Product card ---- */

.product-price {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-accent);
}

/* ---- News card ---- */

.news-card > img {
  height: 180px;
}

.card-date {
  font-size: var(--text-xs);
  color: var(--color-gray-400);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.card-summary {
  font-size: var(--text-sm);
  color: var(--color-gray-600);
  line-height: 1.65;
}

/* --- Responsive adjustments --- */
@media (max-width: 767px) {
  .destination-card > img,
  .product-card > img {
    height: 180px;
  }

  .news-card > img {
    height: 150px;
  }

  .card-content {
    padding: var(--spacing-4);
  }

  .card-header {
    padding: var(--spacing-4) var(--spacing-4) 0;
  }

  .package-card > .btn {
    margin: 0 var(--spacing-4) var(--spacing-4);
  }
}

/* === END CARDS === */


/* === WAVE DIVIDER === */

/* --------------------------------------------------------------------------
   .wave-divider — organic section separator using inline SVG
   Requirements: 1.4

   Usage:
     <div class="wave-divider">
       <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 120"
            preserveAspectRatio="none">
         <path fill="#F8F9F4"
               d="M0,64 C480,120 960,0 1440,64 L1440,120 L0,120 Z" />
       </svg>
     </div>
   -------------------------------------------------------------------------- */

.wave-divider {
  width: 100%;
  overflow: hidden;
  line-height: 0;
  margin: 0;
  padding: 0;
}

.wave-divider svg {
  display: block;
  width: 100%;
  height: 80px;   /* desktop */
}

@media (max-width: 768px) {
  .wave-divider svg {
    height: 40px;   /* mobile — half height */
  }
}

/* === END WAVE DIVIDER === */
