/* What only the website has: the license window, the membership card and the policy pages (the pricing
   page's own look is in pricing.css). Everything else comes from autobuyer-ui.css, the extension's own stylesheet; */

/*////////////////////////////////////////////////////////////////////////*/
/* Small facts shown on the right of a row; */

.fact-chip {
    padding: calc(var(--screen) / 30) calc(var(--screen) / 12);
    border-radius: var(--ui-button-radius);
    background-color: var(--ui-raised-bg);
    border: var(--ui-raised-border);
    color: var(--ui-raised-ink);
    font-size: calc(var(--screen) / 11);
    white-space: nowrap;
}

/*////////////////////////////////////////////////////////////////////////*/
/* License key window shown after checkout; */

#license-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
}

#license-modal.visible {
    display: flex;
}

#license-modal-content {
    width: min(100%, 620px);
    box-sizing: border-box;
    margin: 0;
    padding-bottom: calc(var(--screen) / 9);
    background: var(--ui-float-bg);
    border: var(--ui-float-border);
    backdrop-filter: var(--ui-float-blur);
    -webkit-backdrop-filter: var(--ui-float-blur);
    animation: modalPop 0.4s var(--spring);
}

#license-modal-content header h4 {
    color: var(--ui-accent);
}

#license-modal-content .input,
#license-modal-content .input input {
    width: 100%;
}

#license-modal-content td:last-child {
    flex: 1.4;
}

#license-modal-content td:last-child .input {
    flex: 1;
}

#license-key {
    user-select: all;
    -webkit-user-select: all;
}

@keyframes modalPop {
    from { transform: scale(0.94); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Manage Membership: the member card beside the key lookup; */

.member-row {
    display: flex;
    align-items: center;
    gap: calc(var(--screen) / 7);
    padding: calc(var(--screen) / 18) 0;
}

.member-row .table {
    flex: 1;
    min-width: 0;
}

/* A row with one cell stacks its label, hint and contents; */
.settings-group .table td:only-child:not(.row-buttons) {
    display: block !important;
    flex: 1 1 100% !important;
    min-width: 0;
    max-width: 100%;
}

.member-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
    box-sizing: border-box;
    width: calc(var(--screen) * 2);
    aspect-ratio: 1.586;
    padding: calc(var(--screen) / 9);
    border-radius: calc(var(--screen) / 9);
    color: white;
    text-align: left;
    background: linear-gradient(135deg, #3ac7ff, #1d94c3);
}

[data-theme="dark"] .member-card {
    background: linear-gradient(135deg, #2a9fd6, #145f86);
}

.member-card-logo {
    width: 45%;
}

.member-card-tier {
    font-size: calc(var(--screen) / 3.4);
    font-weight: bold;
    line-height: 1;
}

.member-card-bottom {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: calc(var(--screen) / 11);
}

.membership-lookup {
    display: flex;
    align-items: center;
    gap: calc(var(--screen) / 22);
    margin: 0;
}

.membership-lookup .input {
    flex: 1;
    min-width: 0;
}

.membership-lookup .input input {
    width: 100%;
}

.membership-lookup .button {
    width: auto;
    height: auto;
    margin: 0;
    padding: calc(var(--screen) / 24) calc(var(--screen) / 10);
    font-size: calc(var(--screen) / 10);
    white-space: nowrap;
}

.membership-status-text {
    margin: calc(var(--screen) / 22) 0 0;
    color: var(--ui-muted);
    font-size: calc(var(--screen) / 12.5);
    font-weight: normal;
}

.membership-status-text:empty {
    display: none;
}

.membership-actions td.row-buttons {
    justify-content: flex-start !important;
}

.membership-actions[hidden],
.row-buttons a[hidden] {
    display: none !important;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Policy pages: plain readable text inside the cards; */

.policy-text {
    padding: calc(var(--screen) / 22) 0 calc(var(--screen) / 30);
    color: var(--ui-ink);
    font-size: calc(var(--screen) / 11);
    font-weight: normal;
    line-height: 1.55;
    letter-spacing: 0;
    white-space: normal !important;
    overflow-wrap: break-word;
    user-select: text;
    -webkit-user-select: text;
}

.policy-text p {
    margin: 0 0 0.7em;
}

.policy-text p:last-child {
    margin-bottom: 0;
}

.policy-text ol,
.policy-text ul {
    margin: 0 0 0.7em;
    padding-left: 1.4em;
}

.policy-text ol ul {
    margin: 0.3em 0 0.2em;
}

.policy-text h4 {
    margin: 0.7em 0 0;
    color: var(--ui-muted);
    font-size: 1em;
    font-weight: normal;
}

.policy-section {
    cursor: pointer;
}

.policy-preface {
    color: var(--ui-muted);
    font-size: calc(var(--screen) / 12.5);
}

.policy-text li {
    margin-bottom: 0.3em;
}

.policy-text strong {
    color: var(--ui-ink);
}

.policy-text a {
    color: var(--ui-accent);
}

.policy-updated {
    color: var(--ui-muted);
    font-size: calc(var(--screen) / 12.5);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Phones; */

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .fact-chip {
        font-size: 13px;
        padding: 4px 10px;
    }

    .member-row {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .member-card {
        width: min(100%, 300px);
        align-self: center;
        padding: 16px 18px;
        border-radius: 16px;
    }

    .member-card-tier { font-size: 30px; }
    .member-card-bottom { font-size: 13px; }

    .membership-lookup {
        flex-direction: column;
        align-items: stretch;
    }

    .membership-lookup .input,
    .membership-lookup .button {
        flex: none;
        box-sizing: border-box;
        width: 100%;
    }

    .membership-lookup .button {
        font-size: 16px;
        padding: 10px;
    }

    .membership-status-text {
        font-size: 14px;
    }

    #license-modal-content .table tr {
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px;
    }

    #license-modal-content .table td {
        margin: 0 !important;
    }

    .policy-text {
        font-size: 15px;
    }

    .policy-updated {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #license-modal-content {
        animation: none !important;
        transition: none !important;
    }
}
