/* EDC-EPC Issuer — shared theme tokens & components. */

:root {
    --brand-primary: #0F4C81;
    --brand-primary-hover: #093458;
    --brand-on-primary: #FFFFFF;
    --brand-primary-container: #D6E4F2;
    --brand-on-primary-container: #093458;

    --neutral-background: #F5F7FA;
    --neutral-surface: #FFFFFF;
    --neutral-surface-variant: #E6EAF0;
    --neutral-on-surface: #1A1F26;
    --neutral-on-surface-variant: #515967;
    --neutral-outline: #C2CAD6;
    --neutral-outline-variant: #DDE2EA;

    --success-green: #2E7D32;
    --success-container: #D7F0DA;
    --on-success-container: #0F3D14;
    --error-red: #C62828;
    --error-container: #FADBDB;
    --on-error-container: #5C0F0F;

    --radius-card: 16px;
    --radius-control: 12px;
    --shadow-card: 0 4px 16px rgba(15, 76, 129, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--neutral-background);
    color: var(--neutral-on-surface);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

.app-bar {
    background: var(--neutral-background);
    color: var(--neutral-on-surface);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 640px;
    margin: 0 auto;
}

.app-bar h1 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--neutral-on-surface);
}

.app-bar .back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--neutral-on-surface);
    text-decoration: none;
    transition: background 0.15s ease;
}

.app-bar .back-link:hover { background: var(--neutral-surface-variant); }

.screen {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 1.5rem;
}

.hero .brand-icon {
    width: 112px;
    height: 112px;
    color: var(--brand-primary);
    margin-bottom: 1.75rem;
}

.hero h2 {
    margin: 0 0 0.75rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neutral-on-surface);
}

.hero p {
    margin: 0;
    color: var(--neutral-on-surface-variant);
    max-width: 28rem;
}

.card {
    background: var(--neutral-surface);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

.card.status-success {
    background: var(--success-container);
    color: var(--on-success-container);
    box-shadow: none;
}

.card.status-error {
    background: var(--error-container);
    color: var(--on-error-container);
    box-shadow: none;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--neutral-on-surface);
    margin: 0 0 0.5rem 0;
    padding-left: 0.25rem;
}

.detail-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
}

.detail-row + .detail-row { border-top: 1px solid var(--neutral-outline-variant); margin-top: 0.25rem; padding-top: 0.75rem; }

.detail-row .label {
    font-weight: 500;
    color: var(--neutral-on-surface);
    flex: 1;
}

.detail-row .value {
    color: var(--neutral-on-surface);
    text-align: right;
    flex: 1;
    word-break: break-word;
}

/* A row carrying a copy button lays out differently from a plain one, because the button takes 32px
   the value would otherwise have. Measured at 375px and 1100px:

     - equal halves (the plain .detail-row rule) wraps a 32-digit identifier at both widths;
     - giving the label its natural width fixes the wide case but squeezes the value badly when
       narrow — a 24-character serial number went to eight lines at 375px;
     - the rule below holds one line at both.

   The label takes what it needs, the value takes the rest down to a 12rem floor, and below that the
   row wraps so the value drops to its own line rather than shredding into a column of characters.
   min-width:0 is required: a flex item will not shrink past its content without it.

   Scoped by modifier rather than :has() so it does not depend on selector support, and so
   .detail-row elsewhere — card-error, the status card — is untouched. */
.detail-row--copyable { flex-wrap: wrap; }
.detail-row--copyable .label { flex: 0 1 auto; }
.detail-row--copyable .value { flex: 1 1 12rem; min-width: 0; }

/* Copy-to-clipboard button inside a detail row.

   flex: 0 0 auto keeps it out of the 1:1 split between .label and .value — without it the button
   would take a third share and squash the value. Only rows that opt in by carrying the button are
   affected, so .detail-row elsewhere (card-error, the status card) is untouched. */
.copy-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: -0.25rem -0.25rem -0.25rem 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--neutral-on-surface-variant);
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.copy-btn:hover {
    background: var(--neutral-surface-variant);
    color: var(--neutral-on-surface);
}

.copy-btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* The tick lives in the markup alongside the copy glyph and the two are swapped, so the button
   does not change size when it fires. */
.copy-btn__done { display: none; }
.copy-btn--copied .copy-btn__copy { display: none; }
.copy-btn--copied .copy-btn__done { display: inline; }
.copy-btn--copied,
.copy-btn--copied:hover {
    color: var(--success-green);
    background: var(--success-container);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1.125rem;
}

.field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--neutral-on-surface);
}

.field label small {
    font-weight: 400;
    color: var(--neutral-on-surface-variant);
}

.field input {
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--neutral-outline);
    border-radius: var(--radius-control);
    background: var(--neutral-surface);
    color: var(--neutral-on-surface);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.18);
}

.field input.input-invalid {
    border-color: var(--error-red);
}

.field input.input-invalid:focus {
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.18);
}

.field .field-error {
    color: var(--error-red);
    font-size: 0.8125rem;
    font-weight: 500;
}

.field-inline {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.field-inline label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

.field-inline input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 56px;
    padding: 0 1.5rem;
    border-radius: var(--radius-control);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
    background: var(--brand-primary);
    color: var(--brand-on-primary);
}

.btn-primary:hover { background: var(--brand-primary-hover); }

.btn-outlined {
    background: transparent;
    color: var(--neutral-on-surface);
    border: 1px solid var(--neutral-outline);
}

.btn-outlined:hover { background: var(--neutral-surface-variant); }

.btn-block { width: 100%; }

.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.actions .btn { flex: 1; }

.helper {
    color: var(--neutral-on-surface-variant);
    font-size: 0.875rem;
    text-align: center;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--neutral-outline-variant);
    margin-bottom: 1rem;
}

.tab-button {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.625rem 0.25rem;
    margin-bottom: -1px;
    font: inherit;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--neutral-on-surface-variant);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-button:hover { color: var(--neutral-on-surface); }

.tab-button[aria-selected="true"] {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.tab-button:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.choice {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--neutral-surface);
    border: 1px solid var(--neutral-outline-variant);
    border-radius: var(--radius-card);
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: var(--neutral-on-surface);
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.choice:hover {
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

.choice-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--brand-primary-container);
    color: var(--brand-on-primary-container);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex: 0 0 auto;
}

.choice-text { flex: 1; min-width: 0; }
.choice-text h3 { margin: 0 0 0.125rem 0; font-size: 1.0625rem; font-weight: 600; }
.choice-text p { margin: 0; color: var(--neutral-on-surface-variant); font-size: 0.9375rem; }

.choice-chevron {
    color: var(--neutral-on-surface-variant);
    flex: 0 0 auto;
}

.qr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.credential-card {
    position: relative;
    width: 100%;
    max-width: 544px;
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.credential-card__bg {
    width: 100%;
    height: auto;
    display: block;
}

.credential-card__qr-mask {
    position: absolute;
    aspect-ratio: 1;
    background-color: #002CE0;
    border-radius: 6%;
}

.credential-card__qr {
    position: absolute;
    aspect-ratio: 1;
    image-rendering: pixelated;
}

.credential-card--edc .credential-card__qr-mask {
    right: 3%;
    bottom: 5.5%;
    width: 25%;
}

.credential-card--edc .credential-card__qr {
    right: 3%;
    bottom: 5.5%;
    width: 25%;
}

.credential-card--epc .credential-card__qr-mask {
    left: 53%;
    bottom: 5%;
    width: 20%;
}

.credential-card--epc .credential-card__qr {
    left: 53%;
    bottom: 5%;
    width: 20%;
}

.credential-card-zoom {
    position: relative;
    width: 100%;
    max-width: 340px;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.credential-card-zoom .credential-card {
    position: absolute;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
}

.credential-card-zoom--edc {
    background-color: #0b3ae6;
}

.credential-card-zoom--edc .credential-card {
    width: 220%;
    left: 70%;
    top: 70%;
    transform: translate(-84.5%, -73.1%);
}

.credential-card-zoom--epc {
    background-color: #1430cc;
}

.credential-card-zoom--epc .credential-card {
    width: 260%;
    left: 50%;
    top: 70%;
    transform: translate(-63%, -81.1%);
}


.qr-caption {
    margin: 0;
    color: var(--neutral-on-surface-variant);
    font-size: 0.875rem;
    text-align: center;
}
