/*
 * Eignaskanni — Vörumerki og stillingar (settings.html)
 * Page-specific styles on top of css/app-shell.css. The preview blocks read
 * their colours from --pv-* variables set by the page script, so they show
 * the brand being edited, not the one already saved.
 */

.settings-container { max-width: 860px; }

/* ────────── Sections (cards) ────────── */
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-card);
}
.settings-section > h2 {
    font-family: var(--serif);
    font-weight: 500;
    letter-spacing: -0.01em;
    font-size: 1.25rem;
    color: var(--ink);
    margin-bottom: 6px;
}
.settings-section > h2 + .form-group,
.settings-section > h2 + .plan-card { margin-top: 12px; }
.section-note { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; margin-bottom: 18px; max-width: 64ch; }

.settings-sub {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 26px 0 4px;
    padding-top: 20px;
    border-top: 1px solid var(--border-2);
}
.settings-sub + .section-note { margin-bottom: 14px; }

/* ────────── Forms ────────── */
.form-group { margin-bottom: 16px; min-width: 0; }
.form-group label,
.form-group .label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"] {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 15px;
}
.form-group input:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.form-group input::placeholder { color: var(--ink-3); opacity: 0.7; }
.form-group input:disabled { background: var(--surface-2); color: var(--ink-3); cursor: not-allowed; }
.form-group input[aria-invalid="true"] { border-color: var(--neg); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }
.field-error { font-size: 12.5px; color: var(--neg); margin-top: 5px; line-height: 1.5; font-weight: 500; }

.color-input-wrapper { display: flex; align-items: center; gap: 8px; }
.color-input-wrapper input[type="color"] {
    width: 46px;
    height: 44px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    background: var(--surface);
    flex-shrink: 0;
}
.color-input-wrapper input[type="text"] { flex: 1; min-width: 0; font-family: var(--mono); }

/* ────────── Logo upload ────────── */
.logo-upload { display: flex; align-items: center; gap: 16px; }
.logo-preview {
    width: 132px;
    height: 80px;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    font-size: 12px;
    color: var(--ink-3);
    text-align: center;
    flex-shrink: 0;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ────────── Toggle ────────── */
.toggle-group { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0; }
.toggle-group strong { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.toggle-switch { position: relative; width: 52px; height: 28px; flex-shrink: 0; }
.toggle-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--surface-2);
    border: 1px solid var(--ink-4);
    border-radius: 28px;
    transition: 0.25s;
}
.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(20, 22, 26, 0.3);
    transition: 0.25s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }
.toggle-switch input:focus-visible + .toggle-slider { box-shadow: 0 0 0 3px rgba(20, 22, 26, 0.28); }

/* ────────── Entitlement ────────── */
.entitlement-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 14px 16px;
    margin-bottom: 18px;
    background: var(--warn-50);
    border: 1px solid rgba(176, 122, 31, 0.28);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 13.5px;
    line-height: 1.55;
}
.entitlement-note p { flex: 1 1 320px; }
/* A plan without white-label sees what it would get, but cannot edit it. */
#whitelabelFields { border: 0; min-width: 0; }
#whitelabelFields:disabled { opacity: 0.55; }

/* ────────── Preview ────────── */
.preview-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.preview-card { min-width: 0; }
.preview-card > h4 {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 8px;
}
.preview-frame { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; }

.pv-shell { padding: 14px 12px 12px; }
.pv-brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px 12px; min-width: 0; }
.pv-mark {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--ink);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    overflow: hidden;
}
.pv-mark.has-logo { width: auto; background: transparent; border-radius: 4px; }
.pv-mark img { display: block; height: 100%; width: auto; max-width: 96px; object-fit: contain; }
.pv-brand > div { min-width: 0; }
.pv-name { font-weight: 600; font-size: 14px; line-height: 1.15; overflow-wrap: anywhere; }
.pv-sub { font-size: 11px; color: var(--ink-3); }
.pv-sub:empty { display: none; }
.pv-new {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 8px;
    background: var(--pv-primary-ink, var(--accent));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}
.pv-nav { display: flex; align-items: center; padding: 8px 11px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.pv-nav.active {
    background: var(--pv-tint, var(--accent-50));
    color: var(--pv-primary-ink, var(--accent));
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--pv-accent-ink, var(--accent));
}

.pv-pdf { padding: 16px 18px 14px; font-size: 11px; color: #1a1d23; }
.pv-band { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.pv-band span:first-child { flex: 5; background: var(--pv-primary, var(--accent)); }
.pv-band span:last-child { flex: 1; background: var(--pv-accent, var(--accent)); }
.pv-pdf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #1a1d23; padding-bottom: 10px; }
.pv-pdf-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pv-pdf-logo {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--pv-primary, var(--accent));
    color: var(--pv-on-primary, #fff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}
.pv-pdf-logo.has-logo { width: auto; background: transparent; border-radius: 4px; }
/* Without a company name the report keeps the default Eignaskanni header. */
.unbranded .pv-band { display: none; }
.unbranded .pv-pdf-logo:not(.has-logo) { background: #1a1d23; color: #f4f4f0; }
.pv-pdf-logo img { display: block; height: 100%; width: auto; max-width: 110px; object-fit: contain; }
.pv-pdf-brand > div { min-width: 0; }
.pv-pdf-name { font-weight: 700; font-size: 13.5px; overflow-wrap: anywhere; }
.pv-pdf-kind { color: #8b919b; font-size: 10px; }
.pv-pdf-meta { text-align: right; color: #8b919b; font-size: 10px; line-height: 1.5; flex-shrink: 0; }
.pv-pdf-title { font-family: var(--serif); font-size: 19px; font-weight: 500; margin: 12px 0 8px; }
.pv-pdf-value { display: flex; align-items: baseline; gap: 10px; background: #f4f4f0; border-radius: 8px; padding: 10px 12px; }
.pv-pdf-value small { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: #8b919b; font-weight: 600; }
.pv-pdf-value strong { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--pv-primary-ink, var(--accent)); white-space: nowrap; }
.pv-pdf-chip { margin-left: auto; padding: 1px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; background: var(--pv-accent-tint, var(--accent-50)); color: var(--pv-accent-ink, var(--accent)); }
.pv-contact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 9px 12px;
    border: 1px solid #e6e5df;
    border-left: 3px solid var(--pv-accent, var(--accent));
    border-radius: 8px;
}
.pv-contact > div { min-width: 0; overflow-wrap: anywhere; }
.pv-contact-label { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--pv-accent-ink, var(--accent)); }
.pv-contact-name { font-size: 12.5px; font-weight: 700; margin-top: 2px; }
.pv-contact-under { font-size: 10.5px; color: #4b525d; }
.pv-contact-reach { text-align: right; font-size: 10.5px; line-height: 1.55; max-width: 55%; }
.pv-pdf-foot { margin-top: 12px; padding-top: 8px; border-top: 1px solid #e6e5df; color: #8b919b; font-size: 9px; line-height: 1.5; }
.preview-note { font-size: 12.5px; color: var(--ink-3); margin-top: 10px; line-height: 1.5; }

/* ────────── Subscription ────────── */
.plan-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}
.plan-card .plan-name { font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.plan-card .plan-note { color: var(--ink-3); font-size: 0.85rem; margin-top: 2px; }
.subscription-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cancel-confirm { margin-top: 10px; color: var(--pos); font-size: 0.9rem; }
.cancel-confirm.error { color: var(--neg); }

/* ────────── Save ────────── */
.save-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.save-bar .btn { min-height: 46px; padding: 0 26px; font-size: 14.5px; }
.save-status { font-size: 13.5px; font-weight: 500; line-height: 1.5; }
.save-status.ok { color: var(--pos); }
.save-status.err { color: var(--neg); }
.save-status:empty { display: none; }

@media (max-width: 720px) {
    .form-row, .preview-grid { grid-template-columns: 1fr; }
    .logo-upload { flex-direction: column; align-items: flex-start; }
    .save-bar .btn { width: 100%; }
}
