/*!
 * WHMCS-eFactura - RO e-Factura (ANAF) addon for WHMCS
 *
 * Copyright (C) 2026 S.C. CROCKY S.R.L.
 * SPDX-License-Identifier: GPL-3.0-only
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 3, with the
 * additional permission and additional terms in ADDITIONAL-TERMS.md.
 * See the LICENSE and ADDITIONAL-TERMS.md files for details.
 */

/*
 * Client forms. Colors, borders and radii come from the Lagom 2 CSS
 * variables when the theme defines them, with fallbacks for the other
 * themes and the admin area.
 */

.efactura-hidden {
    display: none !important;
}

.efactura-hint,
.efactura-error {
    display: block;
    margin-top: 6px;
    font-size: 0.875em;
    line-height: 1.4;
}

.efactura-hint {
    color: var(--brand-warning, #a14a00);
}

.efactura-error {
    color: var(--brand-danger, #c0262d);
}

/* Billing details section */

.efactura-billing {
    margin: 0 0 4px;
}

.efactura-type {
    min-width: 0;
    margin: 0 0 16px;
    padding: 0;
    border: 0;
}

.efactura-type-legend {
    width: auto;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    font-size: inherit;
    font-weight: 500;
    line-height: inherit;
    color: var(--input-label-color, inherit);
}

.efactura-type-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 12px;
}

.efactura-type-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--input-border-color, var(--ui-block-border-color, #ced4da));
    border-radius: var(--input-border-radius, var(--border-radius-base, 6px));
    background: var(--input-bg, var(--ui-block-bg, #fff));
    font-weight: 400;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.efactura-type-option.is-active {
    border-color: var(--brand-primary, #336699);
    box-shadow: inset 0 0 0 1px var(--brand-primary, #336699);
}

.efactura-type-option:focus-within {
    outline: 2px solid var(--brand-primary, #336699);
    outline-offset: 2px;
}

.efactura-type-radio {
    flex: none;
    margin: 3px 0 0;
    accent-color: var(--brand-primary, #336699);
}

.efactura-type-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.efactura-type-title {
    font-weight: 500;
    color: var(--text-heading-color, inherit);
}

.efactura-type-hint {
    font-size: 0.875em;
    color: var(--text-lighter-color, #6c757d);
}

.efactura-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    column-gap: 24px;
}

.efactura-vat {
    grid-column: 1 / -1;
    margin: 0 0 16px;
}

.efactura-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 400;
    color: var(--text-body-color, inherit);
    cursor: pointer;
}

.efactura-grid > .efactura-wide {
    grid-column: 1 / -1;
}

.efactura-check-input {
    margin: 0;
    accent-color: var(--brand-primary, #336699);
}

.efactura-vat-code {
    margin-left: 12px;
    font-weight: 500;
    color: var(--text-heading-color, inherit);
}

.efactura-vat-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.875em;
    color: var(--text-lighter-color, #6c757d);
}

/* Read-only summary in the profile */

.efactura-summary {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px 16px;
    margin: 0 0 12px;
}

.efactura-summary-row {
    display: contents;
}

.efactura-summary dt {
    font-weight: 400;
    color: var(--text-lighter-color, #6c757d);
}

.efactura-summary dd {
    margin: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
    color: var(--text-heading-color, inherit);
}

.efactura-lock-note {
    margin: 0 0 16px;
    font-size: 0.875em;
    color: var(--text-lighter-color, #6c757d);
}

/* ANAF lookup */

.efactura-lookup-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.efactura-lookup-row > input {
    flex: 1 1 auto;
    min-width: 0;
}

.efactura-lookup-button {
    flex: none;
    white-space: nowrap;
}

.efactura-lookup-button[aria-busy="true"] {
    cursor: progress;
    opacity: 0.7;
}

.efactura-lookup-status:empty {
    display: none;
}

.efactura-lookup-status {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0 0 16px;
    font-size: 0.875em;
    line-height: 1.4;
    color: var(--text-lighter-color, #6c757d);
}

.efactura-lookup-ok .efactura-lookup-message {
    color: var(--brand-success, #1e7b32);
}

.efactura-lookup-error .efactura-lookup-message {
    color: var(--brand-danger, #c0262d);
}

.efactura-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.efactura-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.8125em;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.efactura-badge-ok {
    color: var(--brand-success, #1e7b32);
    background: color-mix(in srgb, var(--brand-success, #1e7b32) 12%, transparent);
}

.efactura-badge-muted {
    color: var(--text-body-color, #495057);
    background: color-mix(in srgb, var(--text-body-color, #495057) 10%, transparent);
}

.efactura-badge-warn {
    color: var(--brand-warning, #a14a00);
    background: color-mix(in srgb, var(--brand-warning, #a14a00) 12%, transparent);
}

.efactura-badge-danger {
    color: var(--brand-danger, #c0262d);
    background: color-mix(in srgb, var(--brand-danger, #c0262d) 12%, transparent);
}

.efactura-lookup-panel {
    grid-column: 1 / -1;
    margin: 10px 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--ui-block-border-color, #dee2e6);
    border-radius: var(--border-radius-base, 6px);
    background: var(--ui-block-bg, #fff);
}

.efactura-lookup-panel-title {
    margin: 0 0 8px;
    font-weight: 500;
    color: var(--text-heading-color, inherit);
}

.efactura-lookup-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.efactura-lookup-item {
    padding: 8px 0;
    border-top: 1px solid var(--ui-block-border-color, #e9ecef);
}

.efactura-lookup-item:first-child {
    border-top: 0;
}

.efactura-lookup-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 500;
    cursor: pointer;
}

.efactura-lookup-item.is-locked .efactura-lookup-item-head {
    cursor: default;
}

.efactura-lookup-values {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0 0 24px;
    font-size: 0.875em;
    overflow-wrap: anywhere;
}

.efactura-lookup-now {
    color: var(--text-lighter-color, #6c757d);
}

.efactura-lookup-anaf {
    color: var(--text-heading-color, inherit);
}

.efactura-lookup-locked {
    color: var(--brand-warning, #a14a00);
}

.efactura-lookup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

/* Phones: the ANAF button goes under the CUI, at full width. */
@media (max-width: 479.98px) {
    .efactura-lookup-row {
        flex-direction: column;
    }

    .efactura-lookup-button {
        width: 100%;
    }

    .efactura-vat-code {
        display: block;
        margin: 4px 0 0 24px;
    }
}
