/* Innohub NPS — widget + dashboard styles
   Tyylikäs, neutraali — sopeutuu sekä omille sivuille että upotuksiin. */

.innohub-nps {
    --ihnp-bg: #ffffff;
    --ihnp-fg: #0f172a;
    --ihnp-muted: #64748b;
    --ihnp-accent: #29ABE2;
    --ihnp-bad: #ef4444;
    --ihnp-ok: #f59e0b;
    --ihnp-good: #10b981;
    --ihnp-border: #e5e7eb;
    --ihnp-radius: 12px;
    background: var(--ihnp-bg);
    color: var(--ihnp-fg);
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    border: 1px solid var(--ihnp-border);
    border-radius: var(--ihnp-radius);
    padding: 24px 22px;
    max-width: 560px;
    margin: 14px auto;
    line-height: 1.45;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}
.innohub-nps--dark {
    --ihnp-bg: #0f172a;
    --ihnp-fg: #f1f5f9;
    --ihnp-muted: #94a3b8;
    --ihnp-border: rgba(255,255,255,0.12);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.innohub-nps--compact { padding: 16px 18px; }
.innohub-nps__question {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 16px;
}
.innohub-nps__scale {
    display: grid;
    /* auto-fit + minmax on the widget's OWN width (not viewport): keeps 11 in a
       row when wide, wraps to ~6+5 on a narrow/mobile embed so tap targets stay
       usable. Container-relative → works even in a narrow sidebar on a wide page. */
    grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}
.innohub-nps__btn {
    appearance: none;
    border: 1px solid var(--ihnp-border);
    background: var(--ihnp-bg);
    color: var(--ihnp-fg);
    font-weight: 600;
    font-size: 15px;
    min-height: 44px; /* WCAG 2.5.5 tap target — was ~37px, cramped on mobile */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: transform .08s, background .12s, border-color .12s;
    line-height: 1;
}
.innohub-nps__btn:hover { transform: translateY(-1px); border-color: var(--ihnp-accent); }
.innohub-nps__btn[data-score="0"],
.innohub-nps__btn[data-score="1"],
.innohub-nps__btn[data-score="2"],
.innohub-nps__btn[data-score="3"],
.innohub-nps__btn[data-score="4"],
.innohub-nps__btn[data-score="5"],
.innohub-nps__btn[data-score="6"] { color: var(--ihnp-bad); }
.innohub-nps__btn[data-score="7"],
.innohub-nps__btn[data-score="8"] { color: var(--ihnp-ok); }
.innohub-nps__btn[data-score="9"],
.innohub-nps__btn[data-score="10"] { color: var(--ihnp-good); }
.innohub-nps__btn.is-selected {
    background: var(--ihnp-fg);
    color: var(--ihnp-bg);
    border-color: var(--ihnp-fg);
}
.innohub-nps__legend {
    display: flex;
    justify-content: space-between;
    color: var(--ihnp-muted);
    font-size: 12px;
    margin-bottom: 14px;
}
.innohub-nps__comment {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--ihnp-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--ihnp-fg);
    background: transparent;
    min-height: 76px;
    margin-bottom: 12px;
    resize: vertical;
}
.innohub-nps__comment:focus { outline: 2px solid var(--ihnp-accent); outline-offset: 2px; }
.innohub-nps__email {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--ihnp-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--ihnp-fg);
    background: transparent;
    margin-bottom: 12px;
}
.innohub-nps__submit {
    appearance: none;
    border: 0;
    background: var(--ihnp-accent);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
}
.innohub-nps__submit[disabled] { opacity: .5; cursor: not-allowed; }
.innohub-nps__submit:hover:not([disabled]) { filter: brightness(1.06); }
.innohub-nps__thanks {
    background: linear-gradient(135deg, rgba(16,185,129,.1), rgba(41,171,226,.08));
    color: var(--ihnp-fg);
    padding: 22px;
    border-radius: 8px;
    text-align: center;
}
.innohub-nps__thanks h3 { margin: 0 0 8px; font-size: 18px; }
.innohub-nps__error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}
.innohub-nps__tag {
    display: inline-block;
    font-size: 11px;
    color: var(--ihnp-muted);
    margin-top: 8px;
}
/* Nappien nakyva fokus. WCAG 2.4.7: nappulaa sai ennen kayttaa nappaimistolla,
   mutta selaimen oletusrengas katosi appearance:none-saannon mukana eika
   mikaan korvannut sita — asteikkoa pystyi siis selaamaan nakematta missa on. */
.innohub-nps__btn:focus-visible,
.innohub-nps__submit:focus-visible,
.innohub-nps__email:focus-visible {
    outline: 3px solid var(--ihnp-accent);
    outline-offset: 2px;
}
.innohub-nps__email:focus { outline: 2px solid var(--ihnp-accent); outline-offset: 2px; }

/* Pieni tietosuojahuomautus mittarin alla (localStorage, ei evastetta). */
.innohub-nps__privacy {
    font-size: 12px;
    line-height: 1.5;
    /* Fallback on pakollinen: huomautus on .innohub-nps-kortin ULKOPUOLELLA,
       jossa kortin omia --ihnp-*-muuttujia ei ole olemassa. */
    color: var(--ihnp-muted, #64748b);
    margin: 10px auto 0;
    max-width: 560px;
    text-align: center;
}

/* ─── Upotettu sivustomittari ──────────────────────────────
   Hillitty osio sivun alaosassa: ei modaalia, ei peittoa, ei omaa
   taustavaria vaan sivun oma. Tummilla sivuilla (Innohub TV) kaytetaan
   .innohub-nps--dark-modifieria samassa kortissa. */
.innohub-nps-sivupalaute {
    padding: 28px 16px 40px;
}
.innohub-nps-sivupalaute .innohub-nps {
    margin-left: auto;
    margin-right: auto;
}
/* Isantasivun oma `p { margin: 0 }` voittaa luokkavalitsimen samalla
   spesifisyydella. Mitattu 21.9.2026 InnoRenki-landingilla: huomautus
   liimautui sivun vasempaan laitaan kortin alle. Elementtivalitsin nostaa
   spesifisyyden (0,2,1) isantasivun saannon ylapuolelle. */
.innohub-nps-sivupalaute p.innohub-nps__privacy {
    margin: 10px auto 0;
}
.innohub-nps-sivupalaute--dark {
    background: transparent;
}
.innohub-nps-sivupalaute--dark .innohub-nps__privacy {
    color: rgba(241, 245, 249, 0.66);
}

.innohub-nps-error,
.innohub-nps-login {
    border: 1px solid var(--ihnp-border, #e5e7eb);
    border-radius: 12px;
    padding: 18px 22px;
    color: #475569;
    background: #f8fafc;
}

/* ─── Dashboard ───────────────────────────────────────────── */
.innohub-nps-dashboard {
    font-family: 'Inter', system-ui, sans-serif;
    color: #0f172a;
    margin: 24px 0;
}
.ihnp-dash-header { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 20px; }
.ihnp-dash-header h2 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: 26px; flex: 1 1 auto; }
.ihnp-greet { color: #64748b; margin: 0; flex: 1 1 100%; }
.ihnp-btn {
    appearance: none; border: 1px solid #e5e7eb; background: #fff; color: #0f172a;
    padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer;
    transition: background .12s, border-color .12s;
}
.ihnp-btn:hover { border-color: #29ABE2; }
.ihnp-btn--primary { background: #29ABE2; color: #fff; border-color: #29ABE2; }
.ihnp-btn--ghost { background: transparent; }
.ihnp-btn--danger { color: #ef4444; border-color: #fecaca; }
.ihnp-dash-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.ihnp-empty { color: #64748b; padding: 30px; text-align: center; border: 1px dashed #e5e7eb; border-radius: 12px; }
.ihnp-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px 20px; }
.ihnp-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ihnp-card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.ihnp-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.ihnp-status.is-on { background: #d1fae5; color: #065f46; }
.ihnp-status.is-off { background: #fee2e2; color: #991b1b; }
.ihnp-score-row { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.ihnp-score {
    width: 88px; height: 88px; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #f1f5f9; flex-shrink: 0;
}
.ihnp-score-num { font-family: 'Montserrat', sans-serif; font-size: 28px; font-weight: 800; line-height: 1; }
.ihnp-score-label { font-size: 11px; color: #64748b; letter-spacing: .08em; text-transform: uppercase; }
.ihnp-score--good { background: #d1fae5; color: #065f46; }
.ihnp-score--ok { background: #fef3c7; color: #92400e; }
.ihnp-score--bad { background: #fee2e2; color: #991b1b; }
.ihnp-score--neutral { background: #f1f5f9; color: #64748b; }
.ihnp-breakdown { font-size: 13px; color: #475569; line-height: 1.6; flex: 1; }
.ihnp-breakdown .ihnp-total { color: #0f172a; padding-top: 4px; border-top: 1px solid #e5e7eb; margin-top: 4px; }
.ihnp-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ihnp-modal {
    position: fixed; inset: 0; background: rgba(15,23,42,0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; padding: 16px;
}
/* display:flex above overrides the UA [hidden]{display:none} (author beats UA),
   so without this the modal backdrop would cover the whole dashboard permanently. */
.ihnp-modal[hidden] { display: none; }
.ihnp-modal-inner {
    background: #fff; border-radius: 14px; padding: 24px 26px;
    max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto;
    position: relative;
}
.ihnp-modal-close {
    position: absolute; top: 8px; right: 12px; background: none; border: none;
    font-size: 24px; cursor: pointer; color: #64748b;
}
.ihnp-modal-close:hover { color: #0f172a; }
.ihnp-modal-body h3 { margin-top: 0; font-family: 'Montserrat', sans-serif; }
.ihnp-modal-body label { display: block; font-size: 13px; color: #475569; margin: 12px 0 4px; font-weight: 600; }
.ihnp-modal-body input,
.ihnp-modal-body textarea {
    width: 100%; box-sizing: border-box;
    border: 1px solid #e5e7eb; border-radius: 8px; padding: 9px 12px;
    font-family: inherit; font-size: 14px;
}
/* Checkbox must stay inline with its label (width:100% above would stretch it). */
.ihnp-modal-body input[type="checkbox"] {
    width: auto; display: inline-block; vertical-align: middle;
    margin: 0 6px 0 0; padding: 0;
}
.ihnp-modal-body textarea { min-height: 80px; resize: vertical; }
.ihnp-modal-body .ihnp-modal-actions { margin-top: 20px; display: flex; gap: 8px; justify-content: flex-end; }
.ihnp-code {
    font-family: 'JetBrains Mono', Consolas, monospace; font-size: 12px;
    background: #0f172a; color: #e2e8f0; border-radius: 8px;
    padding: 12px 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
.ihnp-recent-row {
    display: grid; grid-template-columns: 64px 1fr auto; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px;
}
.ihnp-recent-row .ihnp-recent-score {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px;
}
.ihnp-recent-row.ihnp-r--good .ihnp-recent-score { background: #d1fae5; color: #065f46; }
.ihnp-recent-row.ihnp-r--ok .ihnp-recent-score { background: #fef3c7; color: #92400e; }
.ihnp-recent-row.ihnp-r--bad .ihnp-recent-score { background: #fee2e2; color: #991b1b; }
.ihnp-recent-meta { color: #64748b; font-size: 11px; }
