/* ====================================
   6S Audit — Mobile-first PWA Styles
   Brand: Lean Akademija
   ==================================== */

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

/* CRITICAL: 'hidden' attribute must always win over CSS display rules.
   Brez tega modal-overlay z display:flex je viden tudi z hidden atributom. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #F8FAFC;
  color: #1E293B;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, select {
  user-select: text;
  -webkit-user-select: text;
}

#app {
  height: 100%;
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  background: #F8FAFC;
  overflow: hidden;
}

/* === SCREENS === */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: #F8FAFC;
}
.screen.active { display: flex; }

/* === APP HEADER === */
.app-header {
  background: #0066FF;
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding-top: max(14px, env(safe-area-inset-top));
}
.app-header .title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}
.header-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.header-btn:active { background: rgba(255,255,255,0.15); }

/* === PROGRESS BAR === */
.progress-bar {
  height: 3px;
  background: rgba(0,102,255,0.15);
  flex-shrink: 0;
}
.progress-fill {
  height: 100%;
  background: #0066FF;
  width: 0%;
  transition: width 0.3s;
}

/* === CONTENT === */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* === HEADINGS === */
h2 { font-size: 18px; margin: 4px 0 12px 0; }
.section-title {
  font-size: 12px;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 10px 0;
  font-weight: 600;
}

/* === BUTTONS === */
.btn {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  font-family: inherit;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: #0066FF; color: white; }
.btn-secondary { background: #fff; color: #0066FF; border: 2px solid #0066FF; }
.btn-success { background: #10B981; color: white; }
.btn-warning { background: #F59E0B; color: white; }
.btn-danger { background: #EF4444; color: white; }
.btn-ghost { background: transparent; color: #64748B; }

/* === FORMS === */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: #64748B;
  margin-bottom: 6px;
  font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #E2E8F0;
  border-radius: 10px;
  font-size: 15px;
  background: white;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #0066FF;
}

/* === HOME WELCOME === */
.welcome-card {
  background: linear-gradient(135deg, #0066FF, #0052CC);
  color: white;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}
.welcome-label { font-size: 12px; opacity: 0.85; }
.welcome-name { font-size: 22px; font-weight: 700; margin-top: 4px; }
.welcome-meta { font-size: 13px; opacity: 0.85; margin-top: 4px; }

/* === HISTORY === */
.history-item {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.history-item:active { background: #F1F5F9; }
.history-item .info { flex: 1; min-width: 0; }
.history-item .name { font-weight: 600; font-size: 15px; }
.history-item .date { font-size: 12px; color: #64748B; margin-top: 2px; }
.history-item .score-pill {
  background: #F1F5F9;
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
}
.score-pill.grade-A { background: #D1FAE5; color: #065F46; }
.score-pill.grade-B { background: #FEF3C7; color: #92400E; }
.score-pill.grade-C { background: #FEE2E2; color: #991B1B; }

/* === INFO BOX === */
.info-box {
  background: #F1F5F9;
  padding: 12px 14px;
  border-radius: 10px;
  margin-top: 16px;
  font-size: 13px;
  color: #64748B;
  line-height: 1.5;
}

/* === BOTTOM BAR === */
.bottom-bar {
  background: white;
  padding: 12px 16px;
  border-top: 1px solid #E2E8F0;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.bottom-bar .btn { flex: 1; padding: 12px; font-size: 14px; }

/* === QUESTION SCREEN === */
.q-category {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.q-category .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.q-subtitle {
  font-size: 13px;
  color: #64748B;
  margin: -4px 0 8px 0;
}

/* === RUBRIC === */
.rubric {
  background: #F1F5F9;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 14px;
  line-height: 1.5;
}
.rubric-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: flex-start; }
.rubric-row:last-child { margin-bottom: 0; }
.rubric-row.highlighted {
  background: rgba(255,255,255,0.7);
  margin: -2px -4px 6px -4px;
  padding: 4px;
  border-radius: 6px;
  font-weight: 600;
}
.rubric-pill {
  flex-shrink: 0;
  width: 32px;
  height: 24px;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rubric-pill.p0 { background: #EF4444; }
.rubric-pill.p5 { background: #F59E0B; }
.rubric-pill.p10 { background: #10B981; }

/* === SCORE BUTTONS === */
.score-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.score-btn {
  aspect-ratio: 1;
  border: 3px solid #E2E8F0;
  background: white;
  border-radius: 14px;
  font-size: 32px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748B;
  font-family: inherit;
}
.score-btn .label-text {
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.score-btn:active { transform: scale(0.95); }
.score-btn.score-0 { border-color: #EF4444; color: #EF4444; }
.score-btn.score-5 { border-color: #F59E0B; color: #F59E0B; }
.score-btn.score-10 { border-color: #10B981; color: #10B981; }
.score-btn.selected.score-0 { background: #EF4444; color: white; box-shadow: 0 4px 14px rgba(239,68,68,0.35); }
.score-btn.selected.score-5 { background: #F59E0B; color: white; box-shadow: 0 4px 14px rgba(245,158,11,0.35); }
.score-btn.selected.score-10 { background: #10B981; color: white; box-shadow: 0 4px 14px rgba(16,185,129,0.35); }

/* === PHOTO SECTION === */
.photo-section {
  margin-top: 16px;
  padding: 14px;
  border: 2px dashed #94A3B8;
  border-radius: 12px;
  text-align: center;
  background: #F8FAFC;
}
.photo-section.required {
  border-color: #F59E0B;
  background: #FEF3C7;
}
.photo-section.has-photo {
  border-style: solid;
  border-color: #10B981;
  background: #D1FAE5;
}
.photo-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #92400E;
  margin-bottom: 10px;
}
.photo-section.has-photo .photo-section-title {
  color: #065F46;
}
.photo-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 10px;
}
.photo-thumb {
  width: 80px;
  height: 60px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  position: relative;
  cursor: pointer;
}
.photo-thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #EF4444;
  color: white;
  border: 2px solid white;
  font-size: 12px;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-photo { padding: 10px; font-size: 14px; }

/* === SUCCESS MSG === */
.success-msg {
  background: #D1FAE5;
  border-radius: 10px;
  padding: 14px;
  margin-top: 16px;
  text-align: center;
  color: #065F46;
  font-size: 14px;
  font-weight: 500;
}

/* === SUMMARY === */
.summary-meta {
  font-size: 13px;
  color: #64748B;
  text-align: center;
  margin-bottom: 12px;
}
.summary-score {
  text-align: center;
  padding: 28px 16px;
  background: white;
  border-radius: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.summary-score .big {
  font-size: 56px;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #0066FF, #10B981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.summary-score .pct { font-size: 18px; color: #64748B; }
.grade-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 8px;
}
.grade-badge.grade-A { background: #D1FAE5; color: #065F46; }
.grade-badge.grade-B { background: #FEF3C7; color: #92400E; }
.grade-badge.grade-C { background: #FEE2E2; color: #991B1B; }

/* === PER-S BARS === */
.s-bar { margin-bottom: 14px; }
.s-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 14px;
  align-items: center;
}
.s-bar-header .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.s-bar-track {
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}
.s-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s;
}

/* === BENCHMARK CARD === */
.card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-title {
  font-size: 12px;
  color: #64748B;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.benchmark-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.benchmark-dates { color: #64748B; font-size: 13px; }
.benchmark-delta { font-size: 18px; font-weight: 700; }
.benchmark-delta.up { color: #10B981; }
.benchmark-delta.down { color: #EF4444; }
.benchmark-icon { font-size: 32px; }

/* === ACTIONS === */
.action-card {
  background: white;
  border-left: 4px solid #F59E0B;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.action-card .number {
  font-size: 11px;
  color: #64748B;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.action-card .desc {
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 500;
}
.action-card .meta-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.action-card .meta-row input,
.action-card .meta-row select {
  flex: 1;
  padding: 8px 10px;
  border: 2px solid #E2E8F0;
  border-radius: 8px;
  font-size: 13px;
  background: white;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal {
  background: white;
  border-radius: 16px;
  padding: 22px;
  max-width: 380px;
  width: 100%;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.modal-text { font-size: 14px; color: #64748B; margin-bottom: 16px; line-height: 1.5; }
.modal-buttons { display: flex; gap: 10px; }
.modal-buttons .btn { flex: 1; padding: 12px; font-size: 14px; }

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #1E293B;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 1001;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  animation: toast-up 0.3s;
}
@keyframes toast-up {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ===== Polish v0.2 ===== */
.info-tip {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 24px;
  font-size: 12px;
  line-height: 1.5;
  color: #78350f;
}
.info-tip strong { color: #92400e; }

.app-footer {
  padding: 12px 16px;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  border-top: 1px solid #f1f5f9;
  background: white;
  flex-shrink: 0;
}
.app-footer a {
  color: #0066ff;
  text-decoration: none;
  font-weight: 500;
}
.app-footer a:hover { text-decoration: underline; }

/* Polish welcome card */
.welcome-card {
  background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%);
  position: relative;
  overflow: hidden;
}
.welcome-card::before {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  pointer-events: none;
}

/* Mojca widget — pozicija nad bottom-bar v 6S audit */
.lcw-fab {
  bottom: 90px !important;
}
@media (max-width: 480px) {
  .lcw-fab { bottom: 80px !important; }
}

/* ===== Sprint 1: in-line action capture ===== */
.quick-date-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.btn-quick-date {
  flex: 1;
  padding: 8px 4px;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-quick-date:hover { background: #e2e8f0; }
.btn-quick-date.active { background: #0066ff; color: white; border-color: #0066ff; }
.btn-quick-date:active { transform: scale(0.97); }

/* History delete button */
.history-item { position: relative; }
.history-item .btn-delete {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #cbd5e1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: 8px;
  transition: color 0.15s;
}
.history-item .btn-delete:hover { color: #ef4444; background: #fee2e2; }

/* ====== Settings (question editor) screen ====== */
.settings-q-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
}
.settings-q-item:active { transform: scale(0.99); background: #f8fafc; }
.settings-q-cat {
  flex: 0 0 auto;
  min-width: 70px;
  padding: 4px 8px;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}
.settings-q-text { flex: 1; min-width: 0; }
.settings-q-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
}
.settings-q-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.3;
}
.settings-q-edit {
  flex: 0 0 auto;
  font-size: 22px;
  color: #94a3b8;
  font-weight: 300;
}
#screen-edit-question textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}
#screen-edit-question textarea:focus { outline: none; border-color: #0066ff; }
