/* Font Face Declarations - Using Google Fonts as fallback for CORS issues */
@import url("https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

/* Archi Font Declarations */
@font-face {
  font-family: "Archi";
  src: url("../assets/Fonts/ARCHI FONT/Archi-Reguler.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Archi";
  src: url("../assets/Fonts/ARCHI FONT/Archi-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Base Styles */
:root {
  --primary-color: #b8a033;
  --secondary-color: #112f49;
  --text-light: #ffffff;
  --text-dark: #333333;
  --background-light: #f5f5f5;
  --background-dark: #112f49;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
  --font-rubik: "Rubik", sans-serif;
  --font-archi: "Archi", "Georgia", serif;
}

/* Archi Font Declarations */
@font-face {
  font-family: "Archi";
  src: url("../assets/Fonts/ARCHI FONT/Archi-Reguler.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Archi";
  src: url("../assets/Fonts/ARCHI FONT/Archi-Italic.ttf") format("truetype");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Rubik", sans-serif;
  color: var(--text-dark);
  overflow: hidden;
  height: 100dvh; /* Dynamic viewport height - excludes mobile UI */
  width: 100vw;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Rubik", Arial, sans-serif;
  font-weight: 600;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--secondary-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loading-content {
  text-align: center;
  color: var(--text-light);
}

.loading-logo {
  width: 200px;
  margin-bottom: 20px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce {
  0% {
    transform: scale(1.2);
  }
  25% {
    transform: scale(1.4);
  }
  50% {
    transform: scale(1.1);
  }
  75% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1.2);
  }
}

/* App Container */
.app-container {
  position: relative;
  height: 100dvh; /* Dynamic viewport height */
  width: 100vw;
  overflow: hidden;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 300px;
  right: 0;
  background-color: #b8a033b0;
  padding: 20px 20px 5px 10px;
  z-index: 100;
  transition: left 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.app-header.sidebar-closed {
  left: 0;
}

/* Header styles now handled by Tailwind classes */

/* Main Content */
.main-content {
  position: relative;
  height: 100dvh; /* Dynamic viewport height */
  width: 100vw;
}

/* Sidebar */
.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  color: var(--text-light);
  transition: transform 0.3s ease;
  z-index: 150;
}

/* Sidebar is open by default on desktop */
.sidebar.active {
  transform: translateX(0);
}

.sidebar-wrapper {
  width: 300px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-family: var(--font-rubik) !important;
}

/* Apply Rubik font to all sidebar content */
.sidebar-wrapper,
.sidebar-wrapper *,
.sidebar-header,
.sidebar-header h2,
.sidebar-content,
.sights-list,
.sight-item {
  font-family: "Rubik", sans-serif !important;
}

/* Sidebar header uses Archi font */
.sidebar-header h2 {
  font-family: var(--font-archi) !important;
  font-weight: normal !important;
  font-size: 18px !important;
}

.sidebar-header {
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--secondary-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-content {
  padding: 0 0 20px;
}

.sidebar-wrapper::-webkit-scrollbar {
  display: none;
}

.sights-list {
  list-style: none;
}

.sight-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sight-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.sight-item.active {
  border-left: 8px solid var(--text-dark);
  background-color: var(--primary-color);
}

.sight-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid;
  background-color: transparent;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  margin-right: 15px;
  flex-shrink: 0;
}

.sight-item.active .sight-number {
  color: var(--secondary-color);
}

.sight-thumbnail {
  width: 80px;
  height: 50px;
  object-fit: cover;
  flex-shrink: 0;
}

.sight-name {
  font-size: 14px;
  flex-grow: 1;
}

/* Map Container */
.map-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100dvh; /* Dynamic viewport height */
  overflow: hidden;
}

.map {
  width: 100%;
  height: 100%;
}

.map-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.control-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--text-light);
  border: none;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: var(--secondary-color);
  transition: var(--transition);
}

.control-btn:hover {
  background-color: var(--primary-color);
  color: var(--text-light);
}

/* Route Information Container - Mobile Only */
.route-info {
  display: none; /* Hidden on desktop */
  position: absolute;
  bottom: 10px;
  left: 20px;
  right: 20px;
  background: var(--secondary-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 15;
  transition: all 0.3s ease;
  max-width: 400px;
}

.route-info.hidden {
  display: none;
}

.route-info-content {
  padding: 16px 20px;
  color: var(--text-light);
}

.route-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.route-icon {
  color: var(--primary-color);
  flex-shrink: 0;
}

.route-info-title {
  font-family: var(--font-rubik);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
}

.route-info-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-sight-name {
  font-family: var(--font-archi);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
}

.route-distance {
  font-family: var(--font-rubik);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 400;
}

.route-info-toggle {
  display: none;
}

/* Route Information Container */
.route-info {
  position: absolute;
  bottom: 10px;
  left: 20px;
  right: 20px;
  background: var(--secondary-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 15;
  transition: all 0.3s ease;
  max-width: 400px;
}

.route-info.hidden {
  display: none;
}

.route-info-content {
  padding: 16px 20px;
  color: var(--text-light);
}

.route-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.route-icon {
  color: var(--primary-color);
  flex-shrink: 0;
}

.route-info-title {
  font-family: var(--font-rubik);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
}

.route-info-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-sight-name {
  font-family: var(--font-archi);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
}

.route-distance {
  font-family: var(--font-rubik);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 400;
}

.route-info-toggle {
  display: none;
}

/* Video Modal */
.video-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 200;
  display: none;
  justify-content: flex-start;
  align-items: center;
}

.video-modal.active {
  display: flex;
}

.video-modal-content {
  width: 450px;
  height: 100%;
  max-height: 900px;
  background-color: var(--secondary-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.video-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background-color: var(--secondary-color);
  color: var(--text-light);
  border-radius: 8px 8px 0 0;
}

.video-modal-scrollable {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.video-modal-scrollable::-webkit-scrollbar {
  display: none; /* WebKit */
}

.video-navigation {
  display: flex;
  width: 100%;
  align-items: center;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-light);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-family: "Rubik", sans-serif;
  font-size: 14px;
}

.nav-btn svg {
  margin-right: 5px;
}

.sight-counter {
  margin-left: auto;
  font-size: 14px;
  color: white;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-arrow-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.nav-arrow-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-arrow-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-arrow-btn svg {
  width: 16px;
  height: 16px;
}

.video-container {
  width: 100%;
  position: relative;
  background-color: #000;
}

.sight-video {
  width: 100%;
  height: 252.5px;
  display: block;
}

.video-progress {
  padding: 15px 20px;
  display: flex;
  align-items: center;
  background-color: #b8860b; /* Golden background like in design */
  gap: 15px;
}

.video-play-btn {
  width: 40px;
  height: 40px;
  background-color: #1e3a5f; /* Dark blue/teal */
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.video-play-btn::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 12px solid white;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  margin-left: 3px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background-color: white; /* White track */
  border-radius: 4px;
  position: relative;
  cursor: pointer;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background-color: #1e3a5f; /* Dark blue/teal fill */
  border-radius: 4px;
  width: 30%;
  transition: width 0.1s ease;
}

.video-time {
  font-size: 14px;
  color: white;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.video-fullscreen-btn {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.video-fullscreen-btn img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1); /* Makes the icon white */
}

.sight-info {
  padding: 10px;
  color: var(--text-light);
}

.sight-content {
  flex: 1;
  padding-right: 20px;
}

.sight-image {
  width: 100%;
  height: auto;
  position: relative;
  flex-shrink: 0;
}

.sight-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.sight-marker {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--text-light);
  color: var(--secondary-color);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  box-shadow: var(--shadow);
  z-index: 10;
}

.sight-navigation-info {
  position: -webkit-sticky; /* Safari */
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 10px 20px;
  display: flex;
  color: white;
  justify-content: right;
  background-color: var(--secondary-color);
  border-radius: 0 0 8px 8px;
}

.nearby-sights {
  display: flex;
  align-items: center;
  font-size: 14px;
}

.nearby-numbers {
  display: flex;
  gap: 5px;
  margin: 0 10px;
}

.nearby-numbers .sight-number {
  width: 25px;
  height: 25px;
  font-size: 12px;
}

.distance {
  opacity: 0.7;
}

/* Sidebar Arrow Toggle Button */
#sidebar-arrow-toggle {
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
  outline: none;
}

#sidebar-arrow-toggle:hover {
  background-color: #9a8829 !important;
  transform: scale(1.05);
}

#sidebar-arrow-toggle:active {
  transform: scale(0.95);
}

/* Arrow direction based on sidebar state */
.sidebar.active #sidebar-arrow-toggle .arrow-icon {
  transform: rotate(0deg); /* Points left when sidebar is open */
}

.sidebar:not(.active) #sidebar-arrow-toggle .arrow-icon {
  transform: rotate(180deg); /* Points right when sidebar is closed */
}

/* Desktop sidebar behavior */

.sidebar {
  transform: translateX(0); /* Open by default on desktop */
}

.sidebar:not(.active) {
  transform: translateX(-300px); /* Hide sidebar but keep arrow visible */
}

/* Navigation Button */
.navigation-btn {
  background: white;
  border: none;
  border-radius: 25px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-right: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1000;
  font-family: "Rubik", sans-serif;
}

.navigation-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.navigation-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.navigation-btn svg {
  width: 16px;
  height: 16px;
}

/* Map Marker Styles */
.custom-marker {
  width: 40px;
  height: 40px;
  cursor: pointer;
}

.custom-marker:hover {
  transform: scale(1.2);
  transition: transform 0.2s ease;
}

.custom-marker.active {
  transform: scale(1.2);
  z-index: 10;
}

.custom-marker.bounce {
  animation: bounce 0.8s ease-in-out;
}

.marker-number {
  width: 40px;
  height: 40px;
  background-color: var(--primary-color);
  border: 3px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 16px;
  font-family: "Rubik", sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 3D Model Marker */
.model-marker {
  width: 30px;
  height: 30px;
  background-color: var(--primary-color);
  border: 2px solid var(--text-light);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.model-marker:hover {
  transform: scale(1.2);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  /* Make header sticky on mobile and prevent width changes */
  .app-header {
    position: fixed !important;
    top: 0;
    left: 0 !important;
    right: 0;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    z-index: 200;
    transition: none;
  }

  /* Ensure header stays full width even when sidebar is open */
  .app-header.sidebar-closed {
    left: 0 !important;
    width: 100vw !important;
  }

  /* Adjust main content to account for sticky header */
  .main-content {
    padding-top: 80px; /* Adjust based on your header height */
  }

  /* Ensure sidebar doesn't affect header positioning */
  .sidebar {
    top: 70px; /* Position below sticky header */
    height: calc(100dvh - 70px); /* Dynamic viewport height */
  }

  /* Ensure map container accounts for header */

  /* Video modal adjustments for sticky header */
  .video-modal {
    top: 70px;
    height: calc(100dvh - 70px); /* Dynamic viewport height */
  }

  /* Make logo smaller on mobile */
  .app-header img {
    height: 2.5rem !important; /* Smaller than desktop h-16 (4rem) */
  }

  /* Adjust header text size on mobile */
  .app-header .text-lg {
    font-size: 1rem !important;
  }

  /* Route Info Mobile Styles */
  .route-info {
    display: block; /* Show on mobile */
    left: 10px;
    right: 10px;
    max-width: none;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .route-info.visible {
    transform: translateY(0);
  }

  .route-info-toggle {
    display: flex;
    position: absolute;
    top: -50px;
    right: 60px;
    width: 50px;
    height: 50px;
    background: var(--secondary-color);
    border: none;
    border-radius: 50%;
    color: var(--primary-color);
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .route-info-toggle:hover {
    background: var(--primary-color);
    color: var(--secondary-color);
    transform: scale(1.05);
  }

  .route-info-toggle svg {
    transition: transform 0.3s ease;
  }

  .route-info.visible .route-info-toggle svg {
    transform: rotate(180deg);
  }

  .route-info-content {
    padding: 14px 16px;
  }

  .next-sight-name {
    font-size: 16px;
  }

  .route-distance {
    font-size: 13px;
  }
}

/* Hide Mapbox Attribution Controls */
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-logo {
  display: none !important;
}
