/* ====================== */
/* BASE STYLES            */
/* ====================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-light);
  color: var(--text-primary);
}

.container {
  padding-inline: 32px;
  margin-inline: auto;
  max-width: 1300px;
}

/* ====================== */
/* VARIABLES              */
/* ====================== */
:root {
  --black: #000000;
  --dark-gray: #222222;
  --teal: #1dcd9f;
  --dark-teal: #169976;
  --font-primary: "Poppins", sans-serif;

  /* New Complementary Colors */
  --bg-light: #f8f9fa;
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
}

/* ====================== */
/* BASE STYLES            */
/* ====================== */
body {
  font-family: var(--font-primary);
  background-color: #f8f9fa;
  color: var(--dark-gray);
}

/* ====================== */
/* BUTTONS & INTERAKSI    */
/* ====================== */
.camera-button,
.upload-button {
  background: linear-gradient(
    135deg,
    var(--teal) 0%,
    var(--dark-teal) 100%
  ) !important;
  color: var(--black) !important;
  border: 2px solid var(--teal) !important;
}

.capture-button {
  background: var(--dark-teal) !important;
  color: white !important;
  border: 2px solid var(--teal) !important;
}

.camera-button:hover,
.upload-button:hover {
  background: var(--black) !important;
  color: var(--teal) !important;
}

.capture-button:hover {
  background: var(--teal) !important;
  color: var(--black) !important;
}

.submit-button {
  background: linear-gradient(135deg, var(--teal) 0%, var(--dark-teal) 100%);
  color: var(--black);
  border: 2px solid var(--teal);
  transition: all 0.3s ease;
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

.submit-button:hover {
  background: var(--black);
  color: var(--teal);
  box-shadow: 0 4px 12px rgba(29, 205, 159, 0.25);
}

/* ====================== */
/* FEATHER ICONS          */
/* ====================== */
.feather {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 8px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.logout-button .feather {
  stroke: #dc3545;
}

.submit-button .feather,
.camera-button .feather,
.upload-button .feather {
  margin-right: 10px;
}

/* ====================== */
/* HEADER                 */
/* ====================== */
header {
  background: var(--teal);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0 2rem;
}

.main-header {
  min-height: 90px;
  padding-block: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  view-transition-name: main-header;
}

.brand-name {
  font-size: 1.8rem;
  font-weight: 700;
  text-decoration: none;
  color: white;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-name:hover {
  transform: translateY(-2px);
}

/* Navigation Drawer */
.navigation-drawer {
  min-height: 100vh;
  background: var(--dark-teal);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
  position: fixed;
  top: 0;
  left: 0;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 9999;
  width: 300px;
  padding: 24px;
}

.navigation-drawer.open {
  transform: translateX(0);
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-list li a {
  padding: 12px 16px;
  display: block;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.3s;
}

.nav-list li a:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--teal);
}

.drawer-button {
  padding: 8px;
  border: 0;
  background: none;
  font-size: 28px;
  cursor: pointer;
  transition: transform 0.3s;
  color: white;
}

.drawer-button:hover {
  transform: scale(1.1);
}

/* ====================== */
/* SKIP LINK              */
/* ====================== */
.skip-link {
  position: absolute;
  top: -50px;
  left: 0;
  padding: 12px 16px;
  background: #007bff;
  color: white;
  border-radius: 4px;
  text-decoration: none;
  z-index: 99999;
  opacity: 0;
  transition: top 0.3s, opacity 0.3s;
}

.skip-link:focus {
  top: 10px;
  opacity: 1;
}

/* ====================== */
/* MAIN CONTENT           */
/* ====================== */
.main-content {
  padding-block: 40px;
  min-height: calc(100vh - 90px);
}

/* ====================== */
/* AUTH PAGES             */
/* ====================== */
.auth-container {
  max-width: 400px;
  margin: 2rem auto;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--teal);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  view-transition-name: auth-container;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--dark-gray);
  transition: border-color 0.3s ease;
  border-radius: 8px;
  font-size: 1rem;
}

.form-group input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(29, 205, 159, 0.25);
}

.auth-link {
  text-align: center;
  margin-top: 1.5rem;
  color: #666;
}

.auth-link a {
  color: #007bff;
  text-decoration: none;
}

/* ====================== */
/* STORY LIST             */
/* ====================== */
.story-list {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  view-transition-name: story-list;
}

.story-item {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #eee;
  margin-bottom: 16px;
}

.story-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.story-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.story-title {
  font-size: 1.5rem;
  color: #1a1a1a;
  margin: 0;
  font-weight: 700;
  position: relative;
  padding-bottom: 0.5rem;
}

.story-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background: var(--teal);
  border-radius: 2px;
}

.story-description {
  color: #444;
  line-height: 1.7;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.story-date {
  color: #666;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.story-image-container {
  margin: 1.5rem 0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.story-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.story-image:hover {
  transform: scale(1.03);
}

.story-map-container {
  margin-top: 2rem;
  position: relative;
  overflow: visible !important;
}

.location-info {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #007bff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.story-map {
  width: 100%;
  height: 250px;
  min-height: 200px;
  border-radius: 8px;
  margin-bottom: 8px;
  z-index: 1;
}

/* Improved Loading Animation */
.loading {
  text-align: center;
  padding: 2rem;
  display: none;
  font-size: 1.2rem;
  color: #666;
}

.loading::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid #ddd;
  border-radius: 50%;
  border-top-color: #007bff;
  animation: spin 0.6s linear infinite;
  margin-left: 0.5em;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ====================== */
/* ADD STORY PAGE         */
/* ====================== */
.add-story-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.story-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.media-container {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 1.5rem;
}

.camera-preview {
  width: 100%;
  height: 400px;
  background: #1a1a1a;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.camera-preview::before {
  content: "Pratinjau Kamera";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.3);
  font-size: 1.2rem;
  z-index: 0;
}

.live-camera,
.camera-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.media-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.camera-button,
.upload-button,
.capture-button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.2s, opacity 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.camera-button {
  background: #28a745;
  color: white;
}

.upload-button {
  background: #007bff;
  color: white;
}

.capture-button {
  background: #dc3545;
  color: white;
}

.camera-button:hover,
.upload-button:hover,
.capture-button:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.coordinates {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 0.9rem;
}

/* ====================== */
/* FLOATING BUTTON        */
/* ====================== */
.fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 16px 24px;
  background: var(--teal) !important;
  color: var(--black) !important;
  border: 2px solid var(--dark-teal) !important;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(29, 205, 159, 0.25) !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
  z-index: 1000;
}

.fab:hover {
  background: var(--black) !important;
  color: var(--teal) !important;
  box-shadow: 0 6px 16px rgba(22, 153, 118, 0.3) !important;
}

/* ====================== */
/* RESPONSIVE DESIGN      */
/* ====================== */
@media (max-width: 768px) {
  .container {
    padding-inline: 16px;
  }

  .navigation-drawer {
    width: 80%;
  }

  .story-image {
    height: 300px;
  }

  .story-map {
    height: 250px;
  }

  .media-buttons {
    flex-direction: column;
  }

  .camera-button,
  .upload-button,
  .capture-button {
    width: 100%;
    justify-content: center;
  }

  .camera-preview {
    height: 300px;
  }

  .add-story-container {
    padding: 1.5rem;
    margin: 1rem;
  }
}

@media (min-width: 1000px) {
  .navigation-drawer {
    position: static;
    transform: translateX(0);
    width: auto;
    min-height: auto;
    background: transparent;
    box-shadow: none;
  }

  .nav-list {
    flex-direction: row;
    gap: 2rem;
  }

  .drawer-button {
    display: none;
  }
}

/* ====================== */
/* LEAFLET MAP OVERRIDES  */
/* ====================== */
.leaflet-container {
  border-radius: 12px;
  background: #f8f9fa !important;
}

.leaflet-control {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid var(--teal) !important;
}

.leaflet-control a {
  color: var(--dark-teal) !important;
}

.leaflet-control-zoom {
  margin-right: 10px !important;
  margin-bottom: 10px !important;
}

/* Logout button styling */
.logout-button {
  color: #dc3545 !important;
  font-weight: 600;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logout-button:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.auth-item {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* Pagination Controls */
.pagination-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}

.pagination-button {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: white;
  cursor: pointer;
}

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

/* Search Container */
.search-container {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.search-input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 15px;
}

.search-button {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 15px;
}

/* Location Filter */
.filter-container {
  margin: 1rem 0;
}

.location-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* State Messages */
.empty-state,
.error-state,
.auth-warning {
  padding: 2rem;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin: 2rem 0;
}

.loading {
  text-align: center;
  padding: 1rem;
  display: none;
}

/* ====================== */
/* VIEW TRANSITIONS       */
/* ====================== */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-old(root) {
  animation-name: slide-out;
}

::view-transition-new(root) {
  animation-name: slide-in;
}

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

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

.bio-container {
  margin-top: 2rem;
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bio-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(29, 205, 159, 0.05);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
}

.bio-item .feather {
  width: 24px;
  height: 24px;
  stroke: var(--dark-teal);
}

.bio-label {
  font-weight: 600;
  color: #333;
  min-width: 120px;
}

.bio-value {
  color: #666;
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutToLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

/* Animation classes */
.page-transition-animation-in {
  animation: slideInFromRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.page-transition-animation-out {
  animation: slideOutToLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.notif-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  color: white;
  font-size: 1.5rem;
  margin-right: 8px;
  display: flex;
  align-items: center;
  transition: background 0.3s, border 0.3s;
  border-radius: 8px;
  padding: 12px 16px;
  text-decoration: none;
}

.notif-button:hover,
.notif-button.active,
.notif-button:active {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--teal);
  color: white;
}

.notif-button .feather {
  stroke: currentColor;
}

.bookmark-btn,
.remove-fav-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  margin-top: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  transition: background 0.2s;
}
.bookmark-btn {
  background: var(--teal);
  color: white;
}
.bookmark-btn.bookmarked {
  background: #ffb300;
  color: #222;
}
.bookmark-btn:hover {
  background: var(--dark-teal);
  color: white;
}

.remove-fav-btn {
  background: #dc3545 !important;
  color: white !important;
}
.remove-fav-btn:hover {
  background: #b71c1c !important;
  color: white !important;
}

.not-found-container {
  text-align: center;
  padding: 4rem 2rem;
}

.not-found-container h1 {
  font-size: 2.5rem;
  color: var(--dark-gray);
  margin-bottom: 1rem;
}

.not-found-container p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.back-home-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--teal);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: background 0.3s ease;
}

.back-home-button:hover {
  background: var(--dark-teal);
}

