/* assets/css/style.css */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  overflow: hidden;
  background-color: #f8f9fa;
  color: #333;
}

#header {
  position: fixed; 
  top: 0;
  left: 0;
  width: 100%;
  height: 60px; /* Kunci tingginya agar seragam dengan kanvas dan sidebar */
  padding: 0 20px; /* Sesuaikan padding vertikal karena tinggi sudah dikunci */
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 999; 
  cursor: default; /* Kunci kursor kembali normal (tanda panah) */
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
}

.logo img {
  height: 30px;
}

#toolbar {
  position: fixed; /* Menggunakan fixed agar kebal dari scroll */
  bottom: 40px;    /* Dipindah ke bagian bawah layar */
  top: auto;       /* Menghapus aturan top sebelumnya */
  left: 50%;       /* Meletakkan tepat di tengah */
  transform: translateX(-50%); /* Presisi rata tengah */
  z-index: 9999;   /* LAPISAN TERTINGGI: Memastikan tidak ada yang bisa menutupinya */
  display: flex;
  gap: 8px;
  background: #ffffff;
  padding: 12px 20px;
  border-radius: 12px; /* Sudut lebih membulat */
  box-shadow: 0 10px 30px rgba(0,0,0,0.15); /* Bayangan melayang yang lebih elegan */
  transition: opacity 0.3s ease;
}

.tool-btn {
  border: none;
  background: #0d6efd;
  color: white;
  padding: 10px 15px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  transition: 0.2s;
}

.tool-btn:hover { background: #0b5ed7; }
.tool-btn.secondary { background: #6c757d; }
.tool-btn.secondary:hover { background: #5c636a; }

.divider {
  width: 2px;
  background: #e9ecef;
  margin: 0 5px;
}

#canvas-container {
  position: absolute;
  top: 60px; /* Kanvas dimulai tepat di bawah header */
  left: 0;
  width: 100vw;
  height: calc(100vh - 60px); /* Tinggi layar dikurangi tinggi header */
  cursor: grab;
  z-index: 1;
  overflow: hidden; /* Memastikan node yang digeser ke atas tidak tembus melewati batas */
}

#canvas-container:active { cursor: grabbing; }

#canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

#lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 10000px;
  height: 10000px;
  pointer-events: none;
}

/* Node Styling */
.node {
  position: absolute;
  background: #ffffff;
  border: 2px solid #0d6efd;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  white-space: nowrap;
  transform: translate(0, -50%); /* Center Y axis */
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  user-select: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.node.selected {
  border-color: #ff9800;
  background: #fff8e1;
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.connection-line {
  fill: none;
  stroke: #adb5bd;
  stroke-width: 3px;
}


/* Presentation Mode Styles */
body.presentation-mode {
  background-color: #121212;
}

body.presentation-mode .node {
  background: #1e1e1e;
  border-color: #3b82f6;
  color: #ffffff;
}

.toggle-btn {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: #3b82f6;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 5;
}

.node.collapsed {
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}



/* Sidebar Styles */
#sidebar {
  position: absolute;
  top: 60px; /* Di bawah header */
  left: 0;
  width: 250px;
  height: calc(100vh - 60px);
  background: #ffffff;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  z-index: 15;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 998; /* Berada tepat di bawah header, tapi di atas kanvas */
}

#sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 15px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

.btn-new {
  background: #198754;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-new:hover { background: #157347; }

#map-list {
  list-style: none;
  overflow-y: auto;
  flex-grow: 1;
}

/* --- Penyesuaian Tampilan Item Sidebar --- */
.map-item {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.map-title {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* Tambahkan titik-titik jika judul kepanjangan */
  margin-right: 10px;
}

.map-actions {
  display: flex;
  gap: 8px; /* Jarak antara ikon edit dan hapus */
  flex-shrink: 0;
}

.btn-action {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
}

.btn-action.edit { color: #0d6efd; }
.btn-action.edit:hover { color: #0b5ed7; }
.btn-action.delete { color: #dc3545; }
.btn-action.delete:hover { color: #bb2d3b; }

.map-item:hover { background: #f1f3f5; }
.map-item.active { background: #e9ecef; font-weight: bold; color: #0d6efd; border-left: 4px solid #0d6efd; }

.btn-delete-map {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
}
.btn-delete-map:hover { color: #bb2d3b; }

/* Hamburger Menu Icon */
#menu-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  margin-right: 10px;
  color: #333;
}



/* --- Header Kanan & Tombol Auth --- */
#header {
  justify-content: space-between; /* Memisahkan logo ke kiri dan menu ke kanan */
}
.header-left { display: flex; align-items: center; gap: 15px; }
.header-right { display: flex; align-items: center; gap: 15px; font-weight: 600; }

.btn-auth.secondary {
  background: #f8f9fa;
  color: #0d6efd;
  border: 1px solid #0d6efd;
}
.btn-auth.secondary:hover {
  background: #e9ecef;
}

.btn-auth {
  background: #0d6efd; color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: bold;
}
.btn-auth:hover { background: #0b5ed7; }
.btn-auth.logout { background: #dc3545; }
.btn-auth.logout:hover { background: #bb2d3b; }

/* --- Modal Login --- */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: white; padding: 30px; border-radius: 10px; width: 320px; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.modal-box h3 { margin-bottom: 20px; text-align: center; color: #333; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 14px; color: #555; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 14px; }
.btn-submit { width: 100%; background: #198754; color: white; border: none; padding: 10px; border-radius: 5px; cursor: pointer; font-weight: bold; margin-top: 10px; }
.btn-submit:hover { background: #157347; }
.btn-cancel { display: block; text-align: center; margin-top: 15px; color: #6c757d; font-size: 13px; text-decoration: none; }