/* --- General Styling & Accessibility --- */
:root {
  --primary-color: #007bff;
  --primary-hover: #0056b3;
  --text-color: #212529;
  --bg-color: #ffffff;
  --light-gray: #f8f9fa;
  --border-color: #dee2e6;
  --muted-text: #6c757d;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  color: var(--text-color);
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 90%;
  max-width: 960px;
  margin: 0 auto;
}

main {
  flex-grow: 1;
  padding: 2rem 0;
}

/* --- Accessibility Helpers --- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: #fff;
  padding: 8px;
  z-index: 100;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Header & Navigation --- */
header {
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo a {
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-color);
}

.logo sup {
  font-size: 0.8rem;
  color: var(--primary-color);
  vertical-align: top;
}

.tagline {
  font-style: italic;
  font-size: 1rem;
  color: var(--muted-text);
  margin-top: 4px;
}

nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

nav a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  transition: color 0.2s;
}

nav a:hover,
nav a:focus {
  color: var(--primary-color);
  outline: none;
}

/* Language Switcher */
.lang-switcher-container {
  margin-left: 1rem;
}

.lang-switcher-form select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background-color: var(--bg-color);
  font-size: 0.9rem;
  cursor: pointer;
}

.lang-switcher-form select:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}

/* --- Buttons & Links --- */
.button {
  background-color: var(--primary-color);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  text-decoration: none;
  display: inline-block;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.button:hover {
  background-color: var(--primary-hover);
  color: #fff;
}

/* DIUBAH: Peningkatan aksesibilitas untuk focus state */
.button:focus {
  background-color: var(--primary-hover);
  color: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.4);
}

nav a.button {
  color: #fff;
}

.back-link {
  display: inline-block;
  margin-top: 2rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover,
.back-link:focus {
  text-decoration: underline;
  outline: none;
}

/* --- Page Layout --- */
h1, h2, h3 {
  margin-top: 0;
}

section {
  margin-bottom: 2.5rem;
}

.welcome-section {
  text-align: center;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-color);
}

.welcome-section .subtitle {
  font-size: 1.2rem;
  color: var(--muted-text);
}

/* --- Quote of the Day --- */
.quote-section {
  text-align: center;
  padding: 2rem;
  background-color: var(--light-gray);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  margin-bottom: 2.5rem;
}

.quote-section h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.quote-content p {
  font-size: 1.2rem;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.quote-content cite {
  font-style: normal;
  color: var(--muted-text);
}

/* --- Changelog & Readme --- */
.log-content {
  background-color: var(--light-gray);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 1rem 1.5rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  line-height: 1.5;
}

/* --- News Page --- */
.news-container {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.news-item {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.news-item:last-child {
  border-bottom: none;
}

.news-title {
  margin-bottom: 0.5rem;
}

.news-meta {
  font-size: 0.9rem;
  color: var(--muted-text);
  margin: 0 0 1rem;
}

.news-message {
  line-height: 1.7;
}

/* --- Download Table --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 2rem;
}

table th, table td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

table thead {
  background-color: var(--light-gray);
}

table tbody tr:hover {
  background-color: #f1f1f1;
}

/* --- Footer --- */
footer {
  background-color: var(--light-gray);
  border-top: 1px solid var(--border-color);
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 2rem;
  color: var(--muted-text);
}

footer a {
    color: var(--primary-color);
}

/* --- Back to Top Button --- */
#backToTopBtn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 30px;
  z-index: 99;
  border: none;
  outline: none;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 50%;
  font-size: 18px;
  transition: opacity 0.3s, visibility 0.3s;
}

#backToTopBtn:hover,
#backToTopBtn:focus {
  background-color: var(--primary-hover);
  outline: none;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    gap: 1rem;
  }

  nav ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  .lang-switcher-container {
    margin-left: 0;
  }

  /* Responsive Table */
  table thead {
    display: none;
  }

  table, table tbody, table tr, table td {
    display: block;
    width: 100%;
  }

  table tr {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
  }

  table td {
    text-align: right;
    padding-left: 50%;
    position: relative;
    border-bottom: 1px solid #eee;
  }

  table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 45%;
    padding-left: 1rem;
    font-weight: bold;
    text-align: left;
  }
}

/* --- Dropdown Navigation --- */
nav ul .dropdown {
  position: relative;
}

nav ul .dropdown-toggle::after {
  content: ' ▼';
  display: inline-block;
  font-size: 0.7em;
  margin-left: 0.3em;
}

nav ul .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  list-style: none;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  min-width: 160px;
  z-index: 1000;
}

nav ul .dropdown-menu.show {
  display: block;
}

nav ul .dropdown-menu li {
  width: 100%;
}

nav ul .dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  width: auto;
  white-space: nowrap;
}

nav ul .dropdown-menu a:hover,
nav ul .dropdown-menu a:focus {
  background-color: var(--light-gray);
  color: var(--primary-color);
}

/* --- Calendar Section --- */
.calendar-section {
  padding: 2rem;
  background-color: var(--light-gray);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  margin-bottom: 2.5rem;
}

.calendar-section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--primary-color);
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.event-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--bg-color);
  border: 1px solid #ddd;
  border-radius: 5px;
  flex-wrap: wrap;
}

.event-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.event-name {
  font-weight: bold;
  font-size: 1.1rem;
}

.event-type {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  color: #fff;
  background-color: var(--muted-text);
  width: fit-content;
}

/* TAMBAHAN: Warna untuk tipe event yang berbeda */
.event-type-nasional { background-color: #c82333; }
.event-type-international { background-color: #0069d9; }
.event-type-optional { background-color: #218838; }
.event-type-keagamaan { background-color: #ffc107; color: var(--text-color); }

/* --- History Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.65);
  z-index: 1001; /* DIUBAH: dinaikkan agar di atas dropdown */
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}

.modal-content {
  background-color: var(--bg-color);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
  max-width: 600px;
  width: 100%;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
  animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--muted-text);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
  color: var(--text-color);
  outline: none;
}

#history-modal-title {
  margin-top: 0;
  margin-bottom: 1.5rem;
  padding-right: 2.5rem;
  color: var(--primary-color);
}

#history-modal-body {
  line-height: 1.7;
  white-space: pre-wrap;
}


/* --- Responsive Tambahan untuk Kalender --- */
@media (max-width: 500px) {
  .event-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .event-item .button {
    margin-top: 1rem;
    width: 100%;
    text-align: center;
  }
}
