/* ============================================================
   InspektorAI - Shared Stylesheet v2.0
   Design System: Blue #1565C0 | Green #2E7D32 | Red #C62828
   Font: Lato (300, 400, 700, 900)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap');

:root {
  --blue:        #1565C0;
  --blue-dark:   #0D47A1;
  --blue-light:  #1976D2;
  --blue-bg:     #E3F2FD;
  --green:       #2E7D32;
  --green-bg:    #E8F5E9;
  --red:         #C62828;
  --red-bg:      #FFEBEE;
  --text:        #1A1A2E;
  --text-muted:  #6B7280;
  --border:      #E0E4EB;
  --bg:          #F7F9FC;
  --bg-card:     #FFFFFF;
  --shadow:      0 2px 8px rgba(0,0,0,0.06);
}

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

body {
  font-family: 'Lato', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- Header ---- */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo { height: 56px; width: auto; display: block; flex-shrink: 0; }
.header-content { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.header-row { display: flex; justify-content: space-between; align-items: center; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-subtitle {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ---- Header Buttons ---- */
.hdr-btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: 'Lato', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.hdr-btn:hover { background: var(--blue-bg); border-color: var(--blue-light); color: var(--blue); }
.hdr-btn--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.hdr-btn--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.hdr-btn--danger { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.hdr-btn--danger:hover { background: var(--red); color: #fff; }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

/* ---- Loading / Spinner ---- */
.loading { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 16px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }

/* ============================================================
   Dashboard
   ============================================================ */
.filters {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.filters-row { display: flex; gap: 12px; flex-wrap: wrap; }

.filter-btn {
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--blue-light); color: var(--blue); background: var(--blue-bg); }
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.search-box { flex: 1; min-width: 200px; }
.search-wrapper {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 0 12px;
  gap: 8px;
  transition: border-color 0.2s;
}
.search-wrapper:focus-within { border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(25,118,210,0.10); }
.search-icon { color: var(--text-muted); font-size: 15px; flex-shrink: 0; line-height: 1; }
.search-wrapper input {
  flex: 1;
  padding: 10px 0;
  border: none;
  outline: none;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  background: transparent;
  color: var(--text);
}

.comparisons-list {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.comparison-row {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.comparison-row:hover { background: var(--blue-bg); }
.comparison-row:last-child { border-bottom: none; }

.status-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.status-icon.success { background: var(--green-bg); color: var(--green); }
.status-icon.error   { background: var(--red-bg);   color: var(--red);   }

.comparison-info { flex: 1; margin-left: 16px; }
.comparison-title    { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.comparison-subtitle { font-size: 14px; color: var(--text-muted); }
.comparison-time     { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

/* ============================================================
   Detail
   ============================================================ */
.status-banner {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}
.status-banner.success { background: var(--green-bg); color: var(--green); }
.status-banner.error   { background: var(--red-bg);   color: var(--red);   }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.info-item { display: flex; flex-direction: column; }
.info-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}
.info-value { font-size: 16px; color: var(--text); font-weight: 700; }

.photo-container {
  max-width: 100%;
  border-radius: 8px;
  background: var(--bg);
  text-align: center;
  padding: 16px;
}
.photo-container img {
  max-height: 200px; max-width: 100%; height: auto;
  cursor: pointer; border-radius: 8px;
  transition: max-height 0.3s ease;
  display: inline-block;
}
.photo-hint { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 8px; }

.comparison-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.comparison-table th {
  background: var(--bg);
  padding: 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}
.comparison-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text); }
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table tr:hover td { background: var(--blue-bg); }

.match-status {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%; font-weight: 700;
}
.match-status.ok    { background: var(--green-bg); color: var(--green); }
.match-status.error { background: var(--red-bg);   color: var(--red);   }
.missing { color: var(--text-muted); font-style: italic; }

.allergen-list { display: flex; flex-wrap: wrap; gap: 8px; }
.allergen-tag {
  background: #FFF8E1;
  color: #E65100;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #FFE0B2;
}

/* Match score badge */
.match-score {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}
.match-score.high   { background: var(--green-bg); color: var(--green); }
.match-score.medium { background: #FFF8E1;         color: #E65100; }
.match-score.low    { background: var(--red-bg);   color: var(--red); }

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

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue-light);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(25,118,210,0.10);
}

.logo-preview {
  width: 120px; height: 120px;
  border-radius: 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px; overflow: hidden;
}
.logo-preview img { max-width: 100%; max-height: 100%; }
.logo-placeholder { font-size: 48px; color: var(--text-muted); }

.radio-group { display: flex; gap: 20px; }
.radio-option { display: flex; align-items: center; gap: 8px; }
.radio-option input[type="radio"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--blue); }
.radio-option label { margin: 0; cursor: pointer; font-size: 14px; text-transform: none; letter-spacing: 0; }

.save-btn {
  width: 100%; padding: 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
}
.save-btn:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(21,101,192,0.3);
}
.save-btn:active { transform: translateY(0); box-shadow: none; }

.success-message {
  padding: 12px 16px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 700;
  display: none;
}
.success-message.show { display: block; }
.help-text { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ============================================================
   Login (body override — legacy, now replaced by login.html)
   ============================================================ */
body.login-page {
  background: #0D1B2A;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-container {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  padding: 40px;
  width: 100%; max-width: 400px;
  text-align: center;
}
.login-logo { width: 120px; height: auto; display: block; margin: 0 auto 24px; }
.subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.input-group { margin-bottom: 20px; text-align: left; }
.input-group label {
  display: block; color: var(--text-muted);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 8px;
}
input[type="password"] {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="password"]:focus {
  outline: none;
  border-color: var(--blue-light);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(25,118,210,0.10);
}
.login-btn {
  width: 100%; padding: 14px;
  background: var(--blue);
  color: #fff; border: none; border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
}
.login-btn:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(21,101,192,0.3);
}
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.spinner-inline {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.8s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
.login-error {
  color: var(--red); font-size: 14px; margin-top: 12px; display: none;
  text-align: left; padding: 10px 12px;
  background: var(--red-bg);
  border-radius: 6px;
  border-left: 3px solid var(--red);
  font-weight: 700;
}
.login-error.show { display: block; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
  20%, 40%, 60%, 80%       { transform: translateX(6px); }
}

/* ============================================================
   Offline / Alert Banners
   ============================================================ */
.banner-offline {
  background: #E65100; color: #fff;
  padding: 10px 24px; text-align: center;
  font-weight: 700; font-size: 13px;
}
.banner-pending {
  background: #F57C00; color: #fff;
  padding: 10px 24px; text-align: center;
  font-weight: 700; font-size: 13px;
}
.banner-info {
  background: var(--blue-bg); color: var(--blue);
  padding: 10px 24px; text-align: center;
  font-weight: 700; font-size: 13px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .card { padding: 16px; }
  .header { padding: 10px 16px; gap: 10px; }
  .header-logo { height: 44px; }
  .hdr-btn { padding: 7px 10px; font-size: 12px; }
  .comparison-row { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; }
  .comparison-info { margin-left: 0; }
  .comparison-time { align-self: flex-start; }
  .comparison-table { font-size: 13px; }
  .comparison-table th, .comparison-table td { padding: 8px; }
  .info-grid { grid-template-columns: 1fr; }
  .login-container { padding: 30px 24px; }
}
