/* Color Palette */
:root {
  /* Biru Tua */
  --primary-color: #191c3e;
  /* Kuning */
  --secondary-color: #FFD600;
  /* Warna - warna lain */
  --text-color-light: #F5F5F5;
  --text-color-dark: #212121;
  --bg-light: navy;
  --danger-color: #D32F2F;
}

/* Animasi Background */
#tsparticles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  background-color: var(--primary-color);
}

/* Basic Reset dan Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Font dari Google Fonts: Parkinsans */
body {
  font-family: 'Parkinsans', Verdana, Geneva, Tahoma, sans-serif;
  background-color: var(--primary-color);
  color: var(--text-color-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
}

/* Container Utama */
main {
  flex: 1;
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 20px;
}

h1,
h2,
h3 {
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

/* Page Transition */
.main-content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.page-transition-out {
  opacity: 0;
  transform: translateY(20px);
}

.page-fade-out {
  opacity: 0;
}

.page-fade-in {
  opacity: 1;
}

/* Pengecualian animasi untuk elemen nav dan footer */
header.app-bar {
  view-transition-name: main-header;
}

footer.foot {
  view-transition-name: main-footer;
}

::view-transition-group(main-header) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-group(main-footer) {
  animation: none;
  mix-blend-mode: normal;
}

/* View Transition API : Ini akan menimpa animasi fade-out/fade-in default.*/
@keyframes slide-from-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slide-to-down {
  from {
    transform: translateY(0);
    opacity: 1;
  }

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

/* Animasi untuk halaman LAMA (old) yang keluar */
::view-transition-old(root) {
  animation: slide-to-down 0.3s ease-out forwards;
}

/* Animasi untuk halaman BARU (new) yang masuk */
::view-transition-new(root) {
  animation: slide-from-up 0.3s ease-in backwards;
}

/* Aksesibilitas */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background-color: var(--secondary-color);
  color: var(--text-color-dark);
  padding: 8px;
  z-index: 9999;
  text-decoration: none;
  font-weight: bold;
}

.skip-link:focus {
  top: 0;
}

/* Komponen-komponen fitur (App Bar, Tombol, Form, Peta) */
/* APP BAR GLOBAL (Desktop) */
.app-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-light);
  padding: 1rem 2rem;
  box-shadow: 0 6px 8px var(--text-color-dark);
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  ;
}

app-bar {
  box-shadow: 0 4px 6px var(--secondary-color);
  border-radius: 16px;
}

app-bar>.app-bar {
  border-radius: 16px;
}

/* Container untuk Logo & Hamburger */
.app-bar__brand {
  display: flex;
  align-items: center;
}

/* Tombol Hamburger */
.header__menu {
  display: none;
  font-size: 2rem;
  background: transparent;
  border: none;
  color: var(--secondary-color);
  cursor: pointer;
  margin-left: 1rem;
}

/* Navigasi (List Menu) */
.app-bar__nav ul {
  display: flex;
  list-style: none;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.app-bar__nav a {
  text-decoration: none;
  color: var(--secondary-color);
  font-weight: 600;
  padding: 8px 12px;
}

.app-bar__nav a:hover {
  color: var(--bg-light);
  background-color: var(--secondary-color);
  border-radius: 12px;
}

/* Tombol Utama (Biru Tua) */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  border: var(--secondary-color) solid 1px;
}

.btn-primary:hover {
  background-color: var(--secondary-color);
  transition: ease-in-out 0.3;
  color: var(--text-color-dark);
  border: var(--primary-color) solid 1px;
}

.btn-danger {
  background-color: var(--danger-color);
  color: var(--text-color-light);
}

.favorite-btn {
  background-color: #f0ad4e;
  color: var(--primary-color);
  margin-top: 10px;
}

.favorite-btn:hover {
  background-color: #D32F2F;
  color: var(--secondary-color);
  transition: ease-in-out 0.3;
  border: var(--secondary-color) solid 1px;
}

/* Form */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.form-control {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  color: var(--text-color-dark);
  border-color: orangered;
}

.form-control:focus {
  outline: 2px solid var(--secondary-color);
  border-color: var(--primary-color);
}

.form-error {
  color: var(--danger-color);
  margin-top: 5px;
  font-size: 0.9rem;
}

a {
  text-decoration: none;
}

/* Peta */
#map,
#add-map {
  height: 400px;
  width: 100%;
  border-radius: 8px;
  margin-top: 1rem;
  z-index: 1;
  box-shadow: var(--text-color-light) 0px 4px 12px;
}

/* Halaman Spesifik */

/* Halaman Home */
.home-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* Story List */
.story-list-container {
  max-height: 600px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.story-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.story-list-container>h2 {
  position: sticky;
}

.story-item {
  background-color: var(--bg-light);
  color: var(--secondary-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px orangered;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--secondary-color);
}

.story-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px yellow;
}

.story-item__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.story-item__content {
  padding: 15px;
}

.story-item__author {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 5px;
}

.story-item__date {
  font-size: 0.8rem;
  color: var(--text-color-light);
  margin-bottom: 10px;
}

.story-item__description {
  font-size: 1rem;
  line-height: 1.4;
}

/* Favorites Page */
.favorites-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.favorites-header>h1 {
  padding-top: 15px;
}

.favorites-header>i {
  align-items: center;
  font-size: 1.8rem;
  color: var(--secondary-color);
}

/* About Page */
.about-container ul {
  padding-left: 20px;
}

/* Halaman Login/Register */
.auth-container {
  max-width: 450px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: var(--bg-light);
  color: var(--secondary-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px orangered
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--secondary-color);
}

.auth-container .redirect-link {
  text-align: center;
  margin-top: 1.5rem;
}

.auth-container .redirect-link a {
  color: var(--primary-color);
  font-weight: 600;
}

/* Halaman Add Story */
.add-story-container {
  max-width: 768px;
  margin: 1rem auto;
  padding: 2rem;
  background-color: var(--bg-light);
  color: var(--secondary-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px orangered;
}

.add-story-container>h1 {
  color: var(--secondary-color);
  text-align: center;
}

.location-picker-info {
  font-style: italic;
  color: var(--text-color-light);
  margin-bottom: 1rem;
  text-align: center;
}

input[type="file"] {
  color: var(--text-color-light);
}

#preview-image {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  margin-top: 1rem;
  border: 1px dashed #ccc;
  border-radius: 4px;
  display: none;
}

/* Footer */
.main-footer {
  background-color: var(--primary-color, #0f172a);
  padding: 60px 0 0 0;
  color: var(--text-color-light);
  font-family: 'Parkinsans', sans-serif;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  width: 100vw !important;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 40px;
  width: 100%;
  max-width: 1200px;
  padding: 0 40px;
  box-sizing: border-box;
  margin: 0 auto;
  text-align: left !important;
}

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

.about-col {
  flex: 1.5;
  padding-right: 30px;
}

.footer-logo,
.footer-section h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--secondary-color);
  margin-bottom: 1.5rem;
}

.footer-section p {
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.677);
}

.links-col ul {
  list-style: none !important;
  padding: 0;
  margin: 0;
}

.links-col li {
  margin-bottom: 15px;
}

.footer-section a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.677);
  transition: color 0.3s ease;
}

.footer-section a:hover {
  color: var(--secondary-color, #ffd700);
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  color: var(--text-color-light);
}

.contact-row i {
  font-size: 1.3rem;
  color: var(--text-color-light);
}

.footer-socials {
  display: flex;
  gap: 20px;
  margin-top: 25px;
}

.footer-socials a i {
  color: var(--text-color-light);
  font-size: 1.6rem;
  transition: color 0.3s ease, transform 0.3s ease;
}

.footer-socials a:hover i {
  color: var(--secondary-color, #ffd700);
  transform: translateY(-3px);
}

.main-footer>p {
  text-align: center;
  margin-top: 50px;
  padding-top: 20px;
  color: #94a3b8;
  font-size: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
  .footer-container {
    flex-direction: column;
    gap: 30px;
  }

  .about-col {
    padding-right: 0;
  }
}

/* Media Queries (Responsif) */

/* MOBILE RESPONSIVE (HP) */
@media (max-width: 480px) {

  .app-bar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 15px 20px !important;
    height: 70px;
    position: relative;
    background-color: var(--bg-light);
    z-index: 1000;
    gap: 5px;
  }

  app-bar {
    box-shadow: none;
  }

  .app-bar__brand {
    display: flex;
    align-items: center;
  }

  .header__menu {
    display: block !important;
    background: transparent;
    border: none;
    font-size: 30px !important;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0;
    margin: 0;
    z-index: 20000;
    padding-left: 200px;
  }

  .app-bar__nav.user-logged-in {
    position: fixed !important;
    top: 0;
    right: 0;
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background-color: var(--bg-light);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    padding-top: 80px;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 15000;
    display: block !important;
  }

  /* Saat Open */
  .app-bar__nav.user-logged-in.open {
    transform: translateX(0);
  }

  /* Styling List Menu */
  .app-bar__nav.user-logged-in ul {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    width: 100%;
  }

  .app-bar__nav.user-logged-in li a {
    display: block;
    padding: 15px 25px;
    color: var(--secondary-color);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1rem;
    text-decoration: none;
  }

  .app-bar__nav.user-logged-in li a:hover {
    color: var(--bg-light);
    background-color: var(--secondary-color);
    border-radius: 12px;
  }

  /* Menu Normal (Login/About) - Jika belum login */
  .app-bar__nav:not(.user-logged-in) {
    display: block !important;
  }

  .app-bar__nav:not(.user-logged-in) ul {
    display: flex;
    gap: 20px;
    padding-left: 5px;
  }
}

/* Tablet (768px) */
@media (min-width: 768px) {
  .home-container {
    grid-template-columns: 1fr 1fr;
  }

  .story-list-container {
    max-height: 600px;
    overflow-y: auto;
    scroll-behavior: smooth;
  }

  .story-list {
    grid-template-columns: 1fr;
  }

  .map-container {
    position: sticky;
    top: 20px;
  }
}

/* Desktop (1024px) */
@media (min-width: 1024px) {
  .story-list {
    grid-template-columns: 1fr;
  }

  .auth-container {
    margin: 4rem auto;
  }
}

/* Loading Spinner pada Tombol */
.btn.loading {
  color: transparent;
  position: relative;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;

  /* Ukuran spinner */
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;

  /* Gaya spinner */
  border: 3px solid var(--secondary-color);
  /* Warna track spinner (kuning) */
  border-top-color: var(--text-color-dark);
  /* Warna spinner utama (hitam) */
  border-radius: 50%;
  /* Ketebalan border */

  /* Animasi putar */
  animation: spin-button 0.8s linear infinite;
}

/* Animasi keyframe untuk putaran */
@keyframes spin-button {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Styling Notifikasi (Toast) */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.toast {
  min-width: 300px;
  padding: 16px 20px;
  background: var(--primary-color);
  color: var(--secondary-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 15px;
  border-left: 6px solid var(--secondary-color);
  animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
  position: relative;
  overflow: hidden;
}

.toast-icon {
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  color: var(--primary-color);
  background: var(--secondary-color);
}

.toast-message {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: 'Parkinsans', Verdana, Geneva, Tahoma, sans-serif;
}

.toast-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #999;
  transition: 0.2s;
}

.toast-close:hover {
  color: var(--primary-color);
}

.toast.hiding {
  animation: slideOutRight 0.4s forwards;
}

/* Animasi Toast */
@keyframes slideInRight {
  from {
    transform: translateX(120%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* Halaman Landing */
.landing-container {
  width: 100%;
}

.logo {
  margin-bottom: 15px;
}

.hero-section {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 20px;
  background-size: contain;
  min-height: 80vh;
  color: var(--text-color-light);
}

.hero-content h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-content p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
}

.description-section,
.features-section,
.cta-section {
  padding: 80px 20px;
  text-align: center;
}

.description-content,
.cta-content {
  width: 100%;
  margin: 0 auto;
  max-width: 600px
}

.description-section {
  background-color: var(--bg-light);
  backdrop-filter: blur(100px);
  border-radius: 16px;
  box-shadow: 0;
}

.features-section {
  margin-bottom: 0;
  padding-bottom: 20px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  max-width: 1200px;
  margin: 40px auto 0;
}

.feature-card {
  background: var(--primary-color);
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 8px 25px rgba(255, 214, 0, 0.3);
}

.feature-card i {
  font-size: 3rem;
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

.cta-buttons {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.cta-buttons .btn {
  margin: 0 10px;
  padding: 12px 12px;
}

.cta-buttons .btn:hover {
  color: var(--text-color-dark);
  background-color: var(--secondary-color);
}

.btn-secondary {
  color: var(--secondary-color);
}

.btn-third {
  color: var(--text-color-light);
  border: 1px solid var(--text-color-light);
}

.cta-buttons>.btn-third:hover {
  background-color: var(--text-color-light);
  color: var(--primary-color);
}

/* Animasi Fade In Up */
.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2.5rem;
  }
}