/* ────────────────────────────────────────────────
   Portal Hooks - CSS for public-site integration
   Loaded only when portal_preview cookie is set (for now).
   Scoped under .bap-* to avoid conflicts with theme.
   ──────────────────────────────────────────────── */

/* ── Heart button (injected on plan cards) ── */
.bap-heart {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border: 1px solid #e2e8f0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 0;
}

.bap-heart:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.bap-heart svg {
    width: 18px;
    height: 18px;
    transition: all 0.2s;
}

.bap-heart--active {
    background: #fef2f2;
    border-color: #fca5a5;
}

.bap-heart--active svg {
    fill: #ef4444;
    stroke: #ef4444;
}

.bap-heart--inactive svg {
    fill: none;
    stroke: #64748b;
}

@keyframes bap-heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.bap-heart--pop {
    animation: bap-heart-pop 0.3s ease;
}

@media (max-width: 640px) {
    .bap-heart {
        top: 6px;
        right: 6px;
        width: 30px;
        height: 30px;
    }
    .bap-heart svg {
        width: 15px;
        height: 15px;
    }
}

/* ── Modal overlay ── */
.bap-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 31, 29, 0.55);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: bap-fade 0.18s ease;
}

.bap-overlay--open { display: flex; }

@keyframes bap-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Modal card ── */
.bap-modal {
    background: #fff;
    border-radius: 18px;
    padding: 32px 28px 28px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #0f172a;
    animation: bap-slide 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes bap-slide {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bap-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
}

.bap-modal__close:hover {
    background: #f1f5f9;
    color: #475569;
}

.bap-modal__title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
}

.bap-modal__subtitle {
    color: #64748b;
    font-size: 0.9375rem;
    line-height: 1.5;
    margin: 0 0 20px;
}

/* ── Google button ── */
.bap-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: #fff;
    color: #0f172a;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.bap-google-btn:hover,
.bap-google-btn:focus,
.bap-google-btn:active {
    border-color: #cbd5e1;
    background: #fafbfc;
    color: #0f172a !important;
    text-decoration: none !important;
}

.bap-google-btn span,
.bap-google-btn:hover span,
.bap-google-btn:focus span,
.bap-google-btn:active span {
    color: #0f172a !important;
    text-decoration: none !important;
}

.bap-google-btn svg {
    flex-shrink: 0;
}

/* ── Divider ── */
.bap-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #94a3b8;
    font-size: 0.75rem;
    margin: 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.bap-divider::before,
.bap-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

/* ── Form fields ── */
.bap-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.bap-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
}

.bap-input {
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    transition: all 0.15s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.bap-input:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

/* ── Checkbox consent ── */
.bap-consent {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    font-size: 0.8125rem;
    color: #475569;
    line-height: 1.4;
    margin: 4px 0 14px;
    cursor: pointer;
}

.bap-consent input {
    margin-top: 2px;
    flex-shrink: 0;
}

.bap-consent a {
    color: #0f766e;
}

/* ── Primary submit button ── */
.bap-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    background: #047857;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: -0.01em;
    box-shadow: 0 2px 8px rgba(4, 120, 87, 0.3);
}

.bap-submit:hover {
    background: #065f46;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(4, 120, 87, 0.4);
}

.bap-submit:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

/* ── Login link ── */
.bap-toggle {
    text-align: center;
    margin-top: 14px;
    font-size: 0.8125rem;
    color: #64748b;
}

.bap-toggle a {
    color: #0f766e;
    font-weight: 600;
    text-decoration: none;
}

.bap-toggle a:hover {
    text-decoration: underline;
}

/* ── Error banner ── */
.bap-error {
    padding: 10px 12px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 0.8125rem;
    margin-bottom: 12px;
    line-height: 1.4;
    display: none;
}

.bap-error--show { display: block; }

/* ── Toast (success notification) ── */
.bap-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #0f172a;
    color: #fff;
    padding: 12px 20px;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 100000;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.bap-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.bap-toast svg {
    flex-shrink: 0;
}

/* ── Consent prompt modal (for first alert/reminder email opt-in) ── */
.bap-modal--consent .bap-consent-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0 6px;
}

.bap-consent-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
}

.bap-consent-option:hover {
    border-color: #0f766e;
    background: #f0fdfa;
}

.bap-consent-option input {
    margin-top: 2px;
    flex-shrink: 0;
}

.bap-consent-option__main strong {
    display: block;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
    font-size: 0.9375rem;
}

.bap-consent-option__main span {
    color: #64748b;
    font-size: 0.8125rem;
}

/* ── Profile pill (logged-in indicator) ── */
.bap-profile-pill {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99990;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Inline placement (in theme header, next to nav/hamburger).
   Header uses max-width 1440px but most content wrappers use 1200px.
   Offset the pill left by half that diff to align with content right edge. */
.bap-profile-pill--inline {
    position: relative;
    bottom: auto;
    right: auto;
    z-index: 10;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    transform: translateX(calc(-1 * max(0px, (min(100vw, 1440px) - 1200px) / 2)));
}

/* Logged-out: "Log ind" button */
.bap-profile-pill__login {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    color: #0f172a;
    border: 1.5px solid #e2e8f0;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.bap-profile-pill__login:hover {
    border-color: #0f766e;
    color: #0f766e;
    background: #f0fdfa;
}

.bap-profile-pill__login svg {
    flex-shrink: 0;
}

.bap-profile-pill__btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0f766e;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bap-profile-pill__btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.bap-profile-pill__initial {
    line-height: 1;
    letter-spacing: -0.02em;
}

.bap-profile-pill__menu {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    border: 1px solid #e2e8f0;
    padding: 6px;
    animation: bap-pill-menu 0.15s ease;
}

/* When inline in header, menu drops DOWN from pill instead of up */
.bap-profile-pill--inline .bap-profile-pill__menu {
    bottom: auto;
    top: calc(100% + 10px);
}

/* Mobile: skjul login/profile-pillen helt. Portalen er endnu ikke launched,
   og den flydende pille ved siden af hamburgeren forvirrer mere end den gavner. */
@media (max-width: 900px) {
    .bap-profile-pill {
        display: none !important;
    }
}

@keyframes bap-pill-menu {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bap-profile-pill__header {
    padding: 10px 12px 10px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 4px;
}

.bap-profile-pill__name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.bap-profile-pill__label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 2px;
}

.bap-profile-pill__menu a,
.bap-profile-pill__menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    background: transparent;
    border: none;
    color: #334155;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    text-decoration: none;
    line-height: 1.2;
}

.bap-profile-pill__menu a:hover,
.bap-profile-pill__menu button:hover {
    background: #f1f5f9;
    color: #0f172a;
    text-decoration: none;
}

.bap-profile-pill__menu button[data-action="logout"] {
    color: #b91c1c;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
    border-radius: 0 0 8px 8px;
}

.bap-profile-pill__menu button[data-action="logout"]:hover {
    background: #fef2f2;
    color: #991b1b;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .bap-modal {
        padding: 24px 20px 20px;
    }
    .bap-modal__title {
        font-size: 1.125rem;
    }
    .bap-profile-pill {
        bottom: 16px;
        right: 16px;
    }
}
