/* Desktop upload page (index-v3.html). No inline styles: the CSP forbids them. */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  padding: 15px;
  font-size: 14px;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
}

.header {
  background: white;
  border-bottom: 2px solid #3b82f6;
  padding: 15px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left h1 {
  font-size: 1.5rem;
  margin: 0;
  color: #1e40af;
  font-weight: 600;
}

.header-left p {
  font-size: 0.875rem;
  margin: 4px 0 0 0;
  color: #64748b;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-info {
  text-align: right;
}

.user-info .name {
  font-weight: 600;
  color: #1e40af;
  font-size: 0.875rem;
}

.user-info .email {
  font-size: 0.75rem;
  color: #64748b;
}

.user-info .role {
  display: inline-block;
  background: #fbbf24;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 4px;
}

.logout-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.logout-btn:hover {
  background: #dc2626;
}

.card {
  background: white;
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
  border: 1px solid #e5e7eb;
}

.info-box {
  background: #eff6ff;
  border-radius: 4px;
  padding: 12px 15px;
  margin-bottom: 20px;
  border-left: 3px solid #3b82f6;
}

.info-box h3 {
  color: #1e40af;
  font-size: 0.95rem;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.info-box p {
  color: #475569;
  line-height: 1.5;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.info-box ul {
  list-style: none;
  color: #475569;
  font-size: 0.875rem;
  line-height: 1.6;
  margin-top: 8px;
}

.info-box ul li:before {
  content: "• ";
  color: #3b82f6;
  font-weight: bold;
  margin-right: 8px;
}

.upload-section h2 {
  color: #1e293b;
  margin-bottom: 15px;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}

.file-input-wrapper {
  margin-bottom: 20px;
}

.file-input-wrapper label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: #334155;
  font-size: 0.875rem;
}

.file-input-wrapper input[type="file"] {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  font-size: 0.875rem;
}

.file-input-wrapper input[type="file"]:hover {
  border-color: #3b82f6;
  background: #f9fafb;
}

.file-status {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #64748b;
  padding: 4px 8px;
  border-radius: 3px;
}

.file-status.success {
  color: #059669;
  background: #d1fae5;
  font-weight: 500;
}

.filter-options {
  margin: 25px 0;
  padding: 20px;
  background: #f8f9ff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 10px;
  background: white;
  border-radius: 6px;
  border: 2px solid #e5e7eb;
  transition: all 0.2s;
}

.checkbox-label:hover {
  border-color: #667eea;
  background: #fafbff;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  cursor: pointer;
  accent-color: #667eea;
}

.checkbox-label span {
  font-size: 0.95rem;
  color: #333;
  font-weight: 500;
}

.btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  margin-top: 15px;
}

.btn:hover:not(:disabled) {
  background: #2563eb;
}

.btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.btn-download {
  background: #10b981;
  padding: 12px 30px;
  font-size: 1rem;
  width: auto;
  display: inline-block;
  margin: 10px 10px 0 0;
}

.btn-download:hover {
  background: #059669;
}

.loading {
  display: none;
  text-align: center;
  padding: 40px;
}

.loading.active {
  display: block;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading p {
  color: #666;
  font-size: 1.1rem;
}

.error {
  background: #fee;
  border-left: 4px solid #f00;
  padding: 15px;
  margin-top: 15px;
  border-radius: 8px;
  color: #c00;
  display: none;
}

.error.active {
  display: block;
}

.results {
  display: none;
  margin-top: 30px;
}

.results.active {
  display: block;
}

.results h2 {
  color: #1e293b;
  margin-bottom: 15px;
  font-size: 1.1rem;
  font-weight: 600;
  border-bottom: 2px solid #3b82f6;
  padding-bottom: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 15px 0 20px 0;
}

.stat-box {
  background: white;
  padding: 12px;
  border-radius: 4px;
  text-align: center;
  border: 1px solid #e5e7eb;
}

.stat-box .number {
  font-size: 1.75rem;
  font-weight: 600;
  color: #3b82f6;
}

.stat-box .label {
  font-size: 0.75rem;
  margin-top: 4px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #eee;
}

.tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #666;
  transition: all 0.3s;
}

.tab:hover {
  color: #667eea;
}

.tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.table-wrapper {
  overflow-x: auto;
  margin-top: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: #667eea;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 25px;
}

th.sortable:hover {
  background: #5568d3;
}

th.sortable::after {
  content: '⇅';
  position: absolute;
  right: 8px;
  opacity: 0.3;
  font-size: 0.9rem;
}

th.sortable.asc::after {
  content: '▲';
  opacity: 1;
}

th.sortable.desc::after {
  content: '▼';
  opacity: 1;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}

tbody tr:hover {
  background: #f8f9ff;
}

.price-up {
  color: #dc2626;
  font-weight: 600;
}

.price-down {
  color: #10b981;
  font-weight: 600;
}

.badge {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-left: 10px;
}

.badge.warning {
  background: #f59e0b;
}

.copy-btn {
  cursor: pointer;
  margin-left: 8px;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  display: inline-block;
  font-size: 0.9rem;
}

.copy-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}

.copy-btn:active {
  transform: scale(0.9);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.filter-box {
  background: #f8f9ff;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.filter-box input {
  flex: 1;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}

.filter-box input:focus {
  outline: none;
  border-color: #667eea;
}

/* Modal Styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

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

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  color: #1e40af;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.modal-file-list {
  background: #f8f9ff;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.modal-file-list p {
  margin: 8px 0;
  color: #333;
  font-size: 0.95rem;
}

.modal-file-list strong {
  color: #1e40af;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-cancel {
  background: #6b7280;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.btn-cancel:hover {
  background: #4b5563;
}

.btn-confirm {
  background: #10b981;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.btn-confirm:hover {
  background: #059669;
}

/* Hide upload section after processing */
.upload-section.hidden {
  display: none;
}

/* Filter Summary (above results) */
.filter-summary {
  display: none;
  background: #f8f9ff;
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 2px solid #3b82f6;
}

.filter-summary.active {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.filter-summary-content {
  flex: 1;
}

.filter-summary-content h3 {
  margin: 0 0 10px 0;
  color: #1e40af;
  font-size: 1rem;
}

.filter-summary-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-badge {
  display: inline-block;
  background: #3b82f6;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.btn-edit {
  background: #f59e0b;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.btn-edit:hover {
  background: #d97706;
}

/* Responsive styles voor smartphones */
@media (max-width: 768px) {
  body {
    padding: 10px;
    font-size: 13px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
  }

  .header-left h1 {
    font-size: 1.2rem;
  }

  .header-left p {
    font-size: 0.75rem;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .user-info .name {
    font-size: 0.8rem;
  }

  .user-info .email {
    font-size: 0.7rem;
  }

  .logout-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .card {
    padding: 15px;
    font-size: 0.85rem;
  }

  .info-box {
    padding: 10px 12px;
  }

  .info-box h3 {
    font-size: 0.9rem;
  }

  .info-box p,
  .info-box ul {
    font-size: 0.8rem;
  }

  .file-input-wrapper label {
    font-size: 0.8rem;
  }

  .file-input-wrapper input[type="file"] {
    padding: 8px;
    font-size: 0.8rem;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  /* BELANGRIJKSTE FIX: Admin upload grid wordt 1 kolom op smartphone */
  #admin-section > .admin-upload-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
  }

  #admin-section input[type="file"] {
    font-size: 0.75rem;
    padding: 6px;
  }

  #admin-section .btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  #admin-section label {
    font-size: 0.8rem;
  }

  /* Tabellen responsive maken */
  table {
    font-size: 0.75rem;
  }

  th, td {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .tab-button {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .stats-summary {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .search-input {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
}

/* Extra small screens (< 480px) */
@media (max-width: 480px) {
  body {
    padding: 5px;
  }

  .header-left h1 {
    font-size: 1.1rem;
  }

  .card {
    padding: 12px;
  }

  table {
    font-size: 0.7rem;
  }

  th, td {
    padding: 6px 8px;
    font-size: 0.7rem;
  }
}

/* ------------------------------------------------------------
   Formerly inline style="" attributes. An inline style beat every
   rule; where an existing selector competes for the same property,
   the selectors below are made specific enough to keep winning.
   ------------------------------------------------------------ */

/* Confirmation modal */
.modal-file-date { color: #666; font-size: 0.85rem; }
.modal-content .modal-question { color: #666; font-size: 0.9rem; margin-bottom: 20px; }

/* Header -- JS shows the link with style.display = 'block' */
.user-info .admin-link { display: none; font-size: 0.75rem; color: #dc2626; font-weight: 600; text-decoration: none; margin-top: 4px; }

/* Admin upload section -- JS shows it with style.display = 'block' */
.card.admin-section { border: 2px solid #f59e0b; background: #fffbeb; display: none; }
.admin-section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.admin-section-icon { font-size: 1.5rem; }
.admin-section-title .admin-section-heading { margin: 0; color: #92400e; }
.admin-upload-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-top: 15px; }
#admin-section .admin-upload-label { font-weight: 600; color: #92400e; display: block; margin-bottom: 8px; }
.admin-upload-input { margin-bottom: 10px; }
.admin-upload-status { margin-top: 8px; font-size: 0.875rem; }

/* .btn:hover:not(:disabled) is (0,3,0): repeat the pseudo-classes so the colour holds on hover */
.btn.btn-admin-upload,
.btn.btn-admin-upload:hover:not(:disabled),
.btn.btn-admin-upload:disabled { background: #f59e0b; width: 100%; }

/* Groothandel upload: complete list or changes only */
.upload-confirm { background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px; padding: 12px; margin-top: 8px; }
.upload-confirm .upload-confirm-title { font-weight: 600; color: #92400e; margin-bottom: 8px; }
.upload-confirm .upload-confirm-text { font-size: 0.85rem; color: #78716c; margin-bottom: 12px; }
/* beats the mobile #admin-section .btn padding/font-size */
#admin-section .btn.btn-upload-choice { width: 100%; padding: 10px; font-size: 0.9rem; }
.btn.btn-upload-replace { margin-bottom: 6px; }
.btn.btn-upload-replace,
.btn.btn-upload-replace:hover:not(:disabled),
.btn.btn-upload-replace:disabled { background: #dc2626; }
.btn.btn-upload-merge,
.btn.btn-upload-merge:hover:not(:disabled),
.btn.btn-upload-merge:disabled { background: #10b981; }
.btn.btn-reprocess { margin-top: 10px; }
.btn.btn-reprocess,
.btn.btn-reprocess:hover:not(:disabled),
.btn.btn-reprocess:disabled { background: #10b981; }

/* Server status box */
.info-box .info-box-footnote { margin-top: 15px; }
.info-box.info-box-server { background: #f0fdf4; border-left-color: #10b981; }
.info-box.info-box-server h3 { color: #065f46; }
.server-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 10px; }
.info-box .server-status-label { margin: 0; font-weight: 600; color: #065f46; }
.info-box .server-status-value { margin: 5px 0 0 0; font-size: 0.875rem; color: #047857; }
.status-date { font-size: 0.8rem; }

/* Product type filter */
.filter-options .filter-options-title { font-weight: 600; margin-bottom: 12px; display: block; color: #555; font-size: 1.05rem; }
.filter-options .filter-options-intro { color: #777; font-size: 0.85rem; margin-bottom: 15px; }
.product-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 15px; }
.product-type-grid .checkbox-label span { font-size: 0.9rem; }
.filter-options .filter-options-hint { color: #999; font-size: 0.8rem; font-style: italic; }

/* Processing */
.loading .loading-hint { font-size: 0.9rem; margin-top: 10px; color: #999; }

/* Results */
.download-buttons { margin-bottom: 20px; }
/* JS toggles these with style.display = 'block' / 'none' */
.tab-loading { text-align: center; padding: 40px; display: none; }
.tab-loading-text { margin-top: 15px; color: #64748b; }
.tab-message { text-align: center; padding: 40px; color: #64748b; }
.tab-message-text { font-size: 1.1em; }

.badge.badge-magistraal { background: #8b5cf6; }
.badge.badge-groothandel { background: #667eea; }
.badge.badge-score-high { background: #10b981; }
.badge.badge-score-mid { background: #f59e0b; }
.badge.badge-score-low { background: #ef4444; }

td.bestelcode-old { color: #999; text-decoration: line-through; }
td.bestelcode-new { color: #10b981; font-weight: 600; }
td.cell-omschrijving { max-width: 300px; }
td.cell-magistraal-naam { max-width: 400px; }
td.table-cell-message { text-align: center; }
td.table-cell-empty { text-align: center; padding: 40px; color: #64748b; }

/* Status text colours */
.text-danger { color: #dc2626; }
.text-info { color: #3b82f6; }
.text-success { color: #10b981; }
.text-success-dark { color: #047857; }
.text-warning { color: #f59e0b; }

/* VPM choice (Viva | Yessa) -- assets/js/yessa.js */
.vpm-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.vpm-tab {
  flex: 1; max-width: 220px; padding: 12px 20px; font-size: 1.05rem; font-weight: 700;
  background: #f1f5f9; color: #475569; border: 2px solid #e2e8f0; border-radius: 10px; cursor: pointer;
}
.vpm-tab:hover { border-color: #667eea; color: #667eea; }
.vpm-tab.active { background: #667eea; color: #fff; border-color: #667eea; }
.vpm-tab:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; }
.vpm-hint { margin: 0 0 16px; color: #64748b; font-size: 0.9rem; }
.vpm-panel[hidden], .vpm-only[hidden] { display: none; }

/* Yessa result tabs: own class names, index-v3.js binds every .tab */
.ytab {
  padding: 12px 18px; background: none; border: none; border-bottom: 3px solid transparent;
  cursor: pointer; font-size: 0.95rem; font-weight: 600; color: #666;
}
.ytab:hover { color: #667eea; }
.ytab.active { color: #667eea; border-bottom-color: #667eea; }
.ytabs { flex-wrap: wrap; }
.ytab-content { display: none; }
.ytab-content.active { display: block; }
.yessa-verdict { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; }
.yessa-verdict-ok { background: #ecfdf5; color: #065f46; border-left: 4px solid #10b981; }
.yessa-verdict-fout { background: #fef2f2; color: #991b1b; border-left: 4px solid #dc2626; }
.badge.badge-ok { background: #10b981; }
.badge.badge-muted { background: #94a3b8; }
.badge.badge-optional { background: #10b981; }
.cell-small { font-size: 0.8rem; color: #64748b; }

@media (max-width: 600px) {
  .vpm-tab { max-width: none; padding: 10px; }
  .ytab { padding: 10px 12px; font-size: 0.85rem; }
}

/* "Hoe werkt het?" as a collapsible bar -- native <details>, no script needed */
.info-box.info-box-uitleg { padding-top: 12px; padding-bottom: 12px; }
.info-box-uitleg > summary {
  cursor: pointer; font-weight: 600; color: #1e40af; font-size: 1.1rem; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.info-box-uitleg > summary::-webkit-details-marker { display: none; }
.info-box-uitleg > summary::after { content: '▸'; margin-left: auto; transition: transform 0.2s; }
.info-box-uitleg[open] > summary::after { transform: rotate(90deg); }
.info-box-uitleg[open] > summary { margin-bottom: 10px; }
.info-box-uitleg > summary:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; border-radius: 4px; }
