:root {
    --primary: #093848;
    --accent: #EDC210;
    --bg-main: #F5FAFF;
    --bg-card: #FFFFFF;
    --bg-secondary: #E6EFFA;
    --text-main: #093848;
    --text-muted: rgba(0,0,0,0.6);
    --radius: 12px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--primary);
    margin: 0;
    isolation: isolate; 
}

.app-container { display: flex; min-height: 100vh; }

h1, h2, h3 {
    color: var(--primary); 
}

/* --- SIDEBAR: vast aan de linkerkant --- */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--primary);
    color: var(--accent);
    padding: 40px 20px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.brand-logo { 
    color: var(--accent);
    font-weight: 800; 
    font-size: 1.5rem; 
    margin-bottom: 50px; 
}

.nav-item {
    color: var(--accent);
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.7;
}

.nav-item.active { background: rgba(255,255,255,0.1); opacity: 1; }

/* Content krijgt margin-left voor de vaste sidebar */
.app-container {
    padding-left: 260px;
}

.content { 
    flex: 1; 
    padding: 60px; 
    max-width: 900px; 
    margin: 0 auto;
}

.form-card {
    background: var(--bg-card);
    color: var(--text-card);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04); 
    border: 1px solid var(--card-border);
}

.form-card input, .form-card textarea, .form-card select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-card);
}

.form-card h2, 
.form-card label, 
.form-card .hint,
.form-card small {
    color: var(--text-card) !important;
}

:root:has(body) .form-card {
    --input-border: rgba(0,0,0,0.1);
}

.card-header { display: flex; align-items: center; gap: 15px; margin-bottom: 25px; }

.step-number {
    background: var(--accent);
    color: var(--primary);
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-weight: bold; font-size: 0.9rem;
    flex-shrink: 0;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }

label { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; opacity: 0.8; }

input, textarea, select {
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--bg-secondary);
}

input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

.social-selector { display: flex; gap: 10px; flex-wrap: wrap; }
.chip input { display: none; }
.chip span {
    padding: 8px 18px;
    background: var(--bg-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}
.chip input:checked + span { 
    background: var(--accent); 
    color: var(--text-accent);
}

.file-upload-area {
    border: 2px dashed var(--bg-secondary);
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
}
.file-upload-area input { position: absolute; opacity: 0; width: 100%; height: 100%; top:0; left:0; cursor: pointer; }

.btn-primary {
    background: var(--accent);
    color: var(--text-accent);
    border: none;
    padding: 20px;
    border-radius: 8px;
    font-weight: 800;
    width: 100%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex; justify-content: center; align-items: center; gap: 10px;
}

.loader {
    display: none;
    width: 18px; height: 18px;
    border: 3px solid var(--primary);
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.mt-20 { margin-top: 20px; }
.hint { color: #666; margin-top: 5px; }

/* --- ACHTERGROND BLOBS --- */
.bg-flow {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
    background-color: var(--bg-main);
    pointer-events: none;
}

.blob {
    position: absolute;
    background: var(--primary);
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    transform: translate3d(0,0,0);
    will-change: transform;
}

.blob-1 {
    width: 700px; height: 700px;
    top: -100px; right: -100px;
    animation: move-1 10s infinite alternate ease-in-out;
}

.blob-2 {
    width: 800px; height: 800px;
    bottom: -200px; left: -150px;
    animation: move-2 12s infinite alternate ease-in-out;
    opacity: 0.1;
}

.blob-3 {
    width: 500px; height: 500px;
    top: 20%; left: 10%;
    animation: move-3 8s infinite alternate ease-in-out;
    opacity: 0.08;
}

@keyframes move-1 {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(-150px, 150px, 0) scale(1.2); }
}
@keyframes move-2 {
    0% { transform: translate3d(0, 0, 0) scale(1.1); }
    100% { transform: translate3d(200px, -100px, 0) scale(1); }
}
@keyframes move-3 {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(100px, 150px, 0); }
}

.app-container {
    position: relative;
    z-index: 1;
    background: transparent;
}

/* --- MODAL --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(9, 56, 72, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fff;
    color: #093848;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 80%;
    max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    display: flex; 
    flex-direction: column;
}

#modalBody {
    padding: 40px;
    overflow-y: auto;
    height: 100%;
}

.close-modal {
    position: absolute;
    right: 25px; top: 20px;
    font-size: 30px;
    cursor: pointer;
    color: var(--primary);
    z-index: 10;
    background: #fff;
    border-radius: 50%;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
}

.detail-row {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--bg-secondary);
    padding-bottom: 10px;
}

.detail-row label {
    color: var(--accent);
    display: block;
    margin-bottom: 5px;
    font-weight: 800;
}

.detail-row p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: #093848 !important;
}

/* --- HISTORIE --- */
.history-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.05);
    border-color: var(--accent);
}

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

.history-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: #093848;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-tag {
    background: var(--accent);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
}

.history-title {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: #093848 !important;
    line-height: 1.4;
}

.history-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 12px;
}

.history-client {
    font-size: 0.85rem;
    color: #093848;
    opacity: 0.5;
}

.history-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
}

/* --- LOGIN --- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
}

.login-wrapper {
    background: #0F0E26;
}

.login-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
    margin: 0 20px;
}

.login-card input {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.login-card input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.login-logo {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
    color: #D6F818;
    font-weight: 800;
}

.login-card h2 {
    color: #ffffff;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.login-card p {
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2rem;
}

.login-card .btn-primary {
    background: #D6F818;
    color: #0F0E26;
}

.login-card .error-msg {
    color: #FF7A00;
}

.full-width {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
}

.error-msg {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 1rem;
    min-height: 1.2em;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    transition: color 0.3s;
    opacity: 0.7;
}

.btn-text:hover {
    color: var(--accent);
    opacity: 1;
    text-decoration: underline;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- FEEDBACK --- */
.feedback-msg {
    font-size: 0.8rem;
    margin-top: 4px;
    min-height: 1.2em;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    color: var(--primary);
    font-weight: 500;
}

.form-group:focus-within .feedback-msg { opacity: 1; }
.feedback-msg.low { color: #e67e22; }
.feedback-msg.good { color: #2ecc71; }

/* --- NOTIFICATIE --- */
#notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 32px;
    border-radius: 12px;
    background: var(--primary); 
    color: white;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    z-index: 9999;
    display: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    min-width: 320px;
    text-align: center;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* --- HEADER & AI TOGGLE --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 30px;
}

.ai-toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 8px 15px;
    border-radius: 50px;
    border: 1px solid var(--card-border);
    flex-shrink: 0;
}

.ai-toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

/* --- SWITCH (gedeeld) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(18px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

body.ai-off .feedback-msg { display: none !important; }

/* --- MODE TOGGLE --- */
.mode-toggle-card {
    padding: 20px 30px;
    margin-bottom: 30px;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
}

.mode-toggle-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.mode-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    opacity: 0.4;
    transition: all 0.3s ease;
    cursor: default;
    white-space: nowrap;
}

.mode-label.active { opacity: 1; }

.mode-switch {
    flex-shrink: 0;
    width: 48px;
    height: 26px;
}

.mode-switch .slider:before { height: 20px; width: 20px; }
.mode-switch input:checked + .slider:before { transform: translateX(22px); }
.mode-switch .slider { background-color: var(--accent); }
.mode-switch input:checked + .slider { background-color: var(--primary); }

.mode-recommendation {
    text-align: center;
    font-size: 0.78rem;
    color: var(--primary);
    opacity: 0.45;
    margin: 12px 0 0 0;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.mode-recommendation em {
    font-style: normal;
    font-weight: 700;
}

#fullStorySection,
.detailed-section {
    animation: fadeInSection 0.3s ease-out;
}

@keyframes fadeInSection {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#fullStory {
    min-height: 200px;
    resize: vertical;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* --- MOBILE HEADER (hamburger) --- */
.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    background: var(--primary);
    z-index: 20;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.mobile-header .brand-logo {
    margin-bottom: 0;
    font-size: 1.2rem;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Overlay achter mobiel menu */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 9;
}

.sidebar-overlay.active {
    display: block;
}

h1, h2, p, label, textarea, input {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ==========================================
   RESPONSIVE: TABLET (< 1024px)
   ========================================== */
@media (max-width: 1024px) {
    .content {
        padding: 60px 40px;
    }
}

/* ==========================================
   RESPONSIVE: MOBIEL (< 768px)
   ========================================== */
@media (max-width: 768px) {

    .mode-toggle-inner {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .mode-label {
        font-size: 0.72rem;
        text-align: center;
    }
    
    .mode-toggle-card {
        padding: 15px 15px;
    }

    .social-selector {
        display: flex;
        flex-wrap: wrap;
        row-gap: 14px;
        column-gap: 12px;
    }
    
    .chip span {
        padding: 8px 18px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    /* --- FIX 1: Mobile header tonen --- */
    .mobile-header {
        display: flex;
    }

    /* --- FIX 2: Sidebar VOLLEDIG verbergen (de "balk" weg) --- */
    .sidebar {
        position: fixed;
        top: 0;
        left: -300px; /* Was -280px, nu ruimer om zeker te zijn */
        width: 260px;
        min-width: 260px;
        height: 100%;
        z-index: 15;
        transition: left 0.3s ease;
        padding-top: 30px;
        visibility: hidden; /* Extra: voorkom dat ie zichtbaar is */
    }

    .sidebar.open {
        left: 0;
        visibility: visible;
    }

    /* --- FIX 3: App container padding-left volledig weg --- */
    .app-container {
        padding-left: 0 !important; /* Force override van desktop padding */
        overflow-x: hidden;
    }

    /* --- FIX 4: Content juiste padding en geen margin-left --- */
    .content {
        margin-left: 0;
        padding: 80px 20px 40px 20px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    /* --- FIX 5: Header h1 VEEL kleiner op mobiel --- */
    .main-header h1 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin: 0;
    }

    .main-header p {
        font-size: 0.9rem;
        line-height: 1.5;
        margin: 4px 0 0 0;
    }

    /* --- FIX 6: Header layout netjes op mobiel --- */
    .main-header {
        flex-direction: column;
        gap: 12px;
        padding: 0; /* Geen extra padding nodig, .content regelt dit */
    }

    .header-info {
        width: 100%;
    }

    /* --- FIX 7: AI toggle links uitgelijnd, compact --- */
    .ai-toggle-container {
        align-self: flex-start;
    }

    /* --- FIX 8: Form grid naar 1 kolom --- */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* --- FIX 9: Kaarten compacter --- */
    .form-card {
        padding: 20px;
    }

    /* --- FIX 10: Mode toggle leesbaar --- */
    .mode-toggle-inner {
        gap: 10px;
    }

    .mode-label {
        font-size: 0.8rem;
    }

    /* --- FIX 11: Modal beter op mobiel --- */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        max-height: 85vh;
    }

    #modalBody {
        padding: 25px;
    }

    /* --- FIX 12: Notificatie responsive --- */
    #notification {
        min-width: auto;
        width: calc(100% - 40px);
        padding: 14px 20px;
        font-size: 0.9rem;
    }

    /* --- FIX 13: Login kleiner op mobiel --- */
    .login-card {
        padding: 2rem;
    }

    .login-logo {
        font-size: 1.5rem;
    }

    /* --- FIX 14: Historie items stapelen --- */
    .history-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .history-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}