/* RESET & GLOBAL */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Rubik', sans-serif;
  background-color: #121212;
  color: #f0f0f0;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* HEADER */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

h1 {
  flex: 1;
  font-size: 28px;
  text-align: center;
  color: #00ccff;
  text-shadow: 0 0 8px #00ccff;
}

.blinking {
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* SELECTOR */
.selector-wrapper {
  margin-bottom: 20px;
}

.selector-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  align-items: flex-end;
}

.selector {
  display: flex;
  flex-direction: column;
  min-width: 200px;
}

.selector label {
  font-weight: 600;
  margin-bottom: 6px;
}

.selector select {
  padding: 12px;
  border-radius: 8px;
  font-size: 16px;
  background-color: #1e1e1e;
  color: #00ccff;
  border: 2px solid #00ccff;
  appearance: none;
}

/* CHOICES.JS */
.choices__inner {
  background-color: #1e1e1e !important;
  color: #00ccff !important;
  border: 2px solid #00ccff !important;
  border-radius: 8px;
  padding: 10px !important;
}

.choices__list--dropdown {
  background-color: #1e1e1e !important;
}

.choices__item--selectable {
  color: #00ccff !important;
}

.choices__item--selectable:hover {
  background-color: #262626 !important;
}

/* AUTH & PROFILE */
#loginBtn, #authBtn {
  padding: 10px 24px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 30px;
  background-color: #00ccff;
  color: #121212;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 204, 255, 0.3);
  transition: 0.3s ease;
}

#loginBtn:hover, #authBtn:hover {
  background-color: #0099cc;
  transform: scale(1.05);
}

#userMenu {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#profileSection {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #1e1e1e;
  border: 2px solid #00ccff;
  font-weight: bold;
  color: #00ccff;
  cursor: pointer;
  font-size: 18px;
  transition: 0.3s ease;
  position: relative;
}

#profileDropdown {
  position: absolute;
  top: 50px;
  right: 0;
  background: #1e1e1e;
  border: 2px solid #00ccff;
  border-radius: 8px;
  z-index: 1000;
  display: none;
  min-width: 120px;
  box-shadow: 0 6px 14px rgba(0, 204, 255, 0.2);
}

#profileDropdown button {
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: transparent;
  color: #ff4d4d;
  font-weight: bold;
  cursor: pointer;
  border-top: 1px solid #333;
}

#profileDropdown button:hover {
  background: #262626;
}

/* TOAST */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #00ccff, #0099cc);
  color: #fff;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: bold;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0, 204, 255, 0.3);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
}

/* VOUCHERS */
#voucherContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  padding: 10px;
}

.voucher {
  background: #1c1c1c;
  border: 1px solid #333;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 0 10px rgba(0, 204, 255, 0.2);
  animation: slideFade 0.6s ease;
}

.voucher.inactive {
  opacity: 0.5;
  background: #181818;
  color: #777;
}

.voucher img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 12px;
}

.voucher-details h3 {
  color: #00ccff;
  font-size: 1.1em;
  margin-bottom: 8px;
  font-weight: 600;
}

.voucher-details p {
  font-size: 0.95em;
  margin: 4px 0;
  line-height: 1.4em;
  color: #ffffff;
}

.voucher-details p strong {
  color: #ffcc00;
}

.aktif {
  color: #00ff6a;
  font-weight: bold;
}

.nonaktif {
  color: #ff4d4d;
  font-weight: bold;
}

/* LOADER */
.spinner {
  border: 6px solid #333;
  border-top: 6px solid #00ccff;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 30px auto;
}

.screen-spinner {
  position: fixed;
  background: #121212;
  z-index: 9998;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* LOGIN POPUP */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  z-index: 9997;
  display: none;
}

body.noscroll {
  overflow: hidden;
}

.login-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 14px;
  padding: 30px 24px;
  z-index: 9999;
  width: 300px;
  box-shadow: 0 0 20px rgba(0, 204, 255, 0.3);
}

.login-popup h2 {
  text-align: center;
  color: #00ccff;
  margin-bottom: 15px;
  font-size: 20px;
}

.login-popup input {
  width: 100%;
  padding: 10px;
  background-color: #121212;
  border: 2px solid #00ccff;
  color: #fff;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 15px;
}

.login-popup button {
  width: 100%;
  background-color: #00ccff;
  border: none;
  padding: 10px;
  color: #121212;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

.login-popup button:hover {
  background-color: #0099cc;
}

.login-popup .error {
  color: #ff4d4d;
  text-align: center;
  margin-top: 10px;
  font-size: 0.9em;
}

.login-popup #closeLogin {
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: 22px;
  color: #00ccff;
  font-weight: bold;
  cursor: pointer;
}

/* ANIMATIONS */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideFade {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* RESPONSIVE */
@media screen and (max-width: 480px) {
  .selector-row {
    flex-direction: column;
    align-items: stretch;
  }

  #authBtn, #loginBtn {
    width: 100%;
    height: auto;
  }

  .voucher-details h3 {
    font-size: 1em;
  }

  .voucher-details p {
    font-size: 0.85em;
  }

  .login-popup {
    width: 90%;
    padding: 20px 16px;
  }

  #profileDropdown {
    width: 100%;
  }
}

.loading-text {
  margin-top: 12px;
  font-size: 16px;
  color: #00ccff;
  text-align: center;
  font-weight: bold;
  animation: blinkText 1.6s infinite;
}

@keyframes blinkText {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media screen and (min-width: 768px) {
  #voucherContainer {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
    padding: 20px;
  }

  .voucher {
    padding: 20px;
    border-radius: 16px;
  }

  .voucher-details h3 {
    font-size: 1.25em;
    margin-bottom: 10px;
  }

  .voucher-details p {
    font-size: 1em;
    line-height: 1.6;
  }

  .voucher img {
    max-height: 220px;
    margin-bottom: 16px;
  }

  .selector-row {
    justify-content: flex-start;
    gap: 24px;
    padding-left: 40px;
    padding-right: 40px;
  }

  .selector {
    min-width: 250px;
  }

  .header h1 {
    font-size: 32px;
  }

  .toast {
    font-size: 17px;
    padding: 14px 28px;
  }
}

.spinner-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
