/* CMR Digitaal - Stylesheet */

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

body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    background: #e8e8e8;
    color: #222;
}

a { color: #0056b3; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth pagina's ────────────────────────────────────────────── */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f0f0f0;
}

.auth-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.12);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}
.auth-logo h1 {
    font-size: 24px;
    color: #1a4a8a;
    margin-bottom: 4px;
}
.auth-logo p {
    color: #666;
    font-size: 13px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: #555;
}
.auth-links span { margin: 0 6px; }

/* ── Formulierelementen ───────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1a4a8a;
    box-shadow: 0 0 0 2px rgba(26,74,138,0.12);
}

/* ── Knoppen ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary   { background: #1a4a8a; color: #fff; }
.btn-primary:hover   { background: #143d72; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #545b62; color: #fff; }
.btn-success   { background: #28a745; color: #fff; }
.btn-success:hover   { background: #1e7e34; color: #fff; }
.btn-danger    { background: #dc3545; color: #fff; }
.btn-danger:hover    { background: #bd2130; color: #fff; }
.btn-warning   { background: #ffc107; color: #212529; }
.btn-outline   { background: transparent; border: 1px solid #1a4a8a; color: #1a4a8a; }
.btn-sm        { padding: 5px 10px; font-size: 12px; }
.btn-block     { width: 100%; justify-content: center; margin-top: 8px; }

/* ── Meldingen ────────────────────────────────────────────────── */
.alert {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Navigatiebalk (bovenaan formulierpagina) ─────────────────── */
#topbar {
    background: #1a4a8a;
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
#topbar-inner {
    width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    flex-wrap: wrap;
}
#topbar .btn {
    font-size: 13px;
    padding: 7px 14px;
}
#topbar .btn-primary { background: #28a745; }
#topbar .btn-primary:hover { background: #1e7e34; }
#topbar .spacer { flex: 1; }

/* Taalwisselaar */
#lang-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
#lang-selector label { color: #ccc; white-space: nowrap; }
#lang-selector select {
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #5580b8;
    background: #2560a8;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

/* PDF opties dropdown */
#pdf-options {
    position: relative;
    display: inline-block;
}
#pdf-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 200;
}
#pdf-dropdown.open { display: block; }
#pdf-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}
#pdf-dropdown button:hover { background: #f0f4fa; }

/* Gebruikersmenu */
#user-menu {
    display: flex;
    align-items: center;
    gap: 6px;
}
#user-menu a, #user-menu button {
    color: #ccc;
    font-size: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    text-decoration: none;
}
#user-menu a:hover, #user-menu button:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* ── CMR Canvas ───────────────────────────────────────────────── */
#cmr-wrap {
    display: flex;
    justify-content: center;
    padding: 20px 0 40px;
}

#cmr-sheet {
    position: relative;
    width: 1000px;
    flex-shrink: 0;
}

#cmr-sheet img.cmr-bg {
    display: block;
    width: 1000px;
    height: auto;
    user-select: none;
}

/* CMR veldcontainer (absoluut gepositioneerd op canvas) */
.cmr-field-wrap {
    position: absolute;
}

.cmr-field-wrap textarea,
.cmr-field-wrap input[type="date"],
.cmr-field-wrap input[type="text"] {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: 1px dashed rgba(255,0,0,0.3);
    border-radius: 0;
    padding: 1px 2px;
    font-family: Arial, Helvetica, sans-serif;
    color: #111;
    resize: none;
    overflow: hidden;
    line-height: 1.25;
    transition: border-color 0.1s, background 0.1s;
}

.cmr-field-wrap textarea:focus,
.cmr-field-wrap input:focus {
    outline: none;
    border-color: rgba(26,74,138,0.6);
    background: rgba(26,74,138,0.04);
}

/* Datum-velden */
.cmr-field-wrap input[type="date"] {
    font-size: 10px;
    padding: 0 2px;
}

/* Placeholder-stijl (hulptekst in velden) */
.cmr-field-wrap textarea::placeholder,
.cmr-field-wrap input::placeholder {
    color: rgba(0,0,0,0.55);
    font-style: italic;
}

/* Adrespicker-knop */
.addr-pick-btn {
    position: absolute;
    right: 2px;
    top: 2px;
    z-index: 10;
    width: 18px;
    height: 18px;
    padding: 0;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.cmr-field-wrap:hover .addr-pick-btn,
.addr-pick-btn:focus {
    opacity: 1;
}

/* ── Adrespicker Modal ────────────────────────────────────────── */
.addr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.addr-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    width: 480px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.addr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.addr-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1a4a8a;
    font-weight: 600;
}
.addr-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #888;
    padding: 2px 7px;
    border-radius: 4px;
    line-height: 1;
}
.addr-modal-close:hover { color: #333; background: #f0f0f0; }

.addr-modal-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.addr-modal-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 12px;
    flex-shrink: 0;
}
.addr-modal-input:focus {
    outline: none;
    border-color: #1a4a8a;
    box-shadow: 0 0 0 2px rgba(26,74,138,0.12);
}

.addr-modal-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 160px;
    max-height: 360px;
}
.addr-modal-list li {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    border-bottom: 1px solid #f0f0f0;
}
.addr-modal-list li:last-child { border-bottom: none; }
.addr-modal-list li:hover { background: #f0f4fa; }
.addr-modal-list li strong { display: block; font-size: 14px; color: #222; }
.addr-modal-list li small { color: #666; }
.addr-modal-list li.addr-picker-loading,
.addr-modal-list li.addr-picker-empty {
    color: #888;
    cursor: default;
    font-style: italic;
    padding: 16px 12px;
}

/* ── Gebruikerspagina's (profiel, templates, instellingen) ─────── */
.page-wrap {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
}

.page-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 30px;
    margin-bottom: 24px;
}

.page-card h2 {
    font-size: 20px;
    color: #1a4a8a;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

/* Tabel */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: #f0f4fa;
    padding: 9px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dde;
}
.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}
.data-table tr:hover td { background: #f8f9ff; }

.data-table input[type="number"],
.data-table input[type="text"] {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
}

/* Breadcrumb navigatie */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
    margin-bottom: 20px;
}
.breadcrumb a { color: #1a4a8a; }
.breadcrumb span { color: #aaa; }

/* Actieknoppen rij */
.action-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Info-grid (profiel: label/waarde rijen) */
.info-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
    font-size: 14px;
    margin-bottom: 16px;
}
.info-grid > div:nth-child(odd) { color: #666; }

/* Link-lijst (snelkoppelingen) */
.link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Badge (bijv. "admin") */
.badge {
    display: inline-block;
    background: #1a4a8a;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Hulptekst */
.text-muted { color: #888; font-size: 13px; }

/* ── Goederenknop op CMR canvas ───────────────────────────────── */
#goods-area-btn {
    position: absolute;
    left: 85px;
    top: 522px;
    width: 825px;
    height: 390px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
}

#btn-goods {
    background: rgba(26,74,138,0.08);
    border: 2px dashed rgba(26,74,138,0.35);
    border-radius: 6px;
    color: #1a4a8a;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    padding: 18px 32px;
    cursor: pointer;
    text-align: center;
    line-height: 1.5;
    transition: background 0.15s, border-color 0.15s;
    min-width: 220px;
}
#btn-goods:hover {
    background: rgba(26,74,138,0.15);
    border-color: rgba(26,74,138,0.6);
}

/* ── Goederenregels Modal ─────────────────────────────────────── */
.goods-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.50);
    z-index: 3000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 12px;
    overflow-y: auto;
}

.goods-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.30);
    width: 100%;
    max-width: 960px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.goods-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 2px solid #e9ecef;
    flex-shrink: 0;
    background: #f0f4fa;
    border-radius: 8px 8px 0 0;
}
.goods-modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1a4a8a;
}
.goods-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
}
.goods-modal-close:hover { color: #333; background: #e0e0e0; }

/* Settings balk */
.goods-settings {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-top: 3px solid #e67e22;
    border-bottom: 3px solid #e67e22;
    font-size: 14px;
    flex-shrink: 0;
}
.goods-settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    column-gap: 32px;
    padding: 12px 20px;
}
.goods-settings-row + .goods-settings-row {
    border-top: 1px solid #f3e0c0;
}
.goods-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.goods-check-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.goods-country-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}
.goods-country-label select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    min-width: 180px;
}
#goods-lang2-wrap {
    display: flex;
    align-items: center;
}
#goods-lang2-wrap .goods-country-label {
    flex: 1;
}

/* Knoppen balk */
.goods-actions {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    border-bottom: 3px solid #e67e22;
    flex-shrink: 0;
}

/* Rijen container */
#goods-rows {
    padding: 0 12px 8px;
    min-height: 80px;
    max-height: 55vh;
    overflow-y: auto;
}
.goods-empty {
    padding: 32px 0;
    text-align: center;
    color: #aaa;
    font-size: 13px;
    font-style: italic;
}

/* Individuele rij */
.goods-row {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-top: 10px;
    background: #fafafa;
}
.goods-row[data-type="adr"] { border-color: #fbbf24; background: #fffef5; }

.goods-row-main {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 8px 6px;
}
.goods-row-remove {
    flex-shrink: 0;
    background: none;
    border: 1px solid #fca5a5;
    color: #dc2626;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-top: 2px;
}
.goods-row-remove:hover { background: #fee2e2; }
.goods-type-badge {
    flex-shrink: 0;
    background: #f59e0b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 4px;
    letter-spacing: 0.05em;
}

/* Kolommenrij */
.goods-cols { display: flex; gap: 6px; flex: 1; min-width: 0; }
.goods-col { display: flex; flex-direction: column; gap: 3px; }
.goods-col label { font-size: 10px; color: #888; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.goods-col textarea,
.goods-col input[type="text"] {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 3px 5px;
    font-size: 12px;
    font-family: inherit;
    resize: none;
    background: #fff;
}
.goods-col textarea:focus,
.goods-col input[type="text"]:focus { outline: none; border-color: #1a4a8a; }

.gc-marks    { flex: 1.5; min-width: 80px; }
.gc-packages { flex: 1.5; min-width: 80px; }
.gc-desc     { flex: 2.5; min-width: 110px; }
.gc-hs       { width: 68px; flex-shrink: 0; }
.gc-kg       { width: 54px; flex-shrink: 0; }
.gc-m3       { width: 60px; flex-shrink: 0; }

/* ADR sectie */
.goods-row-adr {
    padding: 8px 12px 10px 36px;
    border-top: 1px dashed #fbbf24;
    background: #fffbea;
    border-radius: 0 0 6px 6px;
}
.goods-adr-line1 {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
    align-items: flex-end;
}
.goods-adr-field { display: flex; flex-direction: column; gap: 3px; }
.goods-adr-field label { font-size: 10px; color: #888; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.goods-adr-field input {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 12px;
    font-family: inherit;
    background: #fff;
}
.goods-adr-field input[readonly] { background: #f5f5f5; color: #555; }

.goods-adr-un { position: relative; }
.goods-un-wrap { display: flex; align-items: center; gap: 4px; }
.gr-un-number { width: 80px; }
.btn-un-search {
    background: #1a4a8a;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 4px 7px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-un-search:hover { background: #143d72; }

/* UN-dropdown */
.goods-un-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 500;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 340px;
    max-width: 480px;
    max-height: 240px;
    overflow-y: auto;
    margin-top: 3px;
}
.goods-un-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.5;
    border-bottom: 1px solid #f0f0f0;
}
.goods-un-item:last-child { border-bottom: none; }
.goods-un-item:hover { background: #f0f4fa; }
.goods-un-item strong { color: #1a4a8a; }
.goods-un-item small { color: #555; }
.goods-un-class { font-size: 11px; color: #888; }
.goods-un-status { padding: 12px; color: #888; font-size: 12px; font-style: italic; }

/* ADR extra informatierij (GEVI, LQ, EQ, classificatiecode, verv.cat.) */
.goods-adr-line1 {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
    align-items: flex-end;
}

/* ADR waarschuwings- en infobadges */
.goods-adr-warn {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    margin-bottom: 2px;
    align-self: flex-end;
}
.goods-adr-info-noadr {
    display: inline-block;
    background: #6b7280;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    margin-bottom: 2px;
    align-self: flex-end;
}

/* ADR vinkjes */
.goods-adr-flags { display: flex; gap: 16px; margin-bottom: 6px; font-size: 12px; }
.goods-adr-flags label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

/* ADR namen */
.goods-adr-names { font-size: 12px; color: #444; }
.goods-adr-name-row { display: flex; gap: 8px; margin-bottom: 2px; }
.goods-adr-name-lang { font-weight: 700; color: #1a4a8a; min-width: 28px; flex-shrink: 0; }

/* Footer */
.goods-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 20px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

/* Responsief (voor kleinere schermen) */
@media (max-width: 1040px) {
    #topbar-inner { width: 100%; padding: 8px 16px; }
    #cmr-wrap { padding: 10px; overflow-x: auto; }
}
