/* =========================
   POPUP ALGEMEEN
========================= */

/* Basis styling voor overlay popup */
.popup {
    display: none; /* standaard verborgen */
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6); /* semi-transparante overlay */
    z-index: 3000; /* boven andere content */
    overflow: auto; /* scroll indien content te groot */
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box; /* consistentie met padding/margin */
    color: var(--text-main);
}

/* Active state: popup zichtbaar */
.popup.active {
    display: flex !important; /* override eventueel andere display regels */
}


/* =========================
   POPUP CONTENT
========================= */

/* Container voor popup inhoud */
.popup .popup-content {
    position: relative;
    background: var(--popup-surface, rgba(26,26,26,0.92));
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;

    width: 90%;
    max-width: 500px;

    /* ✅ dit is je scrollbar terug */
    max-height: 80vh;
    overflow-y: auto;

    padding: 20px;
    box-shadow: 0 0 20px rgba(0,0,0,0.4);

    display: flex;
    flex-direction: column;
    gap: 10px;

    text-align: left;
}


/* Form en laatste child in popup content */
/* Alleen forms/actions, niet “laatste child” van elke popup */
.popup .popup-content form {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

/* Als je een knop-rij hebt, geef die een class */
.popup .popup-content .popup-buttons,
.popup .popup-content .popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}


/* =========================
   POPUP CLOSE BUTTON
========================= */
/* === CLOSE BUTTON: zoals jouw originele popup.css === */
.popup .popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 22px;
    cursor: pointer;
    background: none;
    border: none;
    font-weight: bold;
    color: var(--text-main);
    transition: color 0.2s ease;
}

.popup .popup-close:hover {
    color: #ff4c4c;
}

.popup .popup-close:focus {
    outline: none;
    outline-offset: 2px;
    box-shadow: 0 0 5px #FFD70088;
}

/* =========================
   POPUP FORM ELEMENTEN
========================= */
.popup input,
.popup select,
.popup textarea {
    width: 100%;
    margin: 10px 0;
    padding: 10px;
    border-radius: 6px;
    border: none;
    background: #252526;
    /* color: #d4d4d4; */
    font-size: 14px;
    box-sizing: border-box;
}

/* Focus styling consistent met buttons */
.popup input:focus,
.popup select:focus,
.popup textarea:focus {
    outline-offset: 2px;
    box-shadow: 0 0 5px #FFD70088;
    border: 1px solid #2c00cc;
}

/* =========================
   POPUP BUTTONS
========================= */
.popup-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.popup-buttons button:focus,
.popup button:focus {
    outline-offset: 2px;
    box-shadow: 0 0 5px #FFD70088;
}

/* =========================
   ANIMATIES
========================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px);}
    to { opacity: 1; transform: translateY(0);}
}

/* =========================
   AI CHAT POPUP SPECIFIEK
========================= */

/* Container AI popup */
#aiPopup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    border: 1px solid #333;
    z-index: 2000; /* lager dan algemene popup om conflicten te vermijden */
    width: 100vw;   /* volledige viewport breedte */
    height: 100vh;  /* volledige viewport hoogte */
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    /* color: #d4d4d4; */
}

/* Tekstveld in AI popup */
#aiPopup textarea {
    width: 100%;
    height: 100px;
    padding: 8px;
    background: #111111;
    /* color: #d4d4d4; */
    border: 1px solid #555;
    border-radius: 4px;
    resize: vertical; /* kleine schermen alleen verticale resize */
}

#aiPopup textarea:focus {
    outline-offset: 2px;
    border: 1px solid #007acc;
    box-shadow: 0 0 5px #FFD70088;
}

#aiPopup button:focus {
    outline-offset: 2px;
    box-shadow: 0 0 5px #FFD70088;
}

/* Response container */
#aiResponse {
    margin-top: 10px;
    background: #1e1e1e;
    padding: 10px;
    border-radius: 6px;
    min-height: 40px;
    overflow-y: auto;
    white-space: pre-wrap;

    display: flex;
    flex-direction: column;
    gap: 8px;

    max-height: 300px;
    scrollbar-width: thin;
    scrollbar-color: #555 #1e1e1e;
}

/* Chat history styling */
.chat-history {
    max-height: 300px;
    overflow-y: auto;
    background: #1e1e1e;
    padding: 10px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    color: #ddd;
}

.chat-message.user {
    background-color: var(--primary);
    color: #fff; 
    align-self: flex-end;
}

.chat-message.ai {
    background-color: #333;
    color: #ddd;
    align-self: flex-start;
}

/* Mobiel: tekstveld resize */
@media (max-width: 500px) {
    #aiPopup textarea {
        resize: vertical;
    }
}

/* =========================
   NOTITIES OVER CSS CONFLICTEN
========================= */

/*
1. Algemene popup overlay (.popup) heeft z-index:3000 om altijd boven content te staan.
2. AI-popup (#aiPopup) heeft lagere z-index (2000) om conflicten met algemene popups te vermijden.
3. Popup inputs en buttons zijn consistent met globale form styling (zoals besproken in reset.css en Enneagram.css).
4. Scrollbars in #aiResponse zijn ingesteld zodat deze niet conflicteren met globale scrollbar styling.
5. Focus states zijn bewust afgezet voor outline:2px, omdat globale focus styling in reset.css soms anders is.
*/

/* === GRAPH POPUP: zorg dat canvas altijd hoogte krijgt === */
#graphPopup .popup-content {
    width: min(900px, 92vw);
    height: min(72vh, 560px);     /* 🔥 belangrijk: echte hoogte */
    max-height: none;             /* override base 80vh */
    overflow: hidden;             /* geen scroll in graph popup */
    background-color: #1a1a1a !important;
    padding: 20px 20px 10px 20px;
    position: relative;
    box-sizing: border-box;
}

#graphPopup .graph-wrapper {
    width: 100%;
    height: 100%;
}

#graphPopup canvas {
    width: 100% !important;
    height: 100% !important;      /* werkt nu wél omdat parent hoogte heeft */
    display: block;
}
/* =========================
   RESULT POPUP — spacing fix
========================= */

#resultPopup .popup-content {
  background-color: #000 !important;
  line-height: 1.55 !important;
}

/* Titel bovenaan */
#resultPopup .popup-content h3 {
  margin: 0 0 14px 0 !important;
  line-height: 1.25 !important;
  color: var(--text-main);
}

/* Type-regel (bijv. "De Avonturier (type 7) — score 10") */
#resultPopup .popup-content p {
  margin: 14px 0 8px 0 !important;
  line-height: 1.35 !important;      /* ✅ terug naar normaal */
  font-weight: 700;
  color: var(--text-soft);
}

/* Lijstblok onder een type */
#resultPopup .popup-content ul {
  margin: 0 0 12px 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

/* “Bullet”-regels */
#resultPopup .popup-content li {
  margin: 6px 0 !important;          /* ✅ ruimte tussen regels */
  line-height: 1.45 !important;
  color: var(--text-main);
  padding-left: 14px !important;
  position: relative;
}

/* Subtiele bullet (optioneel maar netjes) */
#resultPopup .popup-content li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: rgba(255,255,255,0.35);
}

/* Extra ruimte tussen blokken: ul gevolgd door p */
#resultPopup .popup-content ul + p {
  margin-top: 16px !important;
}
/* Alleen deze popup breder maken */
#enneaHelpPopup .popup-content.ennea-shell,
#enneagramPopup .popup-content {
  width: min(800px, 96vw) !important;
  max-width: none !important;   /* <-- dit is de sleutel */
}