/* Glassmorphism Dynamic Variables */
:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(15, 23, 42, 0.6);
    --text: #f8fafc;
    --text-sub: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0284c7;
    --danger: #ef4444;
    --success: #22c55e;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

[data-theme="light"] {
    --bg-gradient: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 50%, #e2e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.65);
    --card-border: rgba(255, 255, 255, 0.4);
    --input-bg: rgba(255, 255, 255, 0.8);
    --text: #0f172a;
    --text-sub: #64748b;
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --danger: #dc2626;
    --success: #16a34a;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    margin: 0;
    padding: 2rem;
    min-height: 100vh;
    box-sizing: border-box;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Glass Card Component */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

h1, h2, h3 { margin: 0 0 10px 0; }

/* Grid Layout voor Top Controls */
.top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Form Controls */
.upload-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.full-width { grid-column: span 2; }

input, select, textarea {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
    outline: none;
    transition: border 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
}

/* --- FILE CONTAINER: COMPACT LIST MODE (DESKTOP) --- */
.file-container.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.file-list .file-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.file-list .file-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.file-list .file-info > div {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    flex-wrap: nowrap;
}

.file-list h3 {
    font-size: 0.9rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.file-list small {
    font-size: 0.8rem;
    white-space: nowrap;
}

.file-list p {
    font-size: 0.8rem !important;
    margin: 0 !important;
    padding: 2px 8px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.file-list .file-actions {
    display: flex;
    gap: 6px;
    margin-top: 0;
    flex-shrink: 0;
}

.file-list .btn {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Badges / Chips */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.badge-printer {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--card-border);
    color: var(--text);
}

/* Buttons General */
.btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.85rem;
    transition: background 0.2s, opacity 0.2s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: #fff; width: 100%; padding: 10px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-toggle { background: transparent; border: 1px solid var(--card-border); color: var(--text); }
.btn-toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 1.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 750px;
}

#viewer-container {
    width: 100%;
    height: 400px;
    background: rgba(0, 0, 0, 0.3);
    margin-top: 1rem;
    border-radius: 12px;
}

/* --- MOBIELE OPTIMALISATIES (< 768px) --- */
@media (max-width: 768px) {
    body {
        padding: 0.8rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        border-top: 1px solid var(--card-border);
        padding-top: 0.8rem;
    }

    .top-grid {
        grid-template-columns: 1fr;
    }

    .upload-form {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: span 1;
    }

    .file-list .file-card {
        flex-direction: column;
        align-items: stretch;
        padding: 0.8rem 1rem;
        gap: 0.6rem;
    }

    .file-list .file-info > div {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .file-list h3 {
        max-width: 100%;
        white-space: normal;
        font-size: 0.95rem;
        word-break: break-word;
    }

    .file-list p {
        max-width: 100%;
        white-space: normal;
        width: 100%;
        box-sizing: border-box;
    }

    .file-list .file-actions {
        width: 100%;
        justify-content: flex-end;
        border-top: 1px solid var(--card-border);
        padding-top: 0.6rem;
        margin-top: 0.2rem;
    }

    .file-list .btn {
        padding: 6px 12px;
        font-size: 0.82rem;
    }
}

/* Badges voor bestandstypes */
.badge-stl { background: #0284c7; color: #fff; }
.badge-3mf { background: #16a34a; color: #fff; }
.badge-zip, .badge-rar { background: #d97706; color: #fff; }
.badge-step, .badge-stp { background: #9333ea; color: #fff; }

/* Dynamische categorie-badge voor licht en donker */
.badge-cat { 
    background: var(--input-bg); 
    color: var(--text); 
    border: 1px solid var(--card-border); 
}

/* Progress bar & Upload inputs */
.progress-bar-container { width: 100%; background: #333; height: 12px; border-radius: 6px; overflow: hidden; margin-top: 10px; display: none; }
.progress-bar { width: 0%; height: 100%; background: #38bdf8; transition: width 0.2s; }
.file-input-group { display: flex; gap: 8px; margin-bottom: 6px; align-items: center; }

/* Maak de tekst van primaire/download knoppen in het donkere thema donker */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-success,
[data-theme="dark"] a.btn-primary {
    color: #0f172a; /* Dezelfde diepe donkere kleur als je achtergrond/tekst */
}

/* Zorg dat de custom file upload knop mooi aansluit */
.file-input-group label {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-input-group label:hover {
    border-color: var(--accent);
}
