/* ---------- Base ---------- */

html, body {
    margin: 0;
    padding: 0;
    background: #1a222d;
    color: #ffffff;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
    overflow-x: hidden;
}

* { box-sizing: border-box; }

a { color: inherit; }

h1, h2, h3, h4, h5 {
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

h1:focus { outline: none; }

/* ---------- Blazor validation defaults ---------- */

.valid.modified:not([type=checkbox]) { outline: 1px solid #46954a; }
.invalid { outline: 1px solid #e5534b; }
.validation-message { color: #e5534b; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred." }

.darker-border-checkbox.form-check-input { border-color: #929292; }

/* ---------- Scroll reveal ----------
   Progressive enhancement: landing.js adds `.js-reveal` only after the
   reveal path is ready. With JS disabled or blocked, content stays visible.
   Animates the standalone `translate` property, NOT `transform`, so elements
   that carry their own transform (.anchor-frame, .price-card-pro,
   .hero-product) keep it instead of being flattened when revealed. */

.js-reveal [data-reveal] {
    opacity: 0;
    translate: 0 24px;
    transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
                translate 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
    will-change: opacity, translate;
}

.js-reveal [data-reveal].is-revealed {
    opacity: 1;
    translate: 0 0;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .js-reveal [data-reveal] {
        opacity: 1;
        translate: none;
        transition: none;
    }
}

/* ---------- Lightbox ---------- */

[data-zoom] {
    cursor: zoom-in;
}

[data-zoom][role="button"]:focus-visible {
    outline: 3px solid rgba(114, 217, 154, 0.7);
    outline-offset: 4px;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 12, 18, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    padding: 32px;
}

.lightbox[hidden] {
    display: none !important;
}

.lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
    transform: scale(0.96);
    transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lightbox.is-open .lightbox-img {
    transform: scale(1);
}

.lightbox-caption {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #c2c5cc;
    font-size: 14px;
    background: rgba(30, 39, 52, 0.85);
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    max-width: calc(100% - 64px);
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(30, 39, 52, 0.85);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.lightbox-close:hover {
    background: rgba(51, 147, 96, 0.25);
    border-color: rgba(51, 147, 96, 0.5);
}

@media (max-width: 640px) {
    .lightbox { padding: 16px; }
    .lightbox-img { max-height: calc(100vh - 100px); }
    .lightbox-close { top: 12px; right: 12px; width: 38px; height: 38px; font-size: 24px; }
    .lightbox-caption { bottom: 12px; font-size: 12px; padding: 6px 12px; }
}

/* ---------- Account portal ---------- */

.portal {
    min-height: 70vh;
    padding: 80px 28px 64px;
    display: flex;
    justify-content: center;
}

.portal-card {
    width: 100%;
    max-width: 460px;
    padding: 40px 36px;
    background: linear-gradient(180deg, rgba(39,49,63,0.7), rgba(30,39,52,0.45));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
}

.portal-card-wide { max-width: 920px; }

.portal h1 {
    font-size: 28px;
    color: #fff;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.portal-sub {
    color: #c2c5cc;
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 24px;
}

.portal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.portal-field label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8b95a3;
    font-weight: 600;
}

.portal-field input {
    background: rgba(22,29,39,0.7);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
}

.portal-field input:focus {
    outline: none;
    border-color: rgba(51,147,96,0.6);
    box-shadow: 0 0 0 3px rgba(51,147,96,0.18);
}

.portal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.portal-btn:hover { background: rgba(255,255,255,0.08); }
.portal-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.portal-btn-primary {
    background: #339360;
    border-color: #46954a;
    box-shadow: 0 6px 16px rgba(51,147,96,0.25);
}
.portal-btn-primary:hover { background: #46954a; }

.portal-btn-ghost {
    background: transparent;
    color: #c2c5cc;
}

.portal-btn-danger {
    border-color: rgba(229,83,75,0.4);
    color: #ff938b;
    background: rgba(229,83,75,0.10);
}
.portal-btn-danger:hover { background: rgba(229,83,75,0.18); color: #fff; }

.portal-btn-sm { padding: 6px 12px; font-size: 12.5px; }

.portal-error {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(229,83,75,0.10);
    border: 1px solid rgba(229,83,75,0.30);
    border-radius: 8px;
    color: #ff938b;
    font-size: 13.5px;
}

.portal-success {
    padding: 16px 18px;
    background: rgba(51,147,96,0.10);
    border: 1px solid rgba(51,147,96,0.30);
    border-radius: 10px;
    color: #c2c5cc;
    font-size: 14px;
    line-height: 1.55;
}

.portal-success strong { color: #fff; display: block; margin-bottom: 4px; }

.portal-empty {
    padding: 14px 16px;
    background: rgba(22,29,39,0.55);
    border: 1px dashed rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #8b95a3;
    font-size: 14px;
    margin: 12px 0;
}

.portal-foot {
    margin-top: 28px;
    text-align: center;
    color: #8b95a3;
    font-size: 13px;
}

.portal-foot a { color: #c2c5cc; text-decoration: none; }
.portal-foot a:hover { color: #fff; }

.portal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    gap: 16px;
}

.license-block {
    padding: 24px;
    background: rgba(22,29,39,0.55);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    margin-bottom: 16px;
}

.license-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.license-tier {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8ddb8c;
    font-weight: 700;
    margin-bottom: 6px;
}

.license-key code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 16px;
    color: #fff;
    background: rgba(0,0,0,0.30);
    padding: 6px 10px;
    border-radius: 6px;
    letter-spacing: 0.04em;
}

.license-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.license-state {
    display: inline-block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}

.license-state-active { background: rgba(70,149,74,0.18); color: #8ddb8c; border: 1px solid rgba(70,149,74,0.40); }
.license-state-expired { background: rgba(218,170,63,0.18); color: #fbe090; border: 1px solid rgba(218,170,63,0.40); }
.license-state-revoked { background: rgba(229,83,75,0.18); color: #ff938b; border: 1px solid rgba(229,83,75,0.40); }
.license-state-unknown { background: rgba(120,130,144,0.18); color: #c2c5cc; border: 1px solid rgba(120,130,144,0.40); }

.license-expires {
    font-size: 12px;
    color: #8b95a3;
}

.license-block h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8b95a3;
    font-weight: 600;
    margin: 0 0 12px;
}

.device-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.device-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8b95a3;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.device-table td {
    padding: 12px;
    color: #c2c5cc;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.device-table tr:last-child td { border-bottom: none; }

.portal-account .portal-foot { margin-top: 40px; }

@media (max-width: 640px) {
    .portal { padding: 48px 16px 40px; }
    .portal-card { padding: 28px 22px; }
    .portal-card-wide { padding: 28px 22px; }
    .device-table th:nth-child(3), .device-table td:nth-child(3) { display: none; }
    .license-head { flex-direction: column; }
    .license-meta { align-items: flex-start; }
}

/* ---------- 404 ---------- */

.notfound {
    min-height: 70vh;
    padding: 96px 28px 64px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.notfound-card {
    width: 100%;
    max-width: 560px;
    padding: 48px 40px 40px;
    text-align: center;
    background: linear-gradient(180deg, rgba(39,49,63,0.6), rgba(30,39,52,0.35));
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 18px;
}

.notfound-code {
    font-size: 80px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(180deg, #339360 0%, #1e6b3f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 16px;
}

.notfound-card h1 {
    font-size: 26px;
    color: #fff;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.notfound-sub {
    color: #c2c5cc;
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 28px;
}

.notfound-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.notfound-btn {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: #c2c5cc;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.notfound-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.notfound-btn-primary {
    background: #339360;
    border-color: #46954a;
    color: #fff;
}

.notfound-btn-primary:hover {
    background: #46954a;
    color: #fff;
}

@media (max-width: 640px) {
    .notfound { padding: 56px 16px 40px; }
    .notfound-card { padding: 36px 24px 28px; }
    .notfound-code { font-size: 64px; }
    .notfound-card h1 { font-size: 22px; }
}

/* ---------- Companion device management (P3-B5 UI) ---------- */
.companion-block { margin-top: 22px; }

.portal-input {
    width: 100%;
    padding: 8px 10px;
    background: rgba(12,16,22,0.65);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px;
    color: #eef0f3;
    font-size: 13.5px;
}
.portal-input:focus { outline: none; border-color: rgba(120,175,255,0.5); }
.portal-input-sm { max-width: 220px; }

.device-actions { white-space: nowrap; }
.device-actions .portal-btn-sm + .portal-btn-sm { margin-left: 6px; }

.device-revoked td { opacity: 0.55; }
.device-revoked-tag {
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    color: #ff938b;
    background: rgba(229,83,75,0.12);
    border: 1px solid rgba(229,83,75,0.30);
}

.companion-note { margin-top: 10px; font-size: 12.5px; }
