:root {
  --primary-color: #4a6fa5;
  --secondary-color: #ff9a3c;
  --accent-color: #ff6b6b;
  --dark-color: #2c3e50;
  --light-color: #f8f9fa;
  --text-color: #333;
  --text-light: #6c757d;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  color: var(--text-color);
  background-color: #f5f7fa;
}

/* Navigation */
nav {
  background-color: var(--primary-color);
  padding: 1rem 0;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

nav ul {
  display: flex;
  list-style: none;
  justify-content: center;
  flex-wrap: wrap;
}

nav li {
  margin: 0 15px;
}

nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 15px;
  border-radius: 5px;
  transition: var(--transition);
  display: inline-block;
}

nav a:hover, nav a.active {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Home Page */
.home-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 50px 20px;
  text-align: center;
  position: relative;
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.home-container h1 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 2.8rem;
  font-weight: 700;
  position: relative;
  z-index: 2;
}

.home-container p {
  color: var(--text-color);
  font-size: 1.3rem;
  margin-bottom: 40px;
  max-width: 700px;
  position: relative;
  z-index: 2;
}

.home-buttons {
  display: flex;
  justify-content: center;
  gap: 25px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

.btn {
  padding: 15px 30px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
}

.btn:hover {
  background-color: var(--dark-color);
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.btn i {
  font-size: 1.2rem;
}

/* Map View */
#mapView {
  display: none;
  flex-direction: column;
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
}

.map-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 25px;
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.map-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.map-header h1 {
  color: var(--primary-color);
  font-size: 2.2rem;
  margin-bottom: 10px;
}

.map-header p {
  color: var(--text-light);
  font-size: 1.1rem;
}

.map-container-wrapper {
  display: flex;
  flex-direction: row;
  gap: 25px;
  width: 100%;
  height: calc(100vh - 180px);
}

#mapContainer {
  flex: 1;
  height: 100%;
  border-radius: 15px;
  overflow: auto;
  box-shadow: var(--shadow);
  background: white;
  border: 3px solid var(--primary-color);
  position: relative;
  transition: transform 0.5s ease;
}

.svg-container {
  width: 100%;
  height: 100%;
  min-width: 1048px;
  min-height: 700px;
}

#peta {
  width: 100%;
  height: 100%;
  min-width: 1048px;
  min-height: 700px;
}

.map-instruction {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-zoom-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 15px;
}

.map-zoom-controls button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-zoom-controls button:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

/* Info Panel */
#infoPanel {
  width: 380px;
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow-y: auto;
  position: relative;
}

#infoPanel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

#infoPanel h2 {
  color: var(--primary-color);
  font-size: 1.6rem;
  margin: 0;
}

.province-badge {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--secondary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.info-content {
  flex: 1;
}

.info-item {
  margin-bottom: 15px;
  padding: 12px;
  border-radius: 8px;
  transition: var(--transition);
  background: rgba(74, 111, 165, 0.05);
}

.info-item:hover {
  background: rgba(74, 111, 165, 0.1);
}

.info-label {
  font-weight: 600;
  color: var(--primary-color);
  display: block;
  margin-bottom: 5px;
  font-size: 0.95rem;
}

.info-value {
  color: var(--text-color);
  font-size: 1rem;
}

.info-section {
  margin: 20px 0;
  padding: 18px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid var(--secondary-color);
}

.info-section h3 {
  color: var(--primary-color);
  margin-bottom: 12px;
  font-size: 1.3rem;
}

.info-list {
  list-style-type: none;
}

.info-list li {
  position: relative;
  padding-left: 25px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.info-list li:before {
  content: "•";
  color: var(--secondary-color);
  font-size: 1.8rem;
  position: absolute;
  left: 0;
  top: -5px;
}

#detailButton {
  margin-top: 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 15px 25px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#detailButton:hover {
  background: #3a5a8f;
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Detail View */
#detailView {
  display: none;
  padding: 30px;
  max-width: 1000px;
  margin: 20px auto;
  background-color: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  min-height: auto;
}

.detail-container {
  width: 100%;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

#detailTitle {
  color: var(--primary-color);
  font-size: 2rem;
  margin: 0;
}

/* Tabs */
.tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
  flex-wrap: wrap;
  gap: 5px;
}

.tabBtn {
  margin-right: 5px;
  padding: 12px 20px;
  border: none;
  background-color: transparent;
  color: var(--text-light);
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.tabBtn:hover {
  color: var(--primary-color);
  background: rgba(74, 111, 165, 0.1);
}

.tabBtn.active {
  color: var(--primary-color);
  background: transparent;
  border-bottom: 3px solid var(--primary-color);
  font-weight: 600;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
  animation: fadeIn 0.5s ease-in-out;
}

.tab-content {
  padding: 20px 0;
  min-height: 300px;
}

/* Tab Content */
#penjelasanText {
  line-height: 1.8;
  font-size: 1.1rem;
  color: var(--text-color);
}

.penjelasan-container {
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid var(--secondary-color);
}

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  max-height: 400px;
}

.image-container img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.image-container:hover img {
  transform: scale(1.02);
}

/* Back Button */
.backBtn {
  margin-top: 30px;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.backBtn:hover {
  background: #3a5a8f;
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Tooltip */
#tooltip {
  position: absolute;
  display: none;
  padding: 12px 16px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  max-width: 250px;
  backdrop-filter: blur(4px);
}

#tooltip strong {
  color: var(--secondary-color);
}

/* SVG Map Styling */
#peta path {
  transition: all 0.8s ease;
  cursor: pointer;
  transform-origin: center;
}

#peta path:hover {
  fill: var(--secondary-color) !important;
  stroke: var(--dark-color) !important;
  stroke-width: 2px !important;
  filter: drop-shadow(0 0 8px rgba(0,0,0,0.4));
  transform: scale(1.03);
  z-index: 5;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Button Animations */
.btn-animated {
  position: relative;
  overflow: hidden;
}

.btn-animated span {
  position: relative;
  z-index: 2;
  transition: transform 0.3s ease;
}

.btn-animated:hover span {
  transform: translateX(5px);
}

.btn-animated::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.7s ease;
}

.btn-animated:hover::after {
  left: 100%;
}

/* Floating Icons */
.floating-icons i {
  position: absolute;
  color: rgba(74, 111, 165, 0.3);
  animation: float 6s infinite ease-in-out;
  z-index: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .map-container-wrapper {
    flex-direction: column;
    height: auto;
  }
  
  #infoPanel {
    width: 100%;
    margin-top: 20px;
  }
  
  #mapContainer {
    min-height: 60vh;
  }
}

@media (max-width: 992px) {
  .home-container h1 {
    font-size: 2.4rem;
  }
  
  .home-container p {
    font-size: 1.1rem;
  }
  
  .btn {
    padding: 12px 25px;
    font-size: 1rem;
  }
  
  .tabs {
    flex-wrap: wrap;
  }
  
  .tabBtn {
    margin-bottom: 5px;
    padding: 10px 15px;
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  nav ul {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  
  nav li {
    margin: 5px 0;
  }
  
  .home-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .home-container h1 {
    font-size: 2rem;
  }
  
  #detailView {
    padding: 20px;
  }
  
  #detailTitle {
    font-size: 1.6rem;
  }
}

@media (max-width: 576px) {
  .home-container {
    padding: 30px 15px;
  }
  
  .home-container h1 {
    font-size: 1.8rem;
  }
  
  .home-container p {
    font-size: 1rem;
  }
  
  .tabBtn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  
  #penjelasanText {
    font-size: 1rem;
  }
  
  .backBtn, #detailButton {
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}

/* Game Specific Styles */
.game-card {
  background: white;
  border-radius: 15px;
  padding: 40px 30px;
  width: 320px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.game-card h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 1.5rem;
}

.game-card p {
  color: var(--text-light);
  margin-bottom: 0;
}

.game-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--secondary-color);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.game-card:hover .game-badge {
  transform: scale(1.1) rotate(15deg);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7);
  overflow: auto;
  backdrop-filter: blur(3px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  width: 80%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  position: relative;
}

.close {
  position: absolute;
  right: 25px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.3s ease;
}

.close:hover {
  color: var(--primary-color);
  transform: rotate(90deg);
}

/* Quiz Game Styles */
.question-box {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 1.2rem;
  font-weight: 500;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.quiz-option {
  padding: 15px;
  border: 2px solid #eee;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.quiz-option:hover {
  border-color: var(--primary-color);
  background: rgba(74, 111, 165, 0.05);
}

.quiz-option.correct {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.quiz-option.incorrect {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.feedback-box {
  padding: 15px;
  margin: 20px 0;
  border-radius: 8px;
  display: none;
}

.feedback-box.correct {
  background: #d4edda;
  color: #155724;
  border-left: 4px solid #28a745;
}

.feedback-box.incorrect {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
}

.feedback-correct, .feedback-incorrect {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 500;
}

.feedback-correct i {
  color: #28a745;
}

.feedback-incorrect i {
  color: #dc3545;
}

.feedback-explanation {
  font-size: 0.95rem;
  line-height: 1.6;
}

.btn-next {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px auto 0;
}

.btn-next:hover {
  background: var(--dark-color);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.quiz-result {
  text-align: center;
  padding: 20px;
}

.quiz-score {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  margin: 15px 0;
}

.quiz-percentage {
  font-size: 2rem;
  font-weight: bold;
  color: var(--secondary-color);
  margin: 15px 0;
}

.quiz-message {
  font-size: 1.2rem;
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

/* Matching Game Styles */
.matching-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.matching-item {
  height: 150px;
  background: #f8f9fa;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
}

.matching-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.matching-item.selected {
  background: var(--secondary-color);
  color: white;
}

.matching-item.matched {
  background: var(--primary-color);
  color: white;
  cursor: default;
  transform: scale(0.95);
}

.result-box {
  text-align: center;
  padding: 15px;
  margin-top: 20px;
  font-weight: 500;
}

.matching-complete {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.matching-complete i {
  font-size: 1.5rem;
}

/* Memory Game Styles */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 20px 0;
}

.memory-card {
  aspect-ratio: 1;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  cursor: pointer;
}

.memory-card .front, 
.memory-card .back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.memory-card .front {
  background: white;
  color: var(--primary-color);
  font-size: 2rem;
}

.memory-card .back {
  background: var(--primary-color);
  color: white;
  font-size: 2rem;
  transform: rotateY(180deg);
}

.stats-box {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
}

.stats-box p {
  font-weight: 500;
}

.stats-box span {
  font-weight: bold;
  color: var(--primary-color);
}

.memory-complete {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--primary-color);
  font-size: 1.1rem;
  margin-top: 20px;
}

.memory-complete i {
  font-size: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .game-cards {
    flex-direction: column;
    align-items: center;
  }
  
  .modal-content {
    width: 90%;
    margin: 10% auto;
  }
  
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .matching-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .modal-content {
    padding: 20px;
  }
  
  .memory-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .matching-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats-box {
    flex-direction: column;
    gap: 10px;
  }
}