:root {
  --bg-dark: #08090e;
  --card-bg: rgba(18, 20, 33, 0.75);
  --input-bg: rgba(10, 12, 20, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(108, 99, 255, 0.4);
  --primary: #6c63ff;
  --primary-gradient: linear-gradient(135deg, #6c63ff 0%, #4f46e5 100%);
  --primary-glow: rgba(108, 99, 255, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: absolute;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(108, 99, 255, 0.25) 0%, rgba(0,0,0,0) 70%);
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  z-index: -1;
  animation: pulseGlow 8s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
  0% { transform: translateX(-50%) scale(0.8); opacity: 0.5; }
  100% { transform: translateX(-50%) scale(1.3); opacity: 0.9; }
}

/* ================================
   NAVBAR & HAMBURGER MENU
================================= */
.navbar {
  width: 100%;
  max-width: 500px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 1000;
}

.nav-brand {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 40%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hamburger-btn {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 20px;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hamburger-btn:hover {
  border-color: var(--border-hover);
  color: #818cf8;
}

.nav-menu {
  display: none;
  position: absolute;
  top: 50px;
  right: 0;
  width: 200px;
  background: rgba(18, 20, 33, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 10px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.nav-menu.active {
  display: block;
  animation: popup 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-menu ul {
  list-style: none;
}

.nav-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-menu li a:hover {
  background: rgba(108, 99, 255, 0.15);
  color: #818cf8;
}

/* ================================
   CONTAINER (GLASSMORPHISM)
================================= */
.container {
  width: 100%;
  max-width: 500px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 40px 32px;
  border-radius: 28px;
  border: 1px solid var(--border-color);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6),
              0 0 40px rgba(108, 99, 255, 0.15);
  transition: border-color 0.3s ease;
}

.logo {
  text-align: center;
  font-size: 38px;
  font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #ffffff 40%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}

.description {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 24px;
}

/* ================================
   PANIEKKNOP STYLING
================================= */
.panic-container {
  width: 100%;
  margin: 0 auto 28px auto;
  text-align: center;
}

#panicBtn {
  width: 100%;
  padding: 14px 18px;
  background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(127, 29, 29, 0.35);
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

#panicBtn:hover {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

#panicBtn:active {
  transform: scale(0.98);
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #e2e8f0;
  letter-spacing: 0.2px;
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

select {
  width: 100%;
  padding: 16px 18px;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.25s ease;
}

select:hover, select:focus {
  border-color: var(--border-hover);
  box-shadow: 0 0 15px rgba(108, 99, 255, 0.15);
}

.custom-topic-field {
  margin-top: 18px;
  animation: popup 0.2s ease-out;
}

.custom-topic-field[hidden] {
  display: none;
}

.custom-topic-field input {
  width: 100%;
  padding: 16px 18px;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-topic-field input:focus {
  border-color: var(--border-hover);
  box-shadow: 0 0 15px rgba(108, 99, 255, 0.15);
}

.api-key-field {
  margin-top: 20px;
}

.api-key-input-wrap {
  display: flex;
  gap: 8px;
}

.api-key-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font: inherit;
  outline: none;
}

.api-key-input-wrap input:focus {
  border-color: var(--border-hover);
  box-shadow: 0 0 15px rgba(108, 99, 255, 0.15);
}

.key-visibility-btn {
  padding: 0 14px;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.api-key-note {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.slider-container {
  margin-top: 28px;
}

.slider {
  width: 100%;
  height: 8px;
  border-radius: 10px;
  background: linear-gradient(to right, #3b82f6, #ef4444);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.strength-display {
  text-align: center;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.strength-number {
  color: #818cf8;
  font-size: 20px;
  font-weight: 700;
  margin-left: 4px;
}

.generate-button {
  width: 100%;
  margin-top: 32px;
  padding: 18px;
  border: none;
  border-radius: 14px;
  background: var(--primary-gradient);
  color: white;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 25px var(--primary-glow);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.generate-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(108, 99, 255, 0.5);
}

.generate-button:active {
  transform: translateY(1px);
}

.generate-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.generator-status {
  min-height: 20px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.result {
  display: none;
  margin-top: 28px;
  padding: 24px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  animation: popup 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popup {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.result-title {
  color: #818cf8;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-text {
  color: #f1f5f9;
  line-height: 1.65;
  font-size: 16px;
  font-weight: 500;
}

.history-section {
  margin-top: 28px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.history-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-heading h2 {
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
}

.clear-history-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text-muted);
  cursor: pointer;
}

.clear-history-btn:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.history-empty {
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.history-list {
  display: grid;
  list-style: none;
  max-height: 340px;
  overflow-y: auto;
}

.history-entry {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 13px 2px;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.history-entry:hover .history-excuse {
  color: #818cf8;
}

.history-topic {
  color: #818cf8;
  font-size: 12px;
  font-weight: 700;
}

.history-excuse {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-date {
  color: var(--text-muted);
  font-size: 11px;
}

.button-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.action-btn {
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

#copyBtn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

#copyBtn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

#shareBtn {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

#shareBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.5);
}

.footer-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 28px;
  line-height: 1.6;
}

.footer-text a {
  color: #818cf8;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-text a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-submit-btn {
  color: #818cf8;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.footer-submit-btn:hover {
  color: #ffffff;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.modal-card {
  background: rgba(18, 20, 33, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.25);
  border-radius: 24px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  margin: auto;
  box-sizing: border-box;
  animation: popUp 0.25s ease-out;
}

.submit-card {
  border-color: rgba(108, 99, 255, 0.4) !important;
  box-shadow: 0 0 40px rgba(108, 99, 255, 0.25) !important;
}

.profile-card {
  max-width: 460px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-color: rgba(52, 211, 153, 0.35);
  box-shadow: 0 0 40px rgba(52, 211, 153, 0.12);
  text-align: left;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
}

.profile-title {
  margin-bottom: 20px;
  color: var(--text-main);
  font-size: 22px;
}

.profile-input {
  width: 100%;
  min-width: 0;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text-main);
  font: inherit;
  outline: none;
}

.profile-input:focus {
  border-color: var(--border-hover);
  box-shadow: 0 0 15px rgba(108, 99, 255, 0.15);
}

.api-key-input-wrap .profile-input {
  margin-bottom: 0;
}

.profile-key-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  color: #6ee7b7;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
}

.profile-key-link:hover,
.profile-key-link:focus-visible {
  color: #a7f3d0;
  text-decoration: underline;
}

.profile-security-note,
.profile-status {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.profile-status {
  min-height: 18px;
}

.profile-actions .generate-button {
  margin-top: 8px;
  padding: 14px;
}

.profile-delete-btn {
  display: block;
  margin: 14px auto 0;
  border: 0;
  background: transparent;
  color: #f87171;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.submit-textarea {
  width: 100%;
  min-height: 90px;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 16px;
  outline: none;
  box-sizing: border-box;
}

.submit-textarea:focus {
  border-color: var(--border-hover);
}

@keyframes popUp {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
}

.close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
}

.modal-text {
  font-size: 16px;
  color: #ffffff;
  line-height: 1.5;
  margin-bottom: 20px;
  font-weight: 600;
}

.copy-panic-btn {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 500px) {
  body {
    min-height: 100vh;
    min-height: 100svh;
    justify-content: flex-start;
    padding: max(16px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
  }

  .navbar {
    margin-bottom: 16px;
  }

  .nav-brand {
    font-size: 18px;
  }

  .nav-actions {
    flex: 0 0 auto;
    gap: 8px;
  }

  .theme-toggle-btn,
  .hamburger-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
  }

  .profile-avatar-btn {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .container {
    padding: 26px 20px;
    border-radius: 22px;
  }

  .logo {
    font-size: 32px;
  }

  .result {
    padding: 18px;
  }

  .button-group {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    align-items: flex-start;
    padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
  }

  .modal-card {
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 20px;
    border-radius: 20px;
  }
}

@media (max-width: 360px) {
  .nav-brand {
    font-size: 16px;
  }

  .nav-actions {
    gap: 6px;
  }

  .container {
    padding: 22px 16px;
  }

  .logo {
    font-size: 29px;
  }

  #panicBtn {
    padding: 13px 10px;
    font-size: 13px;
  }
}
/* Licht modus variabelen */
body.light-mode {
  --bg-dark: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.85);
  --input-bg: rgba(241, 245, 249, 0.9);
  --border-color: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(108, 99, 255, 0.6);
  --text-main: #0f172a;
  --text-muted: #475569;
}

body.light-mode label {
  color: #1e293b;
}

body.light-mode .result-text,
body.light-mode .modal-text,
body.light-mode .history-excuse {
  color: #0f172a;
}

body.light-mode .profile-card {
  background: rgba(255, 255, 255, 0.98);
}

/* Tekst-logo donker maken in licht modus */
.logo {
  transition: color 0.3s ease;
}

body.light-mode .logo,
body.light-mode .logo a,
body.light-mode .logo h1,
body.light-mode .logo h2 {
  color: #0f172a;
}

/* Navbar uitlijning & knoppen */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(52, 211, 153, 0.45);
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.profile-avatar-btn:hover {
  background: rgba(52, 211, 153, 0.24);
  border-color: rgba(52, 211, 153, 0.8);
}

.theme-toggle-btn {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 18px;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--border-hover);
  color: #818cf8;
}
/* Logo-tekst fix voor licht modus */
body.light-mode .nav-brand,
body.light-mode .logo {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  background: transparent !important;
}

body.light-mode .nav-brand span,
body.light-mode .logo span {
  display: inline-block;
  background: linear-gradient(135deg, #6c63ff, #a855f7) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
}
/* SEO-accordion aanpassingen voor licht modus */
body.light-mode .seo-accordion-container details {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .seo-accordion-container summary {
  color: #4f46e5 !important;
}

body.light-mode .seo-accordion-container h2 {
  color: #0f172a !important;
}

body.light-mode .seo-accordion-container .seo-content,
body.light-mode .seo-accordion-container p,
body.light-mode .seo-accordion-container strong {
  color: #334155 !important;
}
/* Hamburgermenu knop + uitklapmenu fix voor licht modus */

/* 1. Hamburgerknop stijlen */
body.light-mode .hamburger-btn,
body.light-mode .hamburger {
  background: var(--input-bg) !important;
  border: 1px solid var(--border-color) !important;
  color: #0f172a !important;
}

/* Voor FontAwesome icoontje */
body.light-mode .hamburger-btn i,
body.light-mode #hamburgerIcon {
  color: #0f172a !important;
}

/* Voor losse streepjes (span-elementen) */
body.light-mode .hamburger-btn span,
body.light-mode .hamburger span {
  background-color: #0f172a !important;
}

/* 2. Geopende menu-dropdown aanpassen */
body.light-mode .nav-menu {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .nav-menu a {
  color: #0f172a !important;
}

body.light-mode .nav-menu a:hover {
  background: rgba(108, 99, 255, 0.1) !important;
  color: #6c63ff !important;
}
