:root {
  --hue1: 255;
  --hue2: 222;
  --radius: 22px;
}

/* Body dan background */
body {
  background: #08090d;
  background-image: url(https://assets.codepen.io/13471/abstract-light.jpg),
    linear-gradient(to right in oklab, hsl(var(--hue2) 50% 75%), hsl(var(--hue1) 50% 75%));
  background-size: cover;
  background-position: center;
  background-blend-mode: hard-light;
  min-height: 100vh;
  font-family: 'Asap', sans-serif;
  color: #737985;
  margin: 0;
  padding: 0 20px 40px;
}

/* Judul dinamis tema */
.themed-title {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 900;
  font-size: 3.2rem;
  text-align: center;
  margin: 1rem 0;
  background: linear-gradient(
    90deg,
    hsl(var(--hue1), 90%, 65%),
    hsl(var(--hue2), 90%, 65%)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 0 8px hsl(var(--hue1), 80%, 70%),
    0 0 20px hsl(var(--hue2), 90%, 65%);
  transition: background 0.3s ease, text-shadow 0.3s ease;
}

/* Theme icon bulat kecil */
.theme-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 24px;
  color: white;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
  transition: background 0.3s ease;
  z-index: 100000;
}

.theme-icon:hover,
.theme-icon:focus {
  background: rgba(255, 255, 255, 0.3);
  outline: none;
}

/* Theme box (panel pengaturan tema) */
.theme-box {
  position: fixed;
  bottom: 80px; /* di atas icon tema */
  right: 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 12px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  width: 130px;
  max-width: 90vw;
  color: white;
  font-family: 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 99999;
}

.theme-box.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.theme-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 20px;
  color: #ccc;
  cursor: pointer;
  user-select: none;
}

.theme-close:hover,
.theme-close:focus {
  color: white;
  outline: none;
}

/* Label dan slider tema */
.theme-box h2 {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.theme-box label {
  font-size: 12px;
  margin: 6px 0 3px 0;
  display: block;
}

input[type='range'] {
  width: 100%;
  height: 3px;
  border-radius: 2px;
  cursor: pointer;
  opacity: 0.85;
}

input[type='range']::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

/* Search input styling */
.search-wrapper {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 10px 0 8px 0;
}

.search-box {
  font-family: 'Segoe UI', sans-serif;
  color: white;
  margin: 10px 0 8px 0;
}

.search-box label {
  font-size: 14px;
  margin-right: 8px;
  user-select: none;
}

.search-box input {
  width: 220px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 12px;
  border: none;
  font-size: 14px;
  outline: none;
  background: rgba(255 255 255 / 0.15);
  color: white;
  transition: background 0.2s ease;
}

.search-box input::placeholder {
  color: rgba(255 255 255 / 0.5);
}

.search-box input:focus {
  background: rgba(255 255 255 / 0.3);
}

/* Responsif dan scroll horizontal untuk tabel */
.iphone-table-wrapper {
  max-height: 800px;
  overflow-y: auto;
  overflow-x: auto;
  margin: 1.5em 0;
  background: rgba(255 255 255 / 0.12);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 8px 32px rgba(31, 38, 135, 0.37),
    0 0 0 1px rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  -webkit-overflow-scrolling: touch;
}

.iphone-table th,
.iphone-table td {
  min-width: 120px;
}

/* Table */
.iphone-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: white;
  user-select: text;
}

/* Table head sticky */
.iphone-table thead th {
  position: sticky;
  top: 0;
  background: rgba(255 255 255 / 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f0f0f5;
  font-weight: 700;
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid rgba(255 255 255 / 0.3);
  z-index: 10;
}

/* Cells */
.iphone-table th,
.iphone-table td {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255 255 255 / 0.12);
}

/* Rounded corners on first and last rows */
.iphone-table tbody tr:first-child td:first-child {
  border-top-left-radius: 20px;
}
.iphone-table tbody tr:first-child td:last-child {
  border-top-right-radius: 20px;
}
.iphone-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 20px;
}
.iphone-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 20px;
}

/* Hover effect */
.iphone-table tbody tr:hover {
  background: rgba(255 255 255 / 0.08);
  cursor: default;
  transition: background 0.3s ease;
}

/* Scrollbar styling */
.iphone-table-wrapper::-webkit-scrollbar {
  width: 8px;
}
.iphone-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.iphone-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
}
.iphone-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Context Menu styling */
#menu.menu {
  position: fixed;
  min-width: 180px;
  background: rgba(30, 30, 40, 0.95);
  border-radius: 16px;
  padding: 8px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  font-family: 'Segoe UI', sans-serif;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10000;
}

#menu.menu.open {
  visibility: visible;
  opacity: 1;
}

#menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#menu ul li {
  padding: 8px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

#menu ul li:hover,
#menu ul li:focus {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

/* Popup styling */
.popup {
  display: none;
  position: fixed;
  z-index: 11000;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: rgba(30, 30, 40, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 20px 28px 24px 28px;
  width: 90%;
  max-width: 480px;
  max-height: 75vh;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  color: #ddd;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.popup.show {
  display: block;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.popup-content {
  position: relative;
  max-height: calc(75vh - 120px);
  overflow-y: auto;
  padding-right: 8px;
}

.popup-content h2 {
  font-weight: 700;
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: white;
  user-select: none;
}

.popup-content .close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 28px;
  font-weight: bold;
  color: #bbb;
  background: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.popup-content .close:hover,
.popup-content .close:focus {
  color: white;
  outline: none;
}

.popup-content button.copy {
  margin-top: 14px;
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #6e48aa, #9d50bb);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 12px 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(157, 80, 187, 0.6);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.popup-content button.copy:hover,
.popup-content button.copy:focus {
  background: linear-gradient(135deg, #9d50bb, #6e48aa);
  box-shadow: 0 6px 18px rgba(110, 72, 170, 0.8);
  outline: none;
}

.popup-content .resize-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  bottom: 8px;
  right: 8px;
  cursor: se-resize;
  background: transparent;
  user-select: none;
}

/* Loading spinner */
.loading-spinner {
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top: 4px solid white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Toggle menu button (mobile) */
.toggle-menu-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 10001;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 20px;
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  transition: background 0.3s ease;
}

.toggle-menu-btn:hover,
.toggle-menu-btn:focus {
  background: rgba(255, 255, 255, 0.25);
  outline: none;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .theme-box {
    width: 140px;
    padding: 14px 18px;
    font-size: 14px;
  }

  .theme-box h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  .theme-box label {
    font-size: 13px;
    margin-top: 6px;
    margin-bottom: 3px;
  }

  input[type='range'] {
    height: 4px;
  }

  input[type='range']::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
  }

  .iphone-table-wrapper {
    max-height: 300px;
  }

  .iphone-table {
    display: block;
    width: 100%;
    min-width: 400px;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 14px;
  }

  .search-box label {
    font-size: 16px;
  }

  .search-box input {
    font-size: 16px;
    padding: 10px 14px;
  }

  .toggle-menu-btn {
    font-size: 24px;
    padding: 14px 20px;
  }

  .theme-icon {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  /* Judul kecil untuk layar kecil */
  .themed-title {
    font-size: 1.8rem;
  }
}

@media (max-width: 400px) {
  .iphone-table-wrapper {
    max-height: 300px;
  }

  .iphone-table {
    font-size: 12px;
  }

  .themed-title {
    font-size: 1.5rem;
  }
}

/* Lebih besar di PC */
@media (min-width: 900px) {
  .theme-box {
    width: 200px;
    padding: 20px 24px;
    font-size: 15px;
  }
  .theme-box h2 {
    font-size: 1.3rem;
  }
  .theme-box label {
    font-size: 14px;
  }
  input[type='range']::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 600px) {
  .info-menu-text {
    display: none;
  }
}
