/* ==========================================================================
   AI ROUTEBOUWER 2026 — v01
   Huisstijl: identiek aan route-planner / gpx-combiner
   Panelen  : #F0EBCE   Accent: #FFD800   Tekst: #563925
   ========================================================================== */

/* De tool leeft binnen de bestaande .planner-container (beige paneel).
   We scopen box-sizing op de rb-* elementen zodat alles netjes meeschaalt
   met de rest van de site, zonder globale resets. */
.planner-container .rb-main,
.planner-container .rb-main *,
.planner-container #resultContainer,
.planner-container #resultContainer *,
.planner-container #elevation-profile-container { box-sizing: border-box; }

.planner-container .rb-main { color: #563925; font-family: Geneva, Arial, sans-serif; }

/* Instructie-blok in een lichtbeige kader (onderscheidt zich van het beige paneel) */
.planner-container .rb-instructions {
    background-color: #FBF9EF;
    border: 1px solid #e0d9b5;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 4px;
}
.planner-container .rb-instructions h2 {
    margin: 0 0 10px 0;
    color: #b30000;
    font-size: 1.2em;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.planner-container .rb-instructions ul { padding-left: 20px; margin: 0 0 8px 0; }
.planner-container .rb-instructions li,
.planner-container .rb-instructions p,
.planner-container .rb-instructions em,
.planner-container .rb-instructions strong { color: #563925; }
.planner-container .rb-instructions li { margin-bottom: 4px; line-height: 1.45; }
.planner-container .rb-instructions strong { font-weight: bold; }
.planner-container .rb-instructions p { margin: 0; }

/* ==========================================================================
   2. HOOFDGRID
   ========================================================================== */
.rb-main {
    display: grid;
    grid-template-columns: minmax(320px, 5fr) minmax(400px, 7fr);
    gap: 18px;
    align-items: stretch;
    margin-top: 15px;
}

/* ==========================================================================
   3. CHATPANEEL
   ========================================================================== */
.rb-chat-col { display: flex; flex-direction: column; min-width: 0; }

.rb-chat-wrapper {
    background-color: #ffffff;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid #dcd6b0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 620px;
    max-height: 800px;
}

.rb-chat-history {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 14px;
    scroll-behavior: smooth;
}
.rb-chat-history::-webkit-scrollbar { width: 6px; }
.rb-chat-history::-webkit-scrollbar-thumb { background-color: rgba(86, 57, 37, 0.2); border-radius: 3px; }

.rb-message-row { display: flex; width: 100%; gap: 12px; align-items: flex-end; }
.rb-user-row { justify-content: flex-end; }
.rb-user-bubble {
    background-color: #FFD800;
    color: #563925;
    padding: 12px 16px;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 14px;
    max-width: 85%;
    border: 1px solid rgba(255, 216, 0, 0.5);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.rb-ai-row { justify-content: flex-start; }
.rb-avatar {
    background-color: #ffffff;
    color: #563925;
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}
.rb-ai-bubble {
    background-color: #F7F4E6;
    color: #563925;
    padding: 14px 18px;
    border-radius: 20px 20px 20px 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 14px;
    line-height: 1.5;
    max-width: 88%;
    border: 1px solid #e5dfc4;
}

.rb-typing-indicator { display: flex; gap: 4px; padding: 5px 0; transition: opacity 0.4s ease; }
.rb-typing-indicator span {
    width: 8px; height: 8px;
    background-color: #8c6a51;
    border-radius: 50%;
    display: inline-block;
    animation: rb-bounce 1.4s infinite ease-in-out both;
}
.rb-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.rb-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes rb-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1.0); opacity: 1; }
}

.rb-sentence { font-style: italic; font-weight: bold; opacity: 0.9; transition: opacity 0.5s ease; }
.rb-cursor::after { content: '|'; animation: rb-blink 1s step-end infinite; }
@keyframes rb-blink { 50% { opacity: 0; } }
.rb-fade-out { opacity: 0 !important; }
.rb-fade-in  { opacity: 1 !important; }

.rb-chat-status, .rb-tags { opacity: 0; transition: opacity 0.6s ease-in-out; }
.rb-visible { opacity: 1 !important; }
.rb-chat-status { margin-top: 10px; font-weight: bold; color: #2b1d12; font-size: 13px; }

.rb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rb-tag {
    background-color: #F9F8F3;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    border: 1px solid #e5e7eb;
    font-weight: bold;
    color: #563925;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.rb-tag-close {
    background: transparent; border: none;
    color: #ef4444; font-weight: bold; cursor: pointer;
    width: 16px; height: 16px; line-height: 16px;
    text-align: center; padding: 0; border-radius: 50%;
}

.rb-soft-banner {
    background-color: #fff8e1;
    color: #5d4a1a;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #f5d97a;
    font-size: 13px;
    margin: 10px 0 4px 0;
}

/* Actieknoppen ín een chatbubbel (bv. na een combinatie) */
.rb-bubble-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rb-bubble-btn {
    border: 2px solid #FFD800;
    background-color: #FFD800;
    color: #563925;
    font-weight: bold;
    font-size: 12px;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.2s ease;
}
.rb-bubble-btn.rb-bubble-alt { background-color: #ffffff; }
.rb-bubble-btn:hover { background-color: #f7c900; transform: scale(0.98); }
.rb-bubble-btn.rb-bubble-alt:hover { background-color: #fdf6d8; }

/* Voorbeeld-chips */
.rb-examples { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.rb-chip {
    background-color: #ffffff;
    border: 1px solid #e0d9b5;
    color: #563925;
    border-radius: 20px;
    font-size: 12px;
    padding: 7px 13px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}
.rb-chip:hover { background-color: #FFE75D; transform: scale(0.98); }

/* Invoer */
.rb-bottom-panel { margin-top: 4px; }
.rb-input-row {
    display: flex; gap: 12px;
    background-color: #FFFFFF;
    padding: 8px 8px 8px 18px;
    border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #d1d5db;
    align-items: center;
}
.rb-input-field {
    flex-grow: 1; border: none; outline: none; background: transparent;
    color: #563925; font-size: 15px; font-family: inherit;
    resize: none; padding: 8px 0;
    min-height: 36px; max-height: 120px;
    overflow-y: auto; line-height: 1.4;
}
.rb-btn-send {
    background-color: #FFD800; color: #000;
    border: none; width: 44px; height: 44px;
    border-radius: 50%; font-size: 19px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; align-self: flex-end;
    transition: background-color 0.2s ease, transform 0.15s ease;
}
.rb-btn-send:hover { background-color: #f7c900; transform: scale(0.97); }
.rb-btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.rb-choice-row { display: none; gap: 12px; width: 100%; margin-bottom: 10px; }
.rb-btn-choice {
    padding: 12px 18px; border-radius: 30px;
    font-size: 14px; font-weight: bold; cursor: pointer;
    border: 2px solid #FFD800;
    background-color: #FFFFFF; color: #563925;
    flex: 1; text-align: center;
    transition: all 0.2s;
}
.rb-btn-choice:hover { background-color: #fdf6d8; }
.rb-btn-primary { background-color: #FFD800; }
.rb-btn-primary:hover { background-color: #f7c900; }

/* ==========================================================================
   4. KAARTPANEEL
   ========================================================================== */
.rb-map-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.rb-map-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: 1px solid #dcd6b0;
}
#mapid { height: 480px; width: 100%; z-index: 1; }

.rb-map-badge {
    position: absolute;
    top: 12px; left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.94);
    color: #563925;
    font-size: 12px;
    font-weight: bold;
    padding: 7px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Trackpaneel */
.rb-track-panel {
    background-color: #ffffff;
    border: 1px solid #dcd6b0;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 16px 18px;
}
.rb-panel-title {
    margin: 0 0 10px 0;
    font-size: 1.05em;
    color: #b30000;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.rb-track-list { margin-bottom: 12px; }
.rb-track-empty { font-size: 13px; color: #5c4b38; padding: 4px 2px; }
.rb-track-note { font-size: 12px; color: #0056b3; padding: 2px 2px 8px 2px; }
.rb-track-warning { font-size: 12px; color: #b30000; padding: 2px 2px 8px 2px; }

.rb-track-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 7px 10px;
    margin-bottom: 6px;
    font-size: 13px;
}
.rb-track-item input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: #FFD800;
    cursor: pointer;
    flex-shrink: 0;
}
.rb-track-color {
    width: 14px; height: 14px;
    border-radius: 3px;
    border: 1px solid #555;
    flex-shrink: 0;
}
.rb-track-name {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rb-track-meta { font-size: 11px; color: #8c6a51; white-space: nowrap; }
.rb-track-remove {
    background: transparent; border: none;
    color: #ef4444; font-size: 16px; font-weight: bold;
    cursor: pointer; line-height: 1; padding: 0 2px;
    flex-shrink: 0;
}

/* Actieknoppen */
.rb-track-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rb-action-btn {
    padding: 9px 14px;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    font-size: 12px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background 0.3s;
    display: inline-block;
    text-align: center;
}
.rb-btn-neutral { background: #563925; }
.rb-btn-neutral:hover { background: #3B2403; }
.rb-btn-blue { background: #007bff; }
.rb-btn-blue:hover { background: #0056b3; }
.rb-btn-green { background: #28a745; }
.rb-btn-green:hover { background: #1f8236; }
.rb-btn-red { background: #dc3545; }
.rb-btn-red:hover { background: #c82333; }
.rb-action-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Gecombineerde info */
.rb-combined-info {
    margin-top: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
}
.rb-info-title { margin: 0 0 8px 0; font-size: 14px; color: #563925; text-transform: uppercase; }
.rb-info-line { margin: 4px 0; font-size: 13px; }
#infoErrorContent { font-size: 13px; color: #b30000; line-height: 1.5; }

/* ==========================================================================
   5. HOOGTEPROFIEL
   ========================================================================== */
.rb-elevation {
    margin-top: 18px;
    background: #ffffff;
    border: 1px solid #dcd6b0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 6px;
    min-height: 260px;
}

/* ==========================================================================
   6. ROUTEKAARTEN (ZOEKRESULTATEN)
   ========================================================================== */
.rb-results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 18px;
}
@media (min-width: 768px)  { .rb-results-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .rb-results-grid { grid-template-columns: 1fr 1fr 1fr; } }

.rb-card {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #dcd6b0;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    display: flex;
    flex-direction: column;
}
.rb-card.visible { opacity: 1; transform: translateY(0); }

.rb-card-title {
    font-weight: bold; font-size: 17px;
    text-transform: uppercase; color: #563925;
    margin: 0 0 5px 0; line-height: 1.2;
}
.rb-card-subtitle { font-size: 13px; color: #563925; opacity: 0.9; margin: 0 0 12px 0; font-weight: bold; }

.rb-lus-tag {
    display: inline-block;
    background-color: #F7F4E6;
    color: #563925;
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: bold;
    margin: 0 6px 6px 0;
    border: 1px solid #e5dfc4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.rb-scores {
    font-size: 12px;
    margin-top: 8px;
    border-top: 1px solid rgba(86, 57, 37, 0.15);
    padding-top: 12px;
    color: #563925;
    flex-grow: 1;
}
.rb-score-label {
    font-weight: bold; text-transform: uppercase;
    letter-spacing: 1px; font-size: 10px;
    opacity: 0.7; margin: 0 0 8px 0;
}
.rb-score-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.rb-score-global {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: bold;
    border-top: 1px solid rgba(86, 57, 37, 0.15);
    padding-top: 7px; margin-top: 7px;
    font-size: 14px; color: #2b1d12;
}

.rb-card-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.rb-btn-load {
    background-color: #FFD800;
    color: #563925;
    border: none;
    font-weight: bold;
    font-size: 13px;
    padding: 11px 14px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.15s ease;
}
.rb-btn-load:hover { background-color: #f7c900; transform: scale(0.99); }
.rb-btn-details {
    display: block;
    background-color: #ffffff;
    color: #563925;
    border: 2px solid #FFD800;
    font-weight: bold;
    font-size: 13px;
    padding: 9px 14px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.rb-btn-details:hover { background-color: #fdf6d8; }

/* ==========================================================================
   7. DISCLAIMER MODAL (zelfde look als combiner)
   ========================================================================== */
.rb-disclaimer-modal {
    display: none;
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 9999; overflow: auto;
}
.rb-disclaimer-content {
    background-color: #F0EBCE;
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    margin: 50px auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.rb-disclaimer-content h3 {
    color: #333; margin-top: 0; text-align: center;
    border-bottom: 2px solid #FFD800; padding-bottom: 10px;
}
.rb-disclaimer-content p { font-size: 14px; color: #555; line-height: 1.6; margin-bottom: 25px; }
.rb-disclaimer-buttons { text-align: center; }
.rb-disclaimer-button {
    padding: 10px; font-size: 17px; font-weight: bold;
    border: none; cursor: pointer; border-radius: 4px;
    transition: transform 0.3s ease-in-out, background-color 0.3s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 10px 15px; width: 150px;
}
.rb-disclaimer-cancel  { background-color: lightgray; color: #333; }
.rb-disclaimer-cancel:hover  { background-color: #DCDCDC; transform: scale(0.98); }
.rb-disclaimer-confirm { background-color: #FFD800; color: #333; }
.rb-disclaimer-confirm:hover { background-color: #f7c900; transform: scale(0.98); }

/* ==========================================================================
   8. RESPONSIVE
   ========================================================================== */
@media (max-width: 1000px) {
    .rb-main { grid-template-columns: 1fr; }
    .rb-chat-wrapper { min-height: 480px; max-height: 600px; }
    #mapid { height: 55vh; min-height: 380px; }
}
@media (max-width: 520px) {
    .rb-intro { padding: 16px; }
    .rb-intro-steps { font-size: 12px; }
    .rb-step-sep { display: none; }
    .rb-track-actions { flex-direction: column; }
    .rb-action-btn { width: 100%; }
    .rb-disclaimer-content { padding: 15px; width: 95%; margin: 20px auto; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .rb-card, .rb-chip, .rb-btn-send, .rb-bubble-btn { transition: none; }
    .rb-typing-indicator span { animation: none; opacity: 0.7; }
}
