/* ========== CSS VARIABELEN ========== */
:root {
    --primary: #4f1c70;
    --primary-light: #6a0dad;
    --accent: #f28284;
    --accent-glow: rgba(242, 130, 132, 0.4);
    --bg-light: #fbf6f3;
    --bg-card: #ffffff;
    --text-dark: #4f1c70;
    --text-muted: #666;
    --border-light: #ece2f3;
    --success-bg: #edf7ef;
    --success-border: #234a2f;
    --error-bg: #ffe9ea;
    --error-border: #b71c1c;
    --error-text: #8c1010;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 999px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --gradient-primary: linear-gradient(135deg, #4f1c70 0%, #7c3aad 50%, #f28284 100%);
    --gradient-accent: linear-gradient(135deg, #f28284 0%, #ff9a9e 100%);
}

/* ========== BASISSTIJL ========== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--bg-light);
    background-image:
        radial-gradient(ellipse at top left, rgba(79, 28, 112, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(242, 130, 132, 0.05) 0%, transparent 50%);
    margin: 0;
    padding: 0;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ========== HEADER ========== */
header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1rem 2rem;
    box-shadow: 0 1px 0 rgba(79, 28, 112, 0.08);
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container img {
    height: 50px;
    max-width: 250px;
    object-fit: contain;
    transition: transform var(--transition-fast);
}

.logo-container img:hover {
    transform: scale(1.02);
}

/* ========== NAVIGATIE ========== */
.nav {
    max-width: 1200px;
    margin: 1rem auto 1.5rem;
    padding: 6px 8px;
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
}

.nav a {
    color: var(--text-dark);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    position: relative;
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 20px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: transform var(--transition-fast);
}

.nav a.active::after,
.nav a:hover::after {
    transform: translateX(-50%) scaleX(1);
}

.nav a.active,
.nav a:hover {
    background: rgba(79, 28, 112, 0.08);
    text-decoration: none;
}

/* ========== MAIN CONTENT ========== */
main {
    flex: 1;
    padding: 2rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    letter-spacing: -0.5px;
}

.subtext {
    text-align: center;
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-top: 0;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.subtext strong {
    color: var(--primary);
    font-weight: 600;
}

.subtext small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ========== UPLOAD KAART ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-normal);
    border: 1px solid rgba(79, 28, 112, 0.05);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.upload-card {
    padding: 2rem;
}

/* ========== FORMULIER ========== */
.form-table {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-table .row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-table label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== FILE UPLOAD ZONE ========== */
.upload-zone {
    position: relative;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    padding: 2.5rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(79, 28, 112, 0.02) 0%, rgba(242, 130, 132, 0.02) 100%);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(79, 28, 112, 0.05) 0%, rgba(242, 130, 132, 0.05) 100%);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.upload-zone.dragover {
    transform: scale(1.01);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.file-name {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(79, 28, 112, 0.08);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--primary);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.file-name.visible {
    display: flex;
}

/* ========== BUTTONS ========== */
.btn {
    background: var(--gradient-primary);
    color: #fff;
    padding: 12px 28px;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 15px rgba(79, 28, 112, 0.3);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(79, 28, 112, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-primary);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--primary);
    border: 2px solid var(--border-light);
    box-shadow: none;
}

.btn-secondary:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(242, 130, 132, 0.2);
}

.row.actions {
    margin-top: 0.5rem;
}

.row.actions .cell {
    display: flex;
    justify-content: center;
}

/* ========== ALERTS ========== */
.alert {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

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

.alert::before {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.danger {
    border-color: var(--error-border);
    background: var(--error-bg);
    color: var(--error-text);
}

.danger::before {
    content: '⚠️';
}

/* ========== RESULTAAT ========== */
.result {
    margin-top: 2rem;
    animation: slideIn 0.4s ease;
}

.result.ok {
    border: none;
    background: linear-gradient(135deg, rgba(35, 74, 47, 0.05) 0%, rgba(35, 74, 47, 0.02) 100%);
    padding: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.result-header {
    background: linear-gradient(135deg, #234a2f 0%, #2d5a3a 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.result-header-icon {
    font-size: 1.5rem;
}

.result-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.result-body {
    padding: 1.5rem;
    background: var(--success-bg);
    border: 1px solid rgba(35, 74, 47, 0.15);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.kv {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.kv li {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(35, 74, 47, 0.1);
}

.kv li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.kv-label {
    font-weight: 600;
    color: #234a2f;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kv-label-icon {
    font-size: 1rem;
}

.kv code {
    user-select: all;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(35, 74, 47, 0.15);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: #1a3620;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.kv code:hover {
    background: white;
    border-color: var(--accent);
}

.kv code.hash {
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.result .actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

/* ========== FOOTER ========== */
footer {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-dark);
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
}

/* ========== THEME TOGGLE ========== */
.theme-toggle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

#toggleTheme {
    background: rgba(79, 28, 112, 0.1);
    color: var(--primary);
    border: 1px solid var(--border-light);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition-normal);
}

#toggleTheme:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== DONKERE MODUS ========== */
.dark-mode {
    --bg-light: #0a0a0a;
    --bg-card: #141414;
    --text-dark: #f1f1f1;
    --text-muted: #a0a0a0;
    --border-light: #2a2a2a;
    --success-bg: #0f1a12;
    --success-border: #2f6a3d;
    --error-bg: #1a0f10;
    --error-border: #7c2d2d;
    --error-text: #f1c2c2;
    color-scheme: dark;
}

.dark-mode body {
    background-image:
        radial-gradient(ellipse at top left, rgba(106, 13, 173, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(242, 130, 132, 0.08) 0%, transparent 50%);
}

.dark-mode header {
    background: rgba(20, 20, 20, 0.8);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dark-mode .nav {
    background: rgba(20, 20, 20, 0.7);
    border-color: var(--border-light);
}

.dark-mode .nav a {
    color: #e0b3ff;
}

.dark-mode .nav a.active,
.dark-mode .nav a:hover {
    background: rgba(242, 130, 132, 0.15);
}

.dark-mode h1 {
    background: linear-gradient(135deg, #e0b3ff 0%, #f28284 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.dark-mode .subtext strong {
    color: #e0b3ff;
}

.dark-mode .card {
    background: var(--bg-card);
    border-color: var(--border-light);
}

.dark-mode .upload-zone {
    border-color: var(--border-light);
    background: linear-gradient(135deg, rgba(106, 13, 173, 0.05) 0%, rgba(242, 130, 132, 0.05) 100%);
}

.dark-mode .upload-zone:hover,
.dark-mode .upload-zone.dragover {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(106, 13, 173, 0.1) 0%, rgba(242, 130, 132, 0.1) 100%);
}

.dark-mode .upload-text {
    color: var(--text-dark);
}

.dark-mode .file-name {
    background: rgba(224, 179, 255, 0.1);
    color: #e0b3ff;
}

.dark-mode .btn {
    box-shadow: 0 4px 15px rgba(106, 13, 173, 0.4);
}

.dark-mode .btn:hover {
    box-shadow: 0 6px 25px rgba(106, 13, 173, 0.5);
}

.dark-mode .btn-secondary {
    background: var(--bg-card);
    color: #e0b3ff;
    border-color: var(--border-light);
}

.dark-mode .result-header {
    background: linear-gradient(135deg, #1a3620 0%, #234a2f 100%);
}

.dark-mode .result-body {
    background: var(--success-bg);
    border-color: rgba(47, 106, 61, 0.3);
}

.dark-mode .kv-label {
    color: #7fbe8a;
}

.dark-mode .kv li {
    border-color: rgba(47, 106, 61, 0.2);
}

.dark-mode .kv code {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(47, 106, 61, 0.3);
    color: #a8d9b0;
}

.dark-mode .kv code:hover {
    background: rgba(0, 0, 0, 0.5);
}

.dark-mode footer {
    background: rgba(20, 20, 20, 0.8);
    border-color: var(--border-light);
}

.dark-mode #toggleTheme {
    background: rgba(224, 179, 255, 0.1);
    color: #e0b3ff;
    border-color: var(--border-light);
}

.dark-mode #toggleTheme:hover {
    background: #e0b3ff;
    color: #0a0a0a;
    border-color: #e0b3ff;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    main {
        padding: 1.5rem 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .subtext {
        font-size: 0.95rem;
    }

    .upload-card {
        padding: 1.5rem;
    }

    .upload-zone {
        padding: 2rem 1.5rem;
    }

    .btn {
        padding: 10px 24px;
        font-size: 0.95rem;
    }

    .theme-toggle {
        position: static;
        transform: none;
        margin-left: auto;
    }

    header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .kv code.hash {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }

    .upload-icon {
        font-size: 2.5rem;
    }

    .upload-zone {
        padding: 1.5rem 1rem;
    }

    .nav {
        padding: 4px 6px;
    }

    .nav a {
        padding: 8px 14px;
        font-size: 0.9rem;
    }
}

/* ========== LOADING STATE ========== */
.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== HELP TIP ========== */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--border-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 11px;
    cursor: help;
    position: relative;
    transition: all var(--transition-fast);
}

.help-tip:hover {
    background: var(--primary);
    color: white;
}

.help-tip:hover::after {
    content: attr(data-tip);
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 400;
    min-width: 220px;
    max-width: 280px;
    z-index: 10;
    white-space: normal;
    line-height: 1.4;
}

.dark-mode .help-tip {
    background: var(--border-light);
    color: #e0b3ff;
}

.dark-mode .help-tip:hover {
    background: #e0b3ff;
    color: var(--bg-card);
}

/* ========== LEGACY SUPPORT ========== */
.hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.timestamp {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Old .ok class fallback - maar we gebruiken nu .result.ok */
.ok:not(.result) {
    margin-top: 1.5rem;
    border: 1px solid var(--success-border);
    background: var(--success-bg);
    padding: 1.25rem;
    border-radius: var(--radius-md);
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay.closing {
    opacity: 0;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-overlay.closing .modal {
    transform: scale(0.9) translateY(20px);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-header {
    background: linear-gradient(135deg, #234a2f 0%, #2d5a3a 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header-icon {
    font-size: 1.75rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
    background: var(--success-bg);
}

.modal-body .kv {
    gap: 0.75rem;
}

.modal-body .kv li {
    padding-bottom: 0.75rem;
}

.modal-body .kv code {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
}

.modal-body .kv code.hash {
    font-size: 0.75rem;
}

.modal-footer {
    padding: 1.25rem 2rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-footer form {
    margin: 0;
}

/* Dark mode modal */
.dark-mode .modal {
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.dark-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.6);
}

.dark-mode .modal-header {
    background: linear-gradient(135deg, #1a3620 0%, #234a2f 100%);
}

.dark-mode .modal-body {
    background: var(--success-bg);
}

.dark-mode .modal-footer {
    border-color: var(--border-light);
}

/* Responsive modal */
@media (max-width: 600px) {
    .modal {
        max-height: 95vh;
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 1.25rem 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 1.25rem 1.5rem;
    }

    .modal-body .kv code.hash {
        font-size: 0.65rem;
    }

    .modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}
