/* ============================================================
   vendinGO RD315 Calculator V3 — Styles
   ============================================================ */

:root {
  --navy: #1E2F8E;
  --navy-dark: #15206B;
  --navy-light: #E8EBF7;
  --orange: #F36B21;
  --orange-light: #FFEDDD;
  --orange-dark: #C5531A;
  --green: #16A34A;
  --green-light: #DCFCE7;
  --green-dark: #14532D;
  --red: #DC2626;
  --red-light: #FEE2E2;
  --red-dark: #7F1D1D;
  --amber: #D97706;
  --amber-light: #FEF3C7;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--gray-900);
  background: linear-gradient(180deg, var(--navy-light) 0%, var(--gray-50) 25%);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1240px; margin: 0 auto; padding: 28px 24px 48px; }

/* ============================================================
   HEADER
   ============================================================ */
.header { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--gray-200); }
.header__logo { max-width: 190px; margin-bottom: 16px; }
.header__title { font-size: 30px; font-weight: 800; color: var(--navy); letter-spacing: -0.5px; margin-bottom: 6px; }
.header__subtitle { font-size: 15px; color: var(--gray-500); max-width: 660px; }
.header__badges { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge--orange { background: var(--orange-light); color: var(--orange); }
.badge--navy { background: var(--navy-light); color: var(--navy); }
.badge--green { background: var(--green-light); color: var(--green-dark); }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 4px; background: var(--white); padding: 6px; border-radius: var(--radius); margin-bottom: 20px; box-shadow: var(--shadow-sm); overflow-x: auto; }
.tab { flex: 1; padding: 12px 16px; background: transparent; border: none; border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; font-weight: 600; color: var(--gray-500); cursor: pointer; transition: all 0.15s ease; white-space: nowrap; }
.tab:hover { color: var(--navy); background: var(--gray-50); }
.tab.is-active { background: var(--navy); color: var(--white); box-shadow: var(--shadow-sm); }
.tab--icon { flex: 0 0 auto; min-width: 60px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.tab__count { background: var(--orange); color: white; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.tab.is-active .tab__count { background: white; color: var(--navy); }
.tab-content { display: none; }
.tab-content.is-active { display: block; }
@media (max-width: 640px) { .tab { font-size: 12px; padding: 10px 8px; } }

/* ============================================================
   CARDS
   ============================================================ */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 18px; }
.card--ai { background: linear-gradient(135deg, var(--white) 0%, var(--navy-light) 100%); border: 1px solid var(--navy-light); }
.card__title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--gray-500); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.card__title::before { content: ""; width: 3px; height: 14px; background: var(--orange); border-radius: 2px; }
.card__title--num::before { content: attr(data-num); width: auto; height: auto; background: var(--navy); color: white; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 800; letter-spacing: 0; }
.card__hint { font-size: 12px; color: var(--gray-500); margin-top: 12px; }
.card__hint a { color: var(--navy); font-weight: 600; }
.card__section { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--gray-100); }
.card__section:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.card__subtitle { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--gray-500); margin-bottom: 12px; }

/* ============================================================
   UPLOAD AREA
   ============================================================ */
.upload-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--white); border: 1.5px dashed var(--navy); border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--navy); transition: all 0.15s ease; }
.upload-toggle:hover { background: var(--navy-light); }
.upload-toggle__icon { font-size: 20px; }
.upload-toggle__chevron { transition: transform 0.2s ease; }
.upload-toggle.is-open .upload-toggle__chevron { transform: rotate(180deg); }
.upload-content { display: none; margin-top: 16px; }
.upload-content.is-open { display: block; }

.upload-zone { border: 2px dashed var(--gray-300); border-radius: var(--radius); padding: 32px 20px; text-align: center; background: var(--gray-50); transition: all 0.2s ease; cursor: pointer; }
.upload-zone:hover, .upload-zone.is-dragover { border-color: var(--navy); background: var(--navy-light); }
.upload-zone__icon { font-size: 32px; margin-bottom: 8px; }
.upload-zone__text { font-size: 14px; color: var(--gray-700); font-weight: 600; margin-bottom: 4px; }
.upload-zone__hint { font-size: 12px; color: var(--gray-500); }
.upload-zone__tip {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--orange-dark);
  background: var(--orange-light);
  border: 1px solid #F8C9A6;
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.upload-zone__tip strong { color: var(--orange-dark); }
.upload-zone input { display: none; }

.extraction-status { display: none; padding: 14px; background: var(--navy-light); border-radius: var(--radius-sm); margin-top: 14px; font-size: 13px; line-height: 1.5; }
.extraction-status.is-visible { display: block; }
.extraction-status--loading { color: var(--navy); }
.extraction-status--success { background: var(--green-light); color: var(--green-dark); }
.extraction-status--error { background: var(--red-light); color: var(--red-dark); }

/* ============================================================
   CATEGORY GRID
   ============================================================ */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
.cat-card { background: var(--white); border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); padding: 14px 10px; cursor: pointer; transition: all 0.15s ease; text-align: center; }
.cat-card:hover { border-color: var(--navy); transform: translateY(-1px); box-shadow: var(--shadow); }
.cat-card.is-selected { border-color: var(--orange); background: var(--orange-light); box-shadow: 0 0 0 3px rgba(243,107,33,0.15); }
.cat-card__icon { font-size: 26px; margin-bottom: 6px; line-height: 1; }
.cat-card__name { font-size: 12px; font-weight: 600; color: var(--gray-900); line-height: 1.3; }
.cat-card__note { font-size: 10px; color: var(--gray-500); margin-top: 3px; line-height: 1.3; }
.cat-card.is-selected .cat-card__note { color: var(--orange); font-weight: 600; }

/* ============================================================
   FORM
   ============================================================ */
.layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 18px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field__label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.field__hint { font-size: 12px; color: var(--gray-400); font-weight: 400; margin-left: 4px; }

.input, .input--number, .textarea { width: 100%; padding: 10px 14px; font-size: 15px; color: var(--gray-900); background: var(--gray-50); border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-family: inherit; transition: all 0.15s ease; }
.input:focus, .input--number:focus, .textarea:focus { outline: none; border-color: var(--navy); background: var(--white); box-shadow: 0 0 0 3px rgba(30,47,142,0.1); }
.textarea { resize: vertical; min-height: 60px; font-size: 13px; line-height: 1.4; }
.input--number { font-variant-numeric: tabular-nums; text-align: right; -moz-appearance: textfield; }
.input--number::-webkit-outer-spin-button, .input--number::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-group { position: relative; }
.input-group__unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--gray-400); font-weight: 500; pointer-events: none; }
.input-group .input--number { padding-right: 46px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.check-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; padding: 10px 12px; background: var(--gray-50); border-radius: var(--radius-sm); border-left: 3px solid var(--gray-300); }
.check-row input[type="checkbox"] { margin-top: 2px; cursor: pointer; accent-color: var(--navy); width: 16px; height: 16px; }
.check-row label { font-size: 13px; color: var(--gray-700); cursor: pointer; line-height: 1.4; }
.check-row label strong { color: var(--gray-900); }

/* ============================================================
   BUTTONS
   ============================================================ */
.actions { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.btn { flex: 1; min-width: 120px; padding: 11px 14px; font-size: 13px; font-weight: 600; font-family: inherit; border-radius: var(--radius-sm); border: none; cursor: pointer; transition: all 0.15s ease; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn--primary { background: var(--navy); color: white; }
.btn--primary:hover { background: var(--navy-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn--secondary { background: var(--gray-100); color: var(--gray-700); }
.btn--secondary:hover { background: var(--gray-200); }
.btn--orange { background: var(--orange); color: white; }
.btn--orange:hover { background: var(--orange-dark); }

/* ============================================================
   VERDICT (Layer 3)
   ============================================================ */
.verdict { text-align: center; padding: 26px 22px; border-radius: var(--radius); margin-bottom: 20px; transition: all 0.3s ease; }
.verdict--neutral { background: var(--gray-100); color: var(--gray-500); }
.verdict--pass { background: linear-gradient(135deg, #DCFCE7 0%, #BBF7D0 100%); color: var(--green-dark); box-shadow: 0 4px 20px -4px rgba(22,163,74,0.25); }
.verdict--fail { background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%); color: var(--red-dark); box-shadow: 0 4px 20px -4px rgba(220,38,38,0.25); }
.verdict--prohibited { background: linear-gradient(135deg, #2D2D2D 0%, #1A1A1A 100%); color: white; box-shadow: 0 4px 20px -4px rgba(0,0,0,0.3); }
.verdict__icon { font-size: 38px; margin-bottom: 6px; display: block; line-height: 1; }
.verdict__label { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.verdict__sub { font-size: 13px; margin-top: 6px; opacity: 0.85; font-weight: 500; line-height: 1.5; }
@keyframes pop { 0% { transform: scale(0.96); opacity: 0.8; } 100% { transform: scale(1); opacity: 1; } }
.verdict.animate { animation: pop 0.3s ease; }

.justification { background: var(--gray-50); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 18px; border-left: 3px solid var(--navy); font-size: 13px; line-height: 1.6; color: var(--gray-700); }
.justification__title { font-weight: 700; color: var(--gray-900); margin-bottom: 6px; font-size: 13px; }
.justification p { margin-bottom: 6px; }
.justification p:last-child { margin-bottom: 0; }
.justification strong { color: var(--gray-900); }
.justification--neutral { display: none; }

/* CRITERIA */
.criteria { display: flex; flex-direction: column; gap: 12px; }
.criterion { background: var(--gray-50); border-radius: var(--radius-sm); padding: 12px 14px; border-left: 3px solid var(--gray-300); transition: all 0.2s ease; }
.criterion--pass { background: var(--green-light); border-left-color: var(--green); }
.criterion--fail { background: var(--red-light); border-left-color: var(--red); }
.criterion--exempt { background: var(--orange-light); border-left-color: var(--orange); }
.criterion__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.criterion__name { font-size: 13px; font-weight: 600; color: var(--gray-900); display: flex; align-items: center; gap: 6px; }
.criterion__status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.criterion__status--pass { background: var(--green); color: white; }
.criterion__status--fail { background: var(--red); color: white; }
.criterion__status--exempt { background: var(--orange); color: white; }
.criterion__status--neutral { background: var(--gray-200); color: var(--gray-500); }
.criterion__sub { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.check__label { flex: 1; color: var(--gray-700); }
.check__value { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gray-900); }
.check__limit { color: var(--gray-400); font-size: 11px; margin-left: 4px; }
.bar { flex: 0 0 80px; height: 5px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; transition: width 0.3s ease, background-color 0.3s ease; }
.bar__fill--pass { background: var(--green); }
.bar__fill--fail { background: var(--red); }
.bar__fill--exempt { background: var(--orange); }
.exempt-note { font-size: 11px; color: var(--orange); font-style: italic; margin-top: 4px; }

/* ============================================================
   MODALS
   ============================================================ */
.modal { display: none; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.modal.is-open { display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); }
.modal__content { position: relative; background: white; border-radius: var(--radius-lg); padding: 32px 28px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px -10px rgba(0,0,0,0.3); animation: modalIn 0.2s ease; }
.modal__content--wide { max-width: 720px; }
@keyframes modalIn { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal__close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; background: var(--gray-100); border: none; border-radius: 50%; font-size: 18px; cursor: pointer; color: var(--gray-500); transition: all 0.15s ease; }
.modal__close:hover { background: var(--gray-200); color: var(--gray-900); }
.modal__icon { font-size: 42px; text-align: center; margin-bottom: 12px; }
.modal__title { font-size: 22px; font-weight: 800; color: var(--gray-900); margin-bottom: 8px; text-align: center; }
.modal__desc { color: var(--gray-500); font-size: 14px; margin-bottom: 22px; text-align: center; line-height: 1.5; }
.modal__legal { font-size: 11px; color: var(--gray-400); text-align: center; margin-top: 16px; line-height: 1.4; }

/* ============================================================
   HISTORY LIST
   ============================================================ */
.history-list { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.history-item { padding: 12px 14px; background: var(--gray-50); border-radius: var(--radius-sm); cursor: pointer; border-left: 3px solid var(--gray-300); transition: all 0.15s ease; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-item:hover { background: var(--navy-light); border-left-color: var(--navy); }
.history-item--pass { border-left-color: var(--green); }
.history-item--fail { border-left-color: var(--red); }
.history-item--prohibited { border-left-color: #1A1A1A; }
.history-item__info { flex: 1; min-width: 0; }
.history-item__name { font-weight: 600; font-size: 13px; color: var(--gray-900); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item__meta { font-size: 11px; color: var(--gray-500); }
.history-item__verdict { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.history-item__verdict--pass { background: var(--green); color: white; }
.history-item__verdict--fail { background: var(--red); color: white; }
.history-item__verdict--prohibited { background: #1A1A1A; color: white; }
.history-empty { text-align: center; padding: 32px 20px; color: var(--gray-400); font-size: 14px; }

/* ============================================================
   COMPARE
   ============================================================ */
.compare-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-slot { min-height: 160px; border: 2px dashed var(--gray-300); border-radius: var(--radius); padding: 14px; cursor: pointer; transition: all 0.15s ease; background: var(--gray-50); }
.compare-slot:hover { border-color: var(--navy); background: var(--navy-light); }
.compare-slot.is-loaded { cursor: default; background: var(--white); border-style: solid; border-color: var(--gray-200); padding: 16px; }
.compare-slot__empty { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 140px; color: var(--gray-400); font-weight: 600; font-size: 14px; }
.compare-card { display: flex; flex-direction: column; gap: 10px; }
.compare-card__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.compare-card__name { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.compare-card__remove { background: var(--gray-100); border: none; border-radius: 999px; width: 24px; height: 24px; font-size: 14px; cursor: pointer; color: var(--gray-500); }
.compare-card__verdict { padding: 8px; border-radius: var(--radius-sm); text-align: center; font-weight: 800; font-size: 16px; }
.compare-card__verdict--pass { background: var(--green-light); color: var(--green-dark); }
.compare-card__verdict--fail { background: var(--red-light); color: var(--red-dark); }
.compare-card__verdict--prohibited { background: #2D2D2D; color: white; }
.compare-card__criteria { display: flex; flex-direction: column; gap: 4px; font-size: 11px; }
.compare-card__criterion { display: flex; justify-content: space-between; padding: 4px 8px; border-radius: 4px; }
.compare-card__criterion--pass { background: var(--green-light); color: var(--green-dark); }
.compare-card__criterion--fail { background: var(--red-light); color: var(--red-dark); }
.compare-card__criterion--exempt { background: var(--orange-light); color: var(--orange); }

/* ============================================================
   BULK RESULTS
   ============================================================ */
.bulk-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13px; }
.bulk-table th, .bulk-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gray-200); }
.bulk-table th { background: var(--gray-50); font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--gray-500); letter-spacing: 0.5px; }
.bulk-table td.verdict-cell { font-weight: 700; }
.bulk-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.bulk-summary__item { padding: 14px; background: var(--gray-50); border-radius: var(--radius-sm); border-left: 3px solid var(--navy); }
.bulk-summary__item--pass { border-left-color: var(--green); background: var(--green-light); }
.bulk-summary__item--fail { border-left-color: var(--red); background: var(--red-light); }
.bulk-summary__item--prohibited { border-left-color: #1A1A1A; background: #2D2D2D; color: white; }
.bulk-summary__num { font-size: 26px; font-weight: 800; }
.bulk-summary__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.7; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--gray-200); text-align: center; }
.disclaimer { font-size: 12px; color: var(--gray-500); max-width: 760px; margin: 0 auto 14px; line-height: 1.6; }
.branding { font-size: 12px; color: var(--gray-400); margin-top: 14px; }
.branding strong { color: var(--navy); font-weight: 700; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  body { background: white; }
  .container { padding: 0; max-width: 100%; }
  .tabs, .actions, .upload-toggle, .upload-content, .header__badges, .modal, .card--ai { display: none !important; }
  .layout { display: block; }
  .card { box-shadow: none; border: 1px solid var(--gray-200); page-break-inside: avoid; margin-bottom: 16px; }
  .verdict { box-shadow: none; }
}
