/* Lastplanerare (Visual Loader) — page-specific styles, kept separate from
   style.css since this is a full page, not a dashboard tile. Uses the same
   theme variables (--bg-surface, --text-primary, etc.) defined there. */

.loader-main { padding: 24px; box-sizing: border-box; }
.loader-page { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

.loader-intro {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px; text-align: center;
}
.loader-intro h1 { margin: 0 0 8px; font-size: 22px; color: var(--text-primary); }
.loader-intro p { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }

.loader-ai-box {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  border-radius: 14px; padding: 20px; color: #fff;
}
.loader-ai-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.loader-ai-desc { font-size: 12px; opacity: .9; margin: 0 0 12px; line-height: 1.5; }
.loader-ai-textarea {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 70px;
  border: 1px solid rgba(255,255,255,.3); border-radius: 8px; padding: 10px;
  font-size: 13px; font-family: inherit; background: rgba(255,255,255,.95); color: #1e293b;
}
.loader-ai-textarea:focus { outline: none; border-color: #fff; }

.loader-form-box {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px;
}
.loader-section-title {
  font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.loader-form-box .loader-section-title:not(:first-child) { margin-top: 20px; }

.loader-truck-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1.2fr; gap: 12px; margin-bottom: 8px; }
.loader-truck-grid label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.loader-input {
  width: 100%; box-sizing: border-box; background: var(--bg-base); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-primary); font-size: 13px; padding: 8px; font-family: inherit;
}
.loader-input:focus { outline: none; border-color: var(--accent); }

.loader-items-grid {
  display: grid; grid-template-columns: 0.4fr 1.2fr 0.7fr 0.8fr 0.7fr 0.7fr 0.7fr 0.6fr auto;
  gap: 8px; align-items: center; margin-bottom: 8px;
}
.loader-items-header { font-size: 11px; font-weight: 700; color: var(--text-secondary); padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.loader-items-grid input[type="text"], .loader-items-grid input[type="number"] {
  width: 100%; box-sizing: border-box; background: var(--bg-base); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-primary); font-size: 12px; padding: 6px; font-family: inherit;
}
.loader-items-grid input:focus { outline: none; border-color: var(--accent); }
.loader-items-grid input[type="checkbox"] { justify-self: center; transform: scale(1.2); accent-color: var(--accent); }
.loader-row-number { font-weight: 700; color: var(--text-secondary); text-align: center; font-size: 12px; }
.loader-row-remove {
  background: var(--negative-bg); color: var(--negative); border: none; border-radius: 6px;
  width: 26px; height: 26px; cursor: pointer; font-size: 12px;
}
.loader-row-remove:hover { opacity: .8; }

#itemRowsScrollContainer { max-height: 400px; overflow-y: auto; }

.loader-form-buttons { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.loader-btn {
  border: none; border-radius: 8px; padding: 10px 20px; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.loader-btn-add { background: var(--positive-bg); color: var(--positive); }
.loader-btn-primary { background: var(--accent); color: #fff; }
.loader-btn-ai { background: rgba(255,255,255,.2); color: #fff; margin-top: 12px; }
.loader-btn:hover { opacity: .85; }
.loader-btn:disabled { opacity: .5; cursor: default; }

.loader-stats { margin-top: 16px; background: var(--bg-base); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.loader-stats-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.loader-stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.loader-stat { text-align: center; }
.loader-stat-value { display: block; font-size: 16px; font-weight: 700; color: var(--text-primary); }
.loader-stat-label { font-size: 10px; color: var(--text-secondary); }

.loader-canvas-wrap { position: relative; }
#loadingCanvas {
  display: block; width: 100%; height: 480px; border-radius: 14px; border: 1px solid var(--border);
}

.loader-loading-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 10; pointer-events: none;
}
.loader-loading-content {
  text-align: center; max-width: 320px; padding: 20px; background: var(--bg-surface);
  border: 2px solid var(--accent); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.3);
  pointer-events: auto;
}
.loader-spinner { font-size: 32px; margin-bottom: 8px; animation: loader-spin 2s linear infinite; }
@keyframes loader-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.loader-loading-text { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.loader-progress-track { width: 100%; height: 6px; background: var(--bg-base); border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.loader-progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 3px; transition: width .3s ease; }
.loader-loading-details { font-size: 11px; color: var(--text-secondary); }

.loader-toast {
  position: fixed; top: 20px; right: 20px; z-index: 9999; max-width: 360px;
  padding: 12px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.loader-toast-success { background: var(--positive); }
.loader-toast-error { background: var(--negative); }

@media (max-width: 768px) {
  .loader-truck-grid { grid-template-columns: 1fr 1fr; }
  .loader-items-grid { grid-template-columns: 0.3fr 1fr 0.6fr 0.7fr 0.6fr 0.6fr 0.6fr 0.5fr auto; font-size: 11px; }
  .loader-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
