/**
 * Brouwer Bestelsysteem - Styles
 * ===============================
 * Alle CSS styles voor de applicatie.
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--primary);
}

.login-card p {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: var(--card-bg);
    padding: 16px 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-radius: var(--radius);
    width: 100%;
    box-sizing: border-box;
    gap: 10px;
}

.header h2 {
    color: var(--primary);
}

.user-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.user-badge {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
}

/* Badge container voor betere wrapping */
.badge-container {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.btn-logout {
    white-space: nowrap;
}

/* ============================================
   NAVIGATION TABS
   ============================================ */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.nav-tab {
    padding: 12px 20px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-tab:hover {
    border-color: var(--primary);
}

.nav-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Pakbon Wanden knop in navigatie - zelfde stijl als nav-tab */
.nav-tab-btn {
    padding: 12px 20px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: inherit;
    font-family: inherit;
    color: var(--text);
    transition: all 0.2s;
}

.nav-tab-btn:hover {
    border-color: var(--primary);
}

.nav-tab-btn.hidden {
    display: none;
}

/* Zorg dat nav-tabs flexbox correct werkt */
.nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    align-items: center;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    white-space: nowrap;
}

tr:hover {
    background: var(--bg);
}

/* ============================================
   SEARCH / AUTOCOMPLETE
   ============================================ */
.search-container {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.search-result-item:hover {
    background: var(--bg);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item .art-nr {
    font-weight: 600;
    color: var(--primary);
}

.search-result-item .description {
    color: var(--text-light);
    font-size: 14px;
}

/* ============================================
   ORDER ITEMS
   ============================================ */
.order-item {
    display: grid;
    grid-template-columns: 120px 1fr 100px 50px;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
}

.order-item input {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
}

.remove-item {
    background: var(--danger);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
}

/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-draft { background: #e2e8f0; color: #475569; }
.status-sent { background: #dbeafe; color: #1d4ed8; }
.status-picked { background: #fef3c7; color: #d97706; }
.status-checked { background: #d1fae5; color: #059669; }
.status-completed { background: #22c55e; color: white; }
.status-first-check { background: #fef3c7; color: #92400e; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Order detail modal - larger width for all columns */
#orderModal .modal {
    max-width: 95vw;
    width: 1400px;
    min-width: fit-content;
}

/* ============================================
   ORDER ITEMS TABLE - OPTIMIZED MINIMAL SPACING
   ============================================ */
.order-items-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.order-items-table th,
.order-items-table td {
    padding: 4px 1px;     /* 1px horizontale padding voor minimale afstand */
    font-size: 13px;
    vertical-align: top;
    border-bottom: 1px solid #e5e7eb;
}

.order-items-table th {
    font-size: 12px;
    font-weight: 600;
    background: #f3f4f6;
    white-space: nowrap;
    padding: 6px 2px;
}

/* LINKER KOLOMMEN */
.order-items-table .col-artnr { 
    width: 75px;
    font-weight: 500;
    color: #1e40af;
    padding-right: 1px;   /* 1px ruimte naar omschrijving */
}

.order-items-table .col-desc { 
    width: auto;          /* Flex: neemt resterende ruimte */
    white-space: normal !important;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.3;
    padding-left: 1px;    /* 1px ruimte vanaf art.nr */
    padding-right: 1px;   /* 1px ruimte naar volgende kolom */
}

/* WICS KOLOM - smal, rechts tegen Eenheid */
.order-items-table .col-wics { 
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    color: #6b7280;
    text-align: center;
    padding: 4px 1px;
    padding-right: 1px;   /* Minimale ruimte naar Eenheid */
}

.order-items-table .col-unit { 
    width: 45px;
    color: #6b7280;
    padding: 4px 1px;
    padding-left: 1px;    /* Minimale ruimte vanaf WICS */
}

.order-items-table .col-stocked { 
    width: 70px;
    color: #6b7280;
    padding: 4px 1px;
}

/* RECHTER KOLOMMEN - MINIMALE SPACING (bijna tegen elkaar) */
.order-items-table .col-critical {
    width: 30px;
    text-align: center;
    color: #6b7280;
    padding: 4px 1px;     /* Bijna geen padding */
}

.order-items-table .col-qty { 
    width: 55px;
    text-align: center;
    font-weight: 600;
    padding: 4px 1px;     /* Bijna geen padding */
}

.order-items-table .col-input { 
    width: 62px;
    text-align: center;
    padding: 4px 1px;     /* Bijna geen padding */
}

.order-items-table .col-input-wide { 
    width: 68px;
    text-align: center;
    padding: 4px 1px;     /* Bijna geen padding */
}

.order-items-table .col-action { 
    width: 26px;
    text-align: center;
    padding: 4px 1px;     /* Bijna geen padding */
}

/* OPMERKINGEN KOLOM */
.order-items-table .col-remarks {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    padding: 4px 1px;
    vertical-align: top;
}

/* PAKBON SELECTIE KOLOM - neemt ruimte van omschrijving */
.order-items-table .col-pakbon {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    text-align: center;
    padding: 4px 1px;     /* Zelfde als andere smalle kolommen */
}

.pakbon-select-btn {
    width: 20px;
    height: 20px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
    margin: 0;
}

.pakbon-select-btn .pakbon-icon {
    color: #9ca3af;
    font-weight: 600;
    font-size: 11px;
    line-height: 1;
}

.pakbon-select-btn:hover {
    border-color: #22c55e;
    background: #f0fdf4;
}

.pakbon-select-btn.selected {
    background: #22c55e;
    border-color: #22c55e;
}

.pakbon-select-btn.selected .pakbon-icon {
    color: white;
}

/* ============================================
   ITERATIEVE WORKFLOW v2.0 - Regel kleuren
   ============================================ */

/* Gepickte regels - Medium groen, duidelijk zichtbaar */
.order-items-table tr.row-picked {
    background-color: #86efac !important;
}

.order-items-table tr.row-picked:hover {
    background-color: #6ee7a0 !important;
}

/* Voltooide regels - Zeer lichtgroen, bijna wit */
.order-items-table tr.row-completed {
    background-color: #f0fdf4 !important;
    color: #6b7280;
}

.order-items-table tr.row-completed:hover {
    background-color: #ecfdf5 !important;
}

/* Filter knoppen boven order tabel */
.order-filter-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.order-filter-buttons .btn {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s;
}

.remarks-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.remarks-input {
    width: 100%;
    height: 52px;           /* Vaste hoogte voor 2 regels */
    min-height: 52px;
    max-height: 52px;       /* Geen variabele hoogte */
    padding: 4px 6px;
    font-size: 12px;
    line-height: 1.4;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    resize: none;
    overflow: hidden;       /* GEEN scroll */
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.remarks-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.remarks-input::placeholder {
    color: #9ca3af;
    font-size: 11px;
}

.char-counter {
    font-size: 10px;
    color: #6b7280;
    text-align: right;
    margin-top: 2px;
    font-weight: 400;
}

/* INPUT VELDEN - vergroot voor 5 karakters + spinner pijltjes */
.order-items-table input[type="number"] {
    width: calc(100% - 2px);  /* Vul bijna hele cel */
    max-width: 58px;
    padding: 4px 2px 4px 4px; /* Links meer voor tekst, rechts minder voor pijltjes */
    text-align: right;        /* Getallen rechts uitlijnen */
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    margin: 0;
}

/* Spinner pijltjes altijd zichtbaar */
.order-items-table input[type="number"]::-webkit-inner-spin-button,
.order-items-table input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    height: 100%;
}

.order-items-table input[type="number"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

/* DELETE KNOP - compact */
.order-items-table .remove-item {
    width: 20px;
    height: 20px;
    font-size: 13px;
    padding: 0;
    line-height: 1;
    margin: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

/* ============================================
   GRID SYSTEM
   ============================================ */
.grid {
    display: grid;
    gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .order-item {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* ============================================
   LOADING
   ============================================ */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--primary); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   LOADING SPINNER FOR BUTTONS
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ============================================
   CONFIG NOTICE
   ============================================ */
.config-notice {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.config-notice h3 {
    color: #d97706;
    margin-bottom: 10px;
}

.config-notice code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* ============================================
   VERSION DISPLAY
   ============================================ */
#versionDisplay {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1000;
    user-select: none;
}

#versionDisplay:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

#versionDisplay:active {
    transform: scale(0.98);
}

/* Update indicator badge */
#versionDisplay.has-update {
    animation: pulse 2s ease-in-out infinite;
}

#versionDisplay.has-update::after {
    content: '!';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: shake 0.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* ============================================
   ADMIN SUPERUSER STYLING
   ============================================ */

/* Admin badge met glow effect */
.user-badge[data-role="admin"] {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
    font-weight: 600 !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    animation: adminGlow 2s ease-in-out infinite !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3) !important;
}

@keyframes adminGlow {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
    }
    50% { 
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
    }
}

/* Admin indicator in header */
.admin-indicator {
    background: #fef3c7;
    color: #92400e;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid #fcd34d;
    display: none;
}

/* Admin heeft toegang tot alles - speciale indicators */
.admin-only {
    border-left: 3px solid #f59e0b;
    padding-left: 8px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* Admin grid voor extra functies */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Settings grid */
.settings-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
}

/* Admin panel highlight */
.admin-panel {
    border: 2px solid #fbbf24;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.admin-panel h3 {
    color: #92400e;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-panel h3::before {
    content: '👑';
    font-size: 20px;
}

/* ============================================
   ORDERS FILTER BUTTONS
   ============================================ */

.filter-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    min-width: 90px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    color: var(--text);
}

.btn-filter:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}

.btn-filter.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================
   ORDERS LIST SEARCH STYLING
   ============================================ */

/* Search input in orders header */
#ordersListSearch {
    transition: border-color 0.2s, box-shadow 0.2s;
}

#ordersListSearch:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Filtered order rows */
.order-row-filtered {
    transition: background-color 0.2s;
}

.order-row-filtered:hover {
    background: #dbeafe !important;
}

/* Article sub-row container */
.article-subrow-container {
    transition: background-color 0.2s;
}

.article-subrow-container:hover {
    background: #f0f4f8 !important;
}

/* Nested article table styling */
.article-subrow-container table {
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.article-subrow-container table tr:last-child {
    border-bottom: none;
}

.article-subrow-container table tr:hover {
    background: #f8fafc;
}

/* Mobile responsive voor orders search */
@media screen and (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .card-header > div {
        flex-wrap: wrap;
    }
    
    #ordersListSearch {
        min-width: 100% !important;
        width: 100%;
    }
    
    /* Nested table scrollable on mobile */
    .article-subrow-container > td > div {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .article-subrow-container table {
        min-width: 700px;
    }
}

@media screen and (max-width: 480px) {
    #ordersListSearch {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* ============================================
   MOBILE RESPONSIVE - iPhone Portrait Mode
   ============================================ */

/* Tablet and mobile - Order modal scrolling */
@media screen and (max-width: 768px) {
    /* Voorkom viewport uitrekken */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* Modal aanpassingen voor tablet/mobiel */
    #orderModal .modal {
        width: 100%;
        max-width: 100vw;
        min-width: unset;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        padding: 12px;
    }
    
    /* Scrollbare tabel container */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Tabel aanpassingen mobiel */
    .order-items-table {
        min-width: 600px; /* Vaste minimale breedte voor scrollen */
    }
    
    /* Description kolom mag wrappen */
    .order-items-table td:nth-child(2),
    .order-items-table th:nth-child(2) {
        white-space: normal;
        min-width: 150px;
        max-width: 200px;
    }
}

/* Mobile Order Modal - Horizontaal scrollbare tabel */
@media screen and (max-width: 768px) {
    /* Zorg dat table-responsive container horizontaal scrollt */
    #orderModal .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
    }
    
    /* Verwijder table-layout: fixed op mobiel voor flexibele kolommen */
    #orderModal .order-items-table {
        table-layout: auto;
        min-width: 900px; /* Forceer horizontaal scrollen */
    }
    
    /* Omschrijving kolom vaste minimale breedte */
    #orderModal .order-items-table .col-desc {
        min-width: 180px !important;
        width: 180px !important;
        white-space: normal !important;
        word-wrap: break-word;
    }
}

/* iPhone Portrait Mode (max 480px) */
@media screen and (max-width: 480px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }
    
    .header h2 {
        font-size: 1.1rem;
        margin-bottom: 8px;
        width: 100%;
    }
    
    .user-info {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .user-info > span {
        font-size: 0.85rem;
    }
    
    .user-badge {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
    
    .admin-indicator {
        font-size: 0.7rem;
        padding: 2px 6px;
        margin-left: 0;
    }
    
    .user-info .btn {
        margin-top: 8px;
        width: 100%;
        text-align: center;
    }
    
    /* Container width fix voor alle cards */
    .container {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .card {
        width: 100%;
        margin: 0 0 15px 0;
        box-sizing: border-box;
        padding: 15px;
    }
    
    /* Navigation tabs op mobile */
    .nav-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .nav-tab {
        flex: 1 1 auto;
        min-width: 100px;
        text-align: center;
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

/* Smaller iPhones (iPhone SE, etc. - max 375px) */
@media screen and (max-width: 375px) {
    .header h2 {
        font-size: 1rem;
    }
    
    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .user-info > span:first-child {
        font-weight: 600;
        margin-bottom: 4px;
    }
    
    .badge-container {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 8px;
    }
    
    .user-badge,
    .admin-indicator {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    .user-info .btn {
        width: 100%;
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .nav-tab {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
}
