/* =========================================================================
 * JR ATS — [jr_my_professional_identity] tab orchestrator
 *
 * Brand color: #5277ba
 *
 * Layout: horizontal tab strip + pane area. Active tab gets a brand-color
 * underline indicator. Inactive panes are hidden via [hidden] attribute
 * (set by PHP/JS) — no display:none flicker on first paint.
 *
 * Sub-components style their own internals via their existing stylesheets:
 *   - Tab 1 (Statistics)             → jrats-public-identity.css + jrats-public-cv.css
 *   - Tab 2 (Highlights)             → jrats-professional-gallery.css
 *   - Tab 3 (QR Code)                → THIS FILE
 *   - Tab 4 (Identity Form)          → form section inline styles
 *
 * Required tokens (kept duplicated, not inherited, so this stylesheet is
 * usable even if no other JR ATS CSS loads on the page):
 * ========================================================================= */

:root {
    --jrats-mpi-brand:        #5277ba;
    --jrats-mpi-brand-dark:   #3f5f97;
    --jrats-mpi-brand-soft:   rgba(82, 119, 186, 0.10);
    --jrats-mpi-brand-softer: rgba(82, 119, 186, 0.06);
    --jrats-mpi-border:       #e5e7eb;
    --jrats-mpi-text:         #111827;
    --jrats-mpi-text-muted:   #6b7280;
    --jrats-mpi-surface:      #ffffff;
    --jrats-mpi-surface-alt:  #f9fafb;
    --jrats-mpi-radius:       14px;
    --jrats-mpi-radius-sm:    10px;
    --jrats-mpi-shadow-sm:    0 1px 2px rgba(17, 24, 39, 0.04);
    --jrats-mpi-shadow-md:    0 4px 12px rgba(17, 24, 39, 0.08);
    --jrats-mpi-ease:         cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================================================
 * Wrapper
 * ========================================================================= */

.jrats-mpi-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* =========================================================================
 * Banner (success / error from ?identity_saved=...)
 * ========================================================================= */

.jrats-mpi-banner {
    padding: 12px 16px;
    border-radius: var(--jrats-mpi-radius-sm);
    font-size: 14px;
    font-weight: 500;
}

.jrats-mpi-banner--success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.jrats-mpi-banner--error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* =========================================================================
 * Tab strip
 * ========================================================================= */

.jrats-mpi-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--jrats-mpi-border);
    margin: 0;
    padding: 0 4px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.jrats-mpi-tabs::-webkit-scrollbar {
    display: none;
}

.jrats-mpi-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: transparent;
    border: none;
    color: var(--jrats-mpi-text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: color 180ms var(--jrats-mpi-ease),
                background 180ms var(--jrats-mpi-ease);
    border-radius: var(--jrats-mpi-radius-sm) var(--jrats-mpi-radius-sm) 0 0;
    flex: 0 0 auto;
}

.jrats-mpi-tab:hover {
    color: var(--jrats-mpi-text);
    background: var(--jrats-mpi-brand-softer);
}

.jrats-mpi-tab.is-active {
    color: var(--jrats-mpi-brand);
    background: transparent;
}

.jrats-mpi-tab.is-active::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 3px;
    background: var(--jrats-mpi-brand);
    border-radius: 3px 3px 0 0;
}

.jrats-mpi-tab:focus-visible {
    outline: 2px solid var(--jrats-mpi-brand);
    outline-offset: 2px;
    border-radius: var(--jrats-mpi-radius-sm);
}

.jrats-mpi-tab__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.jrats-mpi-tab__icon svg {
    display: block;
}

/* Hide labels on narrow screens to keep the strip readable */
@media (max-width: 520px) {
    .jrats-mpi-tab {
        padding: 10px 14px;
    }
    .jrats-mpi-tab__label {
        display: none;
    }
    .jrats-mpi-tab.is-active .jrats-mpi-tab__label {
        display: inline;
    }
}

/* =========================================================================
 * Pane area
 * ========================================================================= */

.jrats-mpi-panes {
    padding-top: 4px;
}

.jrats-mpi-pane {
    animation: jrats-mpi-fade-in 240ms var(--jrats-mpi-ease);
}

.jrats-mpi-pane[hidden] {
    display: none !important;
}

@keyframes jrats-mpi-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .jrats-mpi-pane {
        animation: none;
    }
}

/* =========================================================================
 * Tab 3 — QR Card
 * ========================================================================= */

.jrats-mpi-qr-card {
    background: var(--jrats-mpi-surface);
    border: 1px solid var(--jrats-mpi-border);
    border-radius: var(--jrats-mpi-radius);
    padding: 28px 24px;
    box-shadow: var(--jrats-mpi-shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    text-align: center;
}

.jrats-mpi-qr-card__header {
    max-width: 480px;
}

.jrats-mpi-qr-card__title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: var(--jrats-mpi-text);
}

.jrats-mpi-qr-card__subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--jrats-mpi-text-muted);
    line-height: 1.55;
}

.jrats-mpi-qr-card__visual {
    display: flex;
    justify-content: center;
    width: 100%;
}

.jrats-mpi-qr-frame {
    background: #ffffff;
    border: 1px solid var(--jrats-mpi-border);
    border-radius: var(--jrats-mpi-radius-sm);
    padding: 16px;
    box-shadow: var(--jrats-mpi-shadow-md);
}

.jrats-mpi-qr-target {
    width: 256px;
    height: 256px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.jrats-mpi-qr-target canvas,
.jrats-mpi-qr-target img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Subtle placeholder before JS renders */
.jrats-mpi-qr-target:empty::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        var(--jrats-mpi-brand-softer) 0,
        var(--jrats-mpi-brand-softer) 8px,
        transparent 8px,
        transparent 16px
    );
    border-radius: 6px;
}

.jrats-mpi-qr-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--jrats-mpi-text-muted);
    word-break: break-all;
    max-width: 100%;
}

.jrats-mpi-qr-card__url-value {
    color: var(--jrats-mpi-brand);
    text-decoration: none;
    font-weight: 500;
}

.jrats-mpi-qr-card__url-value:hover,
.jrats-mpi-qr-card__url-value:focus-visible {
    text-decoration: underline;
    outline: none;
}

.jrats-mpi-qr-card__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 4px;
}

.jrats-mpi-qr-card__download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--jrats-mpi-brand);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 180ms var(--jrats-mpi-ease),
                transform 180ms var(--jrats-mpi-ease);
}

.jrats-mpi-qr-card__download:hover,
.jrats-mpi-qr-card__download:focus-visible {
    background: var(--jrats-mpi-brand-dark);
    transform: translateY(-1px);
    outline: none;
}

.jrats-mpi-qr-card__download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.jrats-mpi-qr-card__download-icon {
    font-size: 16px;
    line-height: 1;
}

.jrats-mpi-qr-card__preview {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border: 1px solid var(--jrats-mpi-border);
    border-radius: 999px;
    color: var(--jrats-mpi-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: border-color 180ms var(--jrats-mpi-ease),
                color 180ms var(--jrats-mpi-ease);
}

.jrats-mpi-qr-card__preview:hover,
.jrats-mpi-qr-card__preview:focus-visible {
    border-color: var(--jrats-mpi-brand);
    color: var(--jrats-mpi-brand);
    outline: none;
}

/* QR card — disabled/notice state */
.jrats-mpi-qr-card--notice {
    padding: 22px 20px;
}

.jrats-mpi-qr-card__notice {
    margin: 0;
    color: var(--jrats-mpi-text-muted);
    font-size: 14px;
    line-height: 1.55;
}

/* =========================================================================
 * Tab 4 — Identity form
 * ========================================================================= */

.jrats-mpi-identity-form {
    background: var(--jrats-mpi-surface);
    border: 1px solid var(--jrats-mpi-border);
    border-radius: var(--jrats-mpi-radius);
    padding: 22px;
    box-shadow: var(--jrats-mpi-shadow-sm);
}

.jrats-mpi-identity-form__actions {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--jrats-mpi-border);
    text-align: right;
}

.jrats-mpi-identity-form__submit {
    display: inline-flex;
    align-items: center;
    padding: 10px 24px;
    background: var(--jrats-mpi-brand);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 180ms var(--jrats-mpi-ease),
                transform 180ms var(--jrats-mpi-ease);
}

.jrats-mpi-identity-form__submit:hover,
.jrats-mpi-identity-form__submit:focus-visible {
    background: var(--jrats-mpi-brand-dark);
    transform: translateY(-1px);
    outline: none;
}

/* =========================================================================
 * Notice card (logged-out / no-tabs fallback)
 * ========================================================================= */

.jrats-mpi-card--notice {
    padding: 18px 20px;
    background: var(--jrats-mpi-surface);
    border: 1px solid var(--jrats-mpi-border);
    border-radius: var(--jrats-mpi-radius);
    color: var(--jrats-mpi-text-muted);
    font-size: 14px;
}
