/*
 * main.css – Gedeelde basisstijlen
 * Ticketsysteem – versie v0.1
 *
 * Aanpassen: pas de CSS-variabelen in :root aan
 * voor kleuren en andere basiswaarden.
 * ─────────────────────────────────────────────
 */

/* ── CSS variabelen (aanpasbaar) ─────────────────────────── */
:root {
    --color-primary:        #4f6ef7;
    --color-primary-dark:   #3a59e8;
    --color-primary-light:  #eef1fe;

    --color-nieuw:          #2563eb;
    --color-behandeling:    #d97706;
    --color-wacht:          #7c3aed;
    --color-planning:       #0891b2;
    --color-opgelost:       #059669;
    --color-gesloten:       #6b7280;

    --color-bug:            #dc2626;
    --color-vraag:          #2563eb;
    --color-hosting:        #7c3aed;
    --color-klein:          #d97706;

    --color-bg:             #f4f6fb;
    --color-card:           #ffffff;
    --color-border:         #e5e7eb;
    --color-text:           #1e2432;
    --color-text-muted:     #6b7280;
    --color-text-light:     #9ca3af;

    --color-success-bg:     #d1fae5;
    --color-success-text:   #065f46;
    --color-error-bg:       #fee2e2;
    --color-error-text:     #991b1b;
    --color-warning-bg:     #fef3c7;
    --color-warning-text:   #92400e;
    --color-info-bg:        #dbeafe;
    --color-info-text:      #1e40af;

    --color-topbar-bg:      #1e2432;
    --color-topbar-text:    #c9d0e6;

    --font-base:            'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:            'JetBrains Mono', 'Fira Code', monospace;

    --radius-sm:            5px;
    --radius:               8px;
    --radius-lg:            12px;
    --shadow-sm:            0 1px 3px rgba(0,0,0,.07);
    --shadow:               0 2px 8px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
    --shadow-lg:            0 8px 32px rgba(0,0,0,.12);

    --topbar-height:        52px;
}

/* ── Reset & basis ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-base);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ── Typografie ───────────────────────────────────────────── */
h1 { font-size: 1.5rem;  font-weight: 800; line-height: 1.3; }
h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1.1rem; }
h3 { font-size: 1rem;    font-weight: 700; margin-bottom: .75rem; }

.text-sm     { font-size: .85rem; }
.text-muted  { color: var(--color-text-muted); }
.text-center { text-align: center; }

/* ── Hulpklassen ──────────────────────────────────────────── */
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-0  { margin-bottom: 0; }
.flex  { display: flex; }
.flex-1 { flex: 1; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Layout ───────────────────────────────────────────────── */
.page-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.page-wide {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
    background: var(--color-topbar-bg);
    color: #fff;
    height: var(--topbar-height);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

.topbar-brand {
    font-weight: 800;
    font-size: 1.05rem;
    color: #fff;
    white-space: nowrap;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
    padding-left: 2rem;
}

.topbar-nav a { color: var(--color-topbar-text); font-size: .875rem; white-space: nowrap; }
.topbar-nav a:hover,
.topbar-nav a.active { color: #fff; text-decoration: none; }
.topbar-nav a.active { font-weight: 600; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .8rem;
    color: var(--color-topbar-text);
    white-space: nowrap;
}

.topbar-user a { color: var(--color-topbar-text); }
.topbar-user a:hover { color: #fff; text-decoration: none; }

.topbar-role {
    background: rgba(255,255,255,.1);
    padding: .1rem .45rem;
    border-radius: 999px;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.btn-nav-cta {
    background: var(--color-primary);
    color: #fff !important;
    padding: .3rem .8rem;
    border-radius: var(--radius-sm);
    font-size: .8rem !important;
    font-weight: 600;
}
.btn-nav-cta:hover,
.btn-nav-cta.active { background: var(--color-primary-dark); text-decoration: none !important; color: #fff !important; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.card.card-sm { padding: 1.1rem; }
.card.p-0 { padding: 0; overflow: hidden; }

/* ── Formulieren ──────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

.form-group label,
label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .4rem;
}

.label-sm {
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
    display: block;
    margin-bottom: .35rem;
}

.required { color: #ef4444; }
.optional  { color: var(--color-text-muted); font-weight: 400; font-size: .8em; }

.form-group input:not([type="radio"]):not([type="checkbox"]),
.form-group select,
.form-group textarea,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: .55rem .85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .9rem;
    color: var(--color-text);
    background: #fff;
    font-family: var(--font-base);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.form-group input:not([type="radio"]):not([type="checkbox"]):focus,
.form-group select:focus,
.form-group textarea:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79,110,247,.12);
}

.form-group textarea,
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }

.input-disabled {
    background: #f9fafb !important;
    color: var(--color-text-muted) !important;
    cursor: not-allowed;
}

.form-hint { font-size: .78rem; color: var(--color-text-muted); margin-top: .35rem; }
.char-count { font-size: .75rem; color: var(--color-text-light); margin-top: .3rem; text-align: right; }
.w-full { width: 100%; }

/* ── Knoppen ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.15rem;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .08s;
    text-decoration: none;
    font-family: var(--font-base);
    line-height: 1;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; }

.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger  { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover { background: #f9fafb; color: var(--color-text); }

.btn-sm   { padding: .35rem .75rem; font-size: .8rem; }
.btn-full { width: 100%; }

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: .85rem;
    cursor: pointer;
    padding: 0;
    font-family: var(--font-base);
    text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .85rem;
    color: var(--color-text-muted);
    padding: .2rem .3rem;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.btn-icon:hover { color: #ef4444; background: #fee2e2; }

.btn-group { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1.1rem;
    font-size: .9rem;
    line-height: 1.5;
}

.alert-success { background: var(--color-success-bg); color: var(--color-success-text); }
.alert-error   { background: var(--color-error-bg);   color: var(--color-error-text); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.alert-info    { background: var(--color-info-bg);    color: var(--color-info-text); }

.update-banner {
    display: flex;
    align-items: center;
    margin-bottom: 1.25rem;
}

/* ── Badges: status ───────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.status-nieuw       { background: #dbeafe; color: var(--color-nieuw); }
.status-behandeling { background: #fef3c7; color: var(--color-behandeling); }
.status-wacht       { background: #ede9fe; color: var(--color-wacht); }
.status-planning    { background: #cffafe; color: var(--color-planning); }
.status-opgelost    { background: #d1fae5; color: var(--color-opgelost); }
.status-gesloten    { background: #f3f4f6; color: var(--color-gesloten); }

/* ── Badges: type ─────────────────────────────────────────── */
.type-badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: var(--radius-sm);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.type-bug     { background: #fee2e2; color: var(--color-bug); }
.type-vraag   { background: #dbeafe; color: var(--color-vraag); }
.type-hosting { background: #ede9fe; color: var(--color-hosting); }
.type-klein   { background: #fef3c7; color: var(--color-klein); }

/* ── Badges: prioriteit ───────────────────────────────────── */
.priority-badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: var(--radius-sm);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.priority-laag    { background: #f3f4f6; color: #374151; }
.priority-medium  { background: #fef3c7; color: #92400e; }
.priority-hoog    { background: #fee2e2; color: #991b1b; }
.priority-kritiek { background: #991b1b; color: #fff; }

/* ── Tickettabel ──────────────────────────────────────────── */
.ticket-table { width: 100%; border-collapse: collapse; }

.ticket-table th {
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-muted);
    padding: .65rem .85rem;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.ticket-table td {
    padding: .75rem .85rem;
    font-size: .875rem;
    border-bottom: 1px solid #f9fafb;
    vertical-align: middle;
}

.ticket-table tbody tr:hover td { background: var(--color-primary-light); }
.ticket-table tbody tr:last-child td { border-bottom: none; }

.ticket-code {
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.ticket-subject a { font-weight: 600; color: var(--color-text); }
.ticket-subject a:hover { color: var(--color-primary); text-decoration: none; }
.ticket-meta { font-size: .75rem; color: var(--color-text-light); margin-top: .1rem; }

/* ── Paginering ───────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: .4rem;
    justify-content: center;
    padding: 1rem;
    border-top: 1px solid var(--color-border);
}

.pagination a,
.pagination span {
    padding: .4rem .8rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
}

.pagination a:hover { background: var(--color-primary-light); text-decoration: none; }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ── Filterbar ────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: .65rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.1rem;
}

.filter-bar input[type="text"],
.filter-bar select {
    padding: .45rem .75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .875rem;
    background: #fff;
    width: auto;
}

.filter-bar input[type="text"] { flex: 1; min-width: 180px; }

/* ── Checkbox & radio ─────────────────────────────────────── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .875rem;
    font-weight: 400;
    cursor: pointer;
}

/* Stijl hier je radiobuttons naar wens */
.radiobutton {
}

/* Stijl hier je checkboxes naar wens */
.checkbox {
}

.checkbox-group { display: flex; flex-wrap: wrap; gap: 1rem; }

/* ── Iconen ────────────────────────────────────────────────── */
/* Zet display: inline om iconen zichtbaar te maken */
.icon {
    display: none;
}

/* ── Code badge ───────────────────────────────────────────── */
.code-badge {
    font-family: var(--font-mono);
    background: #f3f4f6;
    padding: .25rem .6rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    color: #374151;
    font-weight: 600;
    letter-spacing: .05em;
}

/* ── Thread / replies ─────────────────────────────────────── */
.reply {
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    margin-bottom: .85rem;
    border-left: 3px solid var(--color-border);
    background: #f8f9ff;
    box-shadow: var(--shadow);
}

.reply-agent    { border-left-color: var(--color-primary); background: #f8f9ff; }
.reply-client   { border-left-color: #10b981; background: #f0fdf4; }
.reply-internal { border-left-color: #f59e0b; background: #fffbeb; }

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
    flex-wrap: wrap;
    gap: .25rem;
}

.reply-author  { font-size: .875rem; font-weight: 600; }
.reply-time    { font-size: .75rem; color: var(--color-text-muted); }
.reply-body    { font-size: .875rem; white-space: pre-wrap; line-height: 1.6; }

.edited-tag {
    font-size: .7rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.reply-actions {
    margin-top: .5rem;
    display: flex;
    gap: .75rem;
}

.reply-edit-btn  { font-size: .75rem; color: var(--color-primary); }
.reply-delete-btn { font-size: .75rem; color: #ef4444; }
.reply-delete-btn:hover { color: #b91c1c; }

.reply-edit-form { margin-top: .75rem; }
.reply-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: .5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .875rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}
.reply-edit-buttons { margin-top: .5rem; display: flex; gap: .5rem; }

.internal-tag {
    font-size: .7rem;
    background: #fef3c7;
    color: #92400e;
    padding: .1rem .4rem;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-left: .35rem;
}

/* ── Bijlagen ─────────────────────────────────────────────── */
.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    margin-top: .85rem;
}

.attachment-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--color-border);
    transition: border-color .15s, transform .15s;
    text-decoration: none;
}

.attachment-thumb:hover { border-color: var(--color-primary); transform: scale(1.03); text-decoration: none; }

.attachment-thumb img {
    width: 90px;
    height: 70px;
    object-fit: cover;
    display: block;
}

.attachment-name {
    font-size: .7rem;
    color: var(--color-text-muted);
    padding: .2rem .4rem;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Upload veld ──────────────────────────────────────────── */
.upload-area {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: #fafafa;
}

.upload-area:hover,
.upload-area.dragover { border-color: var(--color-primary); background: var(--color-primary-light); }

.upload-placeholder { font-size: .875rem; color: var(--color-text-muted); pointer-events: none; }

.upload-input {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    opacity: 0;
    cursor: pointer;
    min-height: auto !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.upload-preview { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: .75rem; }

.preview-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--color-border);
}

.preview-item img { width: 80px; height: 60px; object-fit: cover; display: block; }

.preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Device info ──────────────────────────────────────────── */
.device-info-block { border-top: 1px solid var(--color-border); padding-top: .85rem; }
.device-update-link { font-size: .78rem; color: var(--color-text-muted); }

.device-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .4rem;
    margin-top: .5rem;
}

.device-info-item {
    display: flex;
    gap: .5rem;
    font-size: .8rem;
    padding: .3rem .5rem;
    background: #f8f9ff;
    border-radius: var(--radius-sm);
}

.device-key { font-weight: 600; color: var(--color-text-muted); min-width: 130px; flex-shrink: 0; }
.device-val { color: var(--color-text); word-break: break-all; }

/* ── Ticket detail: header ────────────────────────────────── */
.ticket-header { margin-bottom: 1.1rem; }

.ticket-header-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .75rem;
}

.ticket-title  { font-size: 1.3rem; font-weight: 800; line-height: 1.35; margin-bottom: .35rem; }
.ticket-dates  { font-size: .8rem; color: var(--color-text-muted); }
.ticket-url    { font-size: .875rem; margin-bottom: .75rem; }

.ticket-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.info-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-light); margin-bottom: .15rem; }
.info-val   { font-size: .9rem; }

.message-body {
    font-size: .9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    padding: 1rem;
    background: #f8f9ff;
    border-radius: var(--radius);
    border-left: 3px solid var(--color-primary);
}

/* ── Urenindicatie (leesweergave klant) ───────────────────── */
.hours-estimate-display {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .85rem;
    background: #f0fdf4;
    border-left: 3px solid var(--color-opgelost);
    border-radius: var(--radius);
    font-size: .875rem;
}

.hours-estimate-value {
    font-weight: 600;
    color: var(--color-opgelost);
}

/* ── Lege staat ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--color-text-muted);
}

.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-box h3 { margin-bottom: 1rem; }

/* ── Lightbox ─────────────────────────────────────────────── */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.lightbox-img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: var(--radius);
    box-shadow: 0 8px 48px rgba(0,0,0,.6);
    object-fit: contain;
}

.lightbox-close {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    color: #fff;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    opacity: .7;
}
.lightbox-close:hover { opacity: 1; }

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: .5rem .85rem;
    border-radius: var(--radius);
    transition: background .15s;
}
.lightbox-nav:hover { background: rgba(255,255,255,.3); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .page-wide  { padding: 1rem; }
    .topbar-nav { display: none; }
    .ticket-table th:nth-child(n+5),
    .ticket-table td:nth-child(n+5) { display: none; }
}

/* ── Klikbare tabelrij ────────────────────────────────────── */
.row-clickable { cursor: pointer; }
.row-clickable:hover td { background: var(--color-primary-light); }
