/* =============================================
   Bookmarks App - Stijlen + 6 Thema's
   ============================================= */

/* --- THEMA VARIABELEN --- */

/* 1. Donker (Neon) - standaard */
[data-thema="donker"], :root {
    --bg-gradient: linear-gradient(135deg, #0a0a1a 0%, #0d1b2a 50%, #001a33 100%);
    --header-bg: rgba(0, 0, 0, 0.85);
    --tile-bg: rgba(0, 0, 0, 0.55);
    --tile-hover-bg: rgba(0, 0, 0, 0.8);
    --tile-border: rgba(0, 200, 255, 0.2);
    --tile-hover-border: rgba(0, 200, 255, 0.8);
    --glow: 0 0 18px rgba(0, 200, 255, 0.7);
    --tekst: #ffffff;
    --tekst-zacht: rgba(255,255,255,0.65);
    --accent: #00c8ff;
    --accent2: #7b2ff7;
    --badge-team: #00c8ff;
    --badge-persoonlijk: #7b2ff7;
    --modal-bg: rgba(10, 10, 30, 0.97);
    --input-bg: rgba(255,255,255,0.07);
    --input-border: rgba(255,255,255,0.2);
    --knop-bg: rgba(0, 200, 255, 0.2);
    --knop-hover: rgba(0, 200, 255, 0.4);
    --sidebar-bg: rgba(0,0,0,0.6);
    --scrollbar: #00c8ff;
    --cat-header: rgba(0,200,255,0.12);
}

/* 2. Licht Zakelijk */
[data-thema="zakelijk"] {
    --bg-gradient: linear-gradient(135deg, #f0f4f8 0%, #e8edf2 100%);
    --header-bg: #ffffff;
    --tile-bg: #ffffff;
    --tile-hover-bg: #f8fbff;
    --tile-border: #d0dae5;
    --tile-hover-border: #2563eb;
    --glow: 0 4px 12px rgba(37, 99, 235, 0.2);
    --tekst: #1e293b;
    --tekst-zacht: #64748b;
    --accent: #2563eb;
    --accent2: #7c3aed;
    --badge-team: #2563eb;
    --badge-persoonlijk: #7c3aed;
    --modal-bg: #ffffff;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --knop-bg: #2563eb;
    --knop-hover: #1d4ed8;
    --sidebar-bg: #ffffff;
    --scrollbar: #2563eb;
    --cat-header: #eff6ff;
}

/* 3. Zonsondergang */
[data-thema="zonsondergang"] {
    --bg-gradient: linear-gradient(135deg, #1a0533 0%, #3d0c45 30%, #7a1a2e 60%, #c44b1a 100%);
    --header-bg: rgba(60, 10, 70, 0.9);
    --tile-bg: rgba(30, 5, 50, 0.6);
    --tile-hover-bg: rgba(50, 10, 80, 0.85);
    --tile-border: rgba(255, 120, 50, 0.3);
    --tile-hover-border: rgba(255, 150, 80, 0.9);
    --glow: 0 0 20px rgba(255, 120, 50, 0.6);
    --tekst: #fff0e8;
    --tekst-zacht: rgba(255,220,180,0.65);
    --accent: #ff7832;
    --accent2: #e040fb;
    --badge-team: #ff7832;
    --badge-persoonlijk: #e040fb;
    --modal-bg: rgba(40, 5, 60, 0.97);
    --input-bg: rgba(255,255,255,0.07);
    --input-border: rgba(255,120,50,0.4);
    --knop-bg: rgba(255, 120, 50, 0.25);
    --knop-hover: rgba(255, 120, 50, 0.5);
    --sidebar-bg: rgba(40,5,60,0.75);
    --scrollbar: #ff7832;
    --cat-header: rgba(255,120,50,0.1);
}

/* 4. Bos / Natuur */
[data-thema="natuur"] {
    --bg-gradient: linear-gradient(135deg, #0a1f0e 0%, #122b14 40%, #1a3a1c 100%);
    --header-bg: rgba(10, 30, 12, 0.92);
    --tile-bg: rgba(10, 40, 15, 0.65);
    --tile-hover-bg: rgba(15, 55, 20, 0.88);
    --tile-border: rgba(80, 200, 100, 0.25);
    --tile-hover-border: rgba(100, 230, 120, 0.85);
    --glow: 0 0 18px rgba(80, 200, 100, 0.55);
    --tekst: #e8f5e9;
    --tekst-zacht: rgba(200,240,210,0.65);
    --accent: #50c864;
    --accent2: #a5d6a7;
    --badge-team: #50c864;
    --badge-persoonlijk: #81c784;
    --modal-bg: rgba(8, 25, 10, 0.97);
    --input-bg: rgba(255,255,255,0.06);
    --input-border: rgba(80,200,100,0.35);
    --knop-bg: rgba(80, 200, 100, 0.2);
    --knop-hover: rgba(80, 200, 100, 0.45);
    --sidebar-bg: rgba(10,30,12,0.75);
    --scrollbar: #50c864;
    --cat-header: rgba(80,200,100,0.1);
}

/* 5. Oceaan */
[data-thema="oceaan"] {
    --bg-gradient: linear-gradient(135deg, #001220 0%, #002a4a 40%, #004d7a 70%, #0077b6 100%);
    --header-bg: rgba(0, 18, 40, 0.9);
    --tile-bg: rgba(0, 25, 55, 0.6);
    --tile-hover-bg: rgba(0, 40, 80, 0.85);
    --tile-border: rgba(0, 180, 230, 0.25);
    --tile-hover-border: rgba(0, 220, 255, 0.85);
    --glow: 0 0 20px rgba(0, 180, 230, 0.6);
    --tekst: #e0f7ff;
    --tekst-zacht: rgba(180, 230, 255, 0.65);
    --accent: #00b4e4;
    --accent2: #0077b6;
    --badge-team: #00b4e4;
    --badge-persoonlijk: #48cae4;
    --modal-bg: rgba(0, 15, 35, 0.97);
    --input-bg: rgba(255,255,255,0.06);
    --input-border: rgba(0,180,230,0.35);
    --knop-bg: rgba(0, 180, 230, 0.2);
    --knop-hover: rgba(0, 180, 230, 0.45);
    --sidebar-bg: rgba(0,18,40,0.78);
    --scrollbar: #00b4e4;
    --cat-header: rgba(0,180,230,0.1);
}

/* 6. Minimalistische Grijs */
[data-thema="minimaal"] {
    --bg-gradient: linear-gradient(135deg, #18181b 0%, #27272a 100%);
    --header-bg: #18181b;
    --tile-bg: #27272a;
    --tile-hover-bg: #3f3f46;
    --tile-border: #3f3f46;
    --tile-hover-border: #71717a;
    --glow: 0 4px 12px rgba(0,0,0,0.4);
    --tekst: #fafafa;
    --tekst-zacht: #a1a1aa;
    --accent: #e4e4e7;
    --accent2: #71717a;
    --badge-team: #e4e4e7;
    --badge-persoonlijk: #71717a;
    --modal-bg: #18181b;
    --input-bg: #3f3f46;
    --input-border: #52525b;
    --knop-bg: #3f3f46;
    --knop-hover: #52525b;
    --sidebar-bg: #18181b;
    --scrollbar: #71717a;
    --cat-header: rgba(255,255,255,0.04);
}

/* --- RESET & BASIS --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, Arial, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--tekst);
    display: flex;
    flex-direction: column;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

/* --- LAYOUT --- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: 64px;
}

/* --- TOPBAR --- */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 64px;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--tile-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    z-index: 200;
    box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

.topbar-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    white-space: nowrap;
    text-shadow: var(--glow);
    flex-shrink: 0;
}

.topbar-logo span { color: var(--tekst); font-weight: 300; }

.topbar-search {
    flex: 1;
    max-width: 400px;
}

.topbar-search input {
    width: 100%;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--tekst);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.topbar-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent), 0.1);
}

.topbar-search input::placeholder { color: var(--tekst-zacht); }

.topbar-acties {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--knop-bg);
    color: var(--tekst);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    background: var(--knop-hover);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.btn-primair {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primair:hover { opacity: 0.88; }

.btn-gevaar { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.5); }
.btn-gevaar:hover { background: rgba(239,68,68,0.4); }

.gebruiker-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--tile-border);
    font-size: 13px;
    color: var(--tekst-zacht);
    cursor: pointer;
    position: relative;
}

.gebruiker-info:hover { border-color: var(--accent); }

.avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--tile-border);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

.sidebar-sectie { margin-bottom: 24px; }

.sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--tekst-zacht);
    padding: 0 16px 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    cursor: pointer;
    border-radius: 0;
    font-size: 14px;
    color: var(--tekst-zacht);
    transition: all 0.15s;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-item:hover, .sidebar-item.actief {
    background: var(--cat-header);
    color: var(--tekst);
    border-left-color: var(--accent);
}

.sidebar-item.actief { font-weight: 600; }

.cat-kleur {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sidebar-toevoegen {
    margin: 8px 16px 0;
    padding: 7px 12px;
    font-size: 12px;
}

/* --- HOOFDCONTENT --- */
.hoofdcontent {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

.categorie-sectie { margin-bottom: 36px; }

.categorie-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 16px;
    background: var(--cat-header);
    border-radius: 10px;
    border-left: 4px solid var(--accent);
}

.categorie-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.categorie-header .badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--knop-bg);
    color: var(--tekst-zacht);
}

/* --- TEGELS GRID --- */
.tegels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 120px);
    gap: 16px;
    justify-content: start;
}

.tegel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--tile-bg);
    border: 1px solid var(--tile-border);
    border-radius: 14px;
    padding: 14px 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    position: relative;
    text-decoration: none;
    color: var(--tekst);
    user-select: none;
    -webkit-user-select: none;
}

.tegel:hover {
    transform: translateY(-4px) scale(1.04);
    background: var(--tile-hover-bg);
    border-color: var(--tile-hover-border);
    box-shadow: var(--glow);
}

.tegel img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 8px;
    pointer-events: none;
    border-radius: 8px;
}

.tegel span {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    pointer-events: none;
    word-break: break-word;
    max-width: 100%;
}

.tegel .zichtbaarheid-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-team { background: rgba(0,200,255,0.2); color: var(--badge-team); }
.badge-persoonlijk { background: rgba(123,47,247,0.2); color: var(--badge-persoonlijk); }
.badge-geselecteerd { background: rgba(255,165,0,0.2); color: #ffa500; }

.tegel.dragging { opacity: 0.75; transform: scale(1.08); box-shadow: var(--glow); z-index: 50; }
.tegel.drag-over { border: 2px dashed var(--accent); background: var(--cat-header); }

.tegel .bewerkknop {
    display: none;
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: var(--tekst-zacht);
    border-radius: 6px;
    width: 22px; height: 22px;
    font-size: 11px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.tegel:hover .bewerkknop { display: flex; }

/* --- MODALS --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 500;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.modal-overlay.actief { display: flex; }

.modal {
    background: var(--modal-bg);
    border: 1px solid var(--tile-border);
    border-radius: 16px;
    padding: 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--accent);
}

.form-groep {
    margin-bottom: 16px;
}

.form-groep label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--tekst-zacht);
}

.form-groep input,
.form-groep select,
.form-groep textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--tekst);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-groep input:focus,
.form-groep select:focus,
.form-groep textarea:focus {
    border-color: var(--accent);
}

.form-groep select option { background: #1a1a2e; color: #fff; }
[data-thema="zakelijk"] .form-groep select option { background: #fff; color: #1e293b; }
[data-thema="minimaal"] .form-groep select option { background: #27272a; color: #fafafa; }

.afbeelding-preview {
    display: none;
    margin-top: 8px;
    align-items: center;
    gap: 10px;
}

.afbeelding-preview img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--tile-border);
}

.afbeelding-preview.zichtbaar { display: flex; }

.toegang-gebruikers {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-bg);
}

.toegang-gebruikers.zichtbaar { display: flex; }

.toegang-gebruikers label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--tekst);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--knop-bg);
}

.modal-knoppen {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* --- CONTEXTMENU --- */
.contextmenu {
    display: none;
    position: fixed;
    background: var(--modal-bg);
    border: 1px solid var(--tile-border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    z-index: 600;
    min-width: 160px;
    overflow: hidden;
}

.contextmenu.zichtbaar { display: block; }

.contextmenu ul { list-style: none; }

.contextmenu li {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.contextmenu li:hover { background: var(--cat-header); color: var(--accent); }
.contextmenu li.gevaar:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
.contextmenu hr { border: none; border-top: 1px solid var(--tile-border); margin: 4px 0; }

/* --- LOGIN PAGINA --- */
.login-wrapper {
    min-height: 100vh;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--modal-bg);
    border: 1px solid var(--tile-border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-box h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin-bottom: 8px;
    text-shadow: var(--glow);
}

.login-box p {
    text-align: center;
    color: var(--tekst-zacht);
    font-size: 14px;
    margin-bottom: 28px;
}

.foutmelding {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.4);
    color: #ef4444;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.succesbericht {
    background: rgba(34,197,94,0.15);
    border: 1px solid rgba(34,197,94,0.4);
    color: #22c55e;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* --- THEMA KIEZER --- */
.thema-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.thema-optie {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.thema-optie:hover, .thema-optie.actief { border-color: var(--accent); }

.thema-preview {
    height: 50px;
    border-radius: 8px 8px 0 0;
}

.thema-naam {
    text-align: center;
    font-size: 11px;
    padding: 5px;
    background: var(--input-bg);
    color: var(--tekst-zacht);
}

/* --- LEGE STAAT --- */
.leeg-staat {
    text-align: center;
    padding: 60px 20px;
    color: var(--tekst-zacht);
}

.leeg-staat .icoon { font-size: 48px; margin-bottom: 12px; }
.leeg-staat h3 { font-size: 18px; margin-bottom: 8px; color: var(--tekst); }
.leeg-staat p { font-size: 14px; margin-bottom: 20px; }

/* --- TOAST NOTIFICATIES --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.toast.succes { background: rgba(34,197,94,0.9); color: #fff; }
.toast.fout { background: rgba(239,68,68,0.9); color: #fff; }
.toast.info { background: rgba(59,130,246,0.9); color: #fff; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .topbar-logo span { display: none; }
    
    .tegels-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .tegel img { width: 44px; height: 44px; }
    .tegel span { font-size: 11px; }
    .hoofdcontent { padding: 16px; }
}

@media (max-width: 480px) {
    .topbar { padding: 0 12px; gap: 10px; }
    .topbar-search { display: none; }
}

/* --- TEGEL NOTITIE INDICATOR --- */
.tegel-notitie {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-size: 10px;
    opacity: 0.6;
    pointer-events: none;
}
