/* kleurvariabelen voor consistente aanpassing */
:root {
    --mfu-primary: #0057d9;    /* toegankelijke blauwtonen */
    --mfu-accent:  #007a3d;    /* upload knop (groen) */
    --mfu-danger:  #d93025;    /* verwijderknop (rood) */
    --mfu-on-primary: #ffffff;
    --mfu-text: #202124;
}

/* Loader overlay */
#mfu-loader.mfu-loader {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
    flex-direction: column;
}

/* Spinner */
.mfu-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(255,255,255,0.18);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: mfu-spin 1s linear infinite;
    margin-bottom: 14px;
}

/* Progress wrapper */
.mfu-progress-wrap {
    width: min(680px, 100%);
    max-width: 680px;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Bar background & fill */
.mfu-bar-bg {
    flex: 1;
    height: 12px;
    background: rgba(255,255,255,0.12);
    border-radius: 999px;
    overflow: hidden;
}
.mfu-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%);
    transition: width 180ms linear;
}

/* Percent text */
.mfu-percent-text {
    min-width: 46px;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    text-align: right;
}

/* Form toolbar (file input + upload button) */
#uploadForm {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 0 auto 10px;
    justify-content: center; /* toegevoegd: centreert de inhoud horizontaal */
    max-width: 920px;        /* optioneel: houd toolbar netjes binnen een breedte */
}
#uploadForm #fileInput {
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}
#uploadForm button[type="submit"] {
    background: linear-gradient(90deg,#4facfe,#00f2fe);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform .06s ease, box-shadow .06s ease;
}
#uploadForm button[type="submit"]:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,0.12); }
#uploadForm button[type="submit"]:focus { outline: 3px solid rgba(79,172,254,0.18); outline-offset: 3px; }

/* Thumbnails / preview grid */
#preview {
    margin: 12px auto;
    max-width: 920px;           /* past bij toolbar */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    align-items: start;
    justify-items: center;      /* centreert inhoud binnen elke grid-cell */
    justify-content: center;    /* centreert de hele grid bij vrije ruimte */
}

/* Thumbnail card */
.mfu-thumb-wrap {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 170px;
    position: relative; /* voor overlay-knop */
}

/* image area */
.mfu-thumb {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
    background: linear-gradient(180deg,#f0f0f0,#e8e8e8);
}

/* Remove button: ronde overlay (boven rechts) */
.mfu-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0,0,0,0.18);
    transition: transform .08s ease, background .08s ease;
}
.mfu-remove-btn:hover { transform: translateY(-2px); background: rgba(255,77,79,0.95); }
.mfu-remove-btn:focus { outline: 3px solid rgba(79,172,254,0.22); outline-offset: 2px; }

/* controls/progress area inside thumbnail (verschoven omlaag zodat overlay niet overlapt progress) */
.mfu-thumb-wrap > progress {
    width: calc(100% - 16px);
    margin: 8px;
    margin-top: 12px; /* iets ruimte onder overlay */
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: rgba(0,0,0,0.05);
    border-radius: 6px;
    overflow: hidden;
}
.mfu-thumb-wrap > progress::-webkit-progress-bar {
    background: transparent;
}
.mfu-thumb-wrap > progress::-webkit-progress-value {
    background: linear-gradient(90deg,#4facfe,#00f2fe);
    border-radius: 6px;
}
.mfu-thumb-wrap > progress::-moz-progress-bar {
    background: linear-gradient(90deg,#4facfe,#00f2fe);
    border-radius: 6px;
}

/* Hidden native input (still accessible) */
.mfu-file-input-hidden {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* custom file button - groter en hoog contrast */
.mfu-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--mfu-primary);
    color: var(--mfu-on-primary);
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    min-height: 44px; /* touch-target */
    min-width: 160px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    transition: transform .08s ease, box-shadow .08s ease, filter .08s ease;
    border: 2px solid rgba(0,0,0,0.05);
    user-select: none;
}
.mfu-file-btn svg { width:18px; height:18px; color: var(--mfu-on-primary); }
.mfu-file-btn:hover { transform: translateY(-2px); filter: brightness(1.03); box-shadow: 0 10px 24px rgba(0,0,0,0.14); }
.mfu-file-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(0,87,217,0.14); }

/* file count - duidelijker en contrasterend */
.mfu-file-count {
    font-size: 14px;
    color: var(--mfu-text);
    min-width: 140px;
    text-align: left;
}

/* upload button - helder groen, duidelijk call-to-action */
#mfuUploadBtn {
    background: linear-gradient(180deg, var(--mfu-accent), #006233);
    color: var(--mfu-on-primary);
    border: none;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 15px;
    min-height: 44px;
    min-width: 120px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0,122,61,0.12);
    transition: transform .06s, box-shadow .06s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#mfuUploadBtn[disabled] {
    opacity: 0.48;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: grayscale(0.05);
}
#mfuUploadBtn:not([disabled]):hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0,122,61,0.14); }
#mfuUploadBtn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(0,122,61,0.12); }

/* verwijderknop overlay - grotere touch target en duidelijk rood */
.mfu-remove-btn {
    width: 40px;
    height: 40px;
    top: 10px;
    right: 10px;
    background: var(--mfu-danger);
    color: var(--mfu-on-primary);
    border-radius: 50%;
    font-size: 16px;
    box-shadow: 0 8px 20px rgba(217,48,37,0.12);
    transition: transform .08s ease, background .08s ease;
}
.mfu-remove-btn:hover { transform: translateY(-2px); background: #b8271a; }
.mfu-remove-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(217,48,37,0.12); }

/* mobile: maak knoppen full-width als stacked */
@media (max-width:520px) {
    .mfu-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
    .mfu-file-btn, #mfuUploadBtn { width: 100%; min-width: 0; justify-content: center; }
    .mfu-file-count { text-align: center; width:100%; }
}

/* small screens: compact */
@media (max-width: 480px) {
    .mfu-progress-wrap { width: calc(100% - 32px); padding: 8px; }
    .mfu-spinner { width: 40px; height: 40px; margin-bottom: 10px; }
    .mfu-thumb-wrap { height: 150px; }
    .mfu-thumb { height: 95px; }
}

/* Keyframes */
@keyframes mfu-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}