/*
   Agent Zone shared UI (Components/Shared).
   Same look as the App Settings cards. Layout and styling only:
   editors and buttons stay DevExpress.
*/

/* Layout */
.az-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.az-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.az-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
}

/* Phone: prefix + number */
.az-row-phone {
    display: grid;
    grid-template-columns: 130px 1fr;
    column-gap: 12px;
}

@media (max-width: 760px) {
    .az-grid-2,
    .az-row-2 {
        grid-template-columns: 1fr;
    }
}

/* Card */
.az-card {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    min-width: 0;
}

/* A card stretched taller than its content (h-100 next to a taller card): its az-stack
   spreads the sections over the height instead of leaving a gap at the bottom. */
.az-card.az-fill {
    display: flex;
    flex-direction: column;
}

.az-card.az-fill > .az-stack {
    flex: 1 1 auto;
    justify-content: space-between;
}

.az-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #000;
}

.az-card-title::before {
    content: "";
    width: 4px;
    height: 14px;
    background: #FFCC00;
}

/* Field */
.az-field {
    margin-bottom: 14px;
    min-width: 0;
}

.az-card > .az-field:last-child,
.az-card > :last-child > .az-field {
    margin-bottom: 0;
}

.az-field-label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #52525b;
}

.az-field-required {
    margin-left: 2px;
    color: #dc2626;
}

.az-field-hint {
    margin-top: 4px;
    font-size: 11.5px;
    color: #71717a;
}

.az-field .validation-message {
    margin-top: 4px;
    font-size: 12px;
    color: #dc2626;
}

/* Checkbox followed by a short text or link */
.az-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid #e4e4e7;
    font-size: 13px;
}

.az-check-row .az-link-button {
    padding: 0;
    margin: 0;
}

/* Popup body: soft grey so cards stand out */
.az-popup-body {
    background: #f7f7f8;
    padding: 20px !important;
    max-height: calc(90vh - 130px);
    overflow-y: auto;
}

/* Popup window: 6px corners, like the cards */
.az-popup,
.az-popup.dxbl-popup,
.az-popup .dxbl-popup,
.az-popup .dxbl-popup-content {
    --dxbl-popup-border-radius: 6px;
    border-radius: 6px !important;
}

/* Action row under a form: buttons right, optional Back on the left (CssClass="me-auto") */
.az-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

/* Auth frame (AzAuthFrame): full-screen split, photo left, form right */
.az-auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    height: 100vh;
    padding: 16px;
    background: #f7f7f8;
}

.az-auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 28%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.7) 100%),
        url('../images/banner-home-page-2025-2.jpg') 72% center / cover no-repeat;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.az-auth-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Pill link on the photo, like a glass button */
.az-auth-site-link {
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    font-size: 13px;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.az-auth-site-link:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.az-auth-logo {
    width: 120px;
    height: auto;
}

.az-auth-tagline {
    max-width: 420px;
}

.az-auth-tagline-title::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    margin-bottom: 16px;
    background: #FFCC00;
}

.az-auth-tagline-title {
    margin-bottom: 8px;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
}

.az-auth-tagline-text {
    font-size: 15px;
    opacity: 0.9;
}

/* The app turns off page scroll (site.css html/body), so the form column scrolls itself */
.az-auth-main {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 0;
    overflow-y: auto;
    padding: 40px 32px;
}

.az-auth-content {
    width: 100%;
    max-width: 640px;
}

/* Short forms (Login): narrower column, vertically centred */
.az-auth-content-narrow {
    max-width: 420px;
    margin: auto 0;
}

.az-auth-logo-mobile {
    display: none;
    width: 96px;
    height: auto;
    margin-bottom: 24px;
}

.az-auth-title {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 800;
    color: #000;
}

.az-auth-subtitle {
    margin: 0 0 24px;
    font-size: 14px;
    color: #52525b;
}

.az-auth-links {
    margin-top: 24px;
    font-size: 13px;
    color: #52525b;
    text-align: center;
}

.az-auth-links a {
    margin-left: 4px;
    font-weight: 600;
    color: #000;
}

@media (max-width: 900px) {
    .az-auth {
        grid-template-columns: 1fr;
        padding: 0;
    }

    .az-auth-hero {
        display: none;
    }

    .az-auth-logo-mobile {
        display: block;
    }

    .az-auth-main {
        padding: 24px 16px;
    }
}

/* Steps (AzSteps): segmented progress bar */
.az-steps {
    display: flex;
    gap: 8px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.az-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    color: #a1a1aa;
}

.az-step::before {
    content: "";
    height: 4px;
    background: #e4e4e7;
}

.az-step.is-done {
    color: #52525b;
}

.az-step.is-done::before {
    background: #000;
}

.az-step.is-active {
    color: #000;
}

.az-step.is-active::before {
    background: #FFCC00;
}

.az-step-index {
    margin-right: 6px;
}

/* HTML document shown in a popup (AppHtmlPopup: agreement, terms) */
.az-html-frame {
    display: block;
    width: 100%;
    height: 60vh;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    background: #fff;
}

/* Input with a button beside it (e.g. Password + Generate) */
.az-input-action {
    display: flex;
    align-items: center;
    gap: 8px;
}

.az-input-action > :first-child {
    flex: 1;
    min-width: 0;
}

/* Page header: bold title with a black line under it, as on the Agents and Accounting pages. */
.az-page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 1.5rem 0 1rem;
    border-bottom: 2px solid #111;
}

.az-page-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -0.5px;
}

/* State colours for a profit / loss block: put az-state-success or az-state-danger on a parent,
   then children read --az-state (text, fill), --az-state-bg and --az-state-border. */
.az-state-success {
    --az-state: #16a34a;
    --az-state-bg: #f0fdf4;
    --az-state-border: #bbf7d0;
}

.az-state-danger {
    --az-state: #dc2626;
    --az-state-bg: #fef2f2;
    --az-state-border: #fecaca;
}

/* Tag: short label with angled corners. Takes the state colours of its parent (az-state-*), grey otherwise. */
.az-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 4px 10px 4px 10px;
    border: 1px solid var(--az-state-border, #e4e4e7);
    background: var(--az-state-bg, #f4f4f5);
    color: var(--az-state, #18181b);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.az-tag-lg {
    padding: 4px 16px;
    font-size: 1.1rem;
}

.az-tag-dark {
    padding: 2px 8px;
    border-color: #18181b;
    background: #18181b;
    color: #fff;
    font-size: 11px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Amber tag, for counts of things to look at (e.g. the warnings count). */
.az-tag-warning {
    border-color: #fde68a;
    background: #fef9c3;
    color: #854d0e;
}

/* Warnings card (AzWarnings): clickable header, and one block per warning inside. */
.az-warnings-closed {
    cursor: pointer;
}

.az-warnings-header {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
}

.az-warning {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid #fde68a;
    border-radius: 6px;
    background: #fffbeb;
}

.az-warning-title {
    color: #854d0e;
    font-size: 13px;
    font-weight: 700;
}

.az-warning-text {
    color: #52525b;
    font-size: 13px;
}

.az-warning-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Segmented control: a row of options, the chosen one dark. Put "active" on the chosen button. */
.az-segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 3px;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    background: #f4f4f5;
}

.az-segmented > button {
    padding: 6px 14px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #71717a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.az-segmented > button:hover {
    color: #18181b;
}

.az-segmented > button.active {
    background: #18181b;
    color: #fff;
}

.az-segmented > button:focus-visible {
    outline: 2px solid #FFCC00;
    outline-offset: 1px;
}

/* Smaller segmented control, for a secondary choice next to a card title. */
.az-segmented-sm > button {
    padding: 3px 10px;
    font-size: 12px;
}

/* Gauge: a thick bar with a draggable handle, a labelled marker and clickable ticks.
   Set inline on .az-gauge-track: --az-gauge-fill (value %) and --az-gauge-mark (marker %),
   and az-state-* on a parent for the colours. */
.az-gauge {
    padding: 20px 24px;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    background: #fafafa;
}

.az-gauge-zones {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.az-gauge-zones > :first-child { color: #dc2626; }
.az-gauge-zones > :last-child { color: #16a34a; }

.az-gauge-track {
    position: relative;
    height: 24px;
    border-radius: 12px;
    background: linear-gradient(to right, #fee2e2 var(--az-gauge-mark, 0%), #f3f4f6 var(--az-gauge-mark, 0%));
}

.az-gauge-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--az-gauge-fill, 0%);
    border-radius: 12px;
    background: var(--az-state, #18181b);
    pointer-events: none;
}

.az-gauge-mark {
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: var(--az-gauge-mark, 0%);
    width: 2px;
    background: #18181b;
    transform: translateX(-50%);
    pointer-events: none;
}

.az-gauge-mark > .az-tag {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -4px);
}

.az-gauge-range {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 24px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: ew-resize;
}

.az-gauge-range::-moz-range-track {
    background: transparent;
}

.az-gauge-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border: 3px solid var(--az-state, #18181b);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: grab;
}

.az-gauge-range::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border: 3px solid var(--az-state, #18181b);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: grab;
}

.az-gauge-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px #FFCC00; }
.az-gauge-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px #FFCC00; }

.az-gauge-ticks {
    position: relative;
    height: 22px;
    margin-top: 14px;
}

.az-gauge-ticks > button {
    position: absolute;
    padding: 0;
    border: 0;
    background: none;
    color: #71717a;
    font-size: 12px;
    white-space: nowrap;
    transform: translateX(-50%);
    cursor: pointer;
}

.az-gauge-ticks > button:hover,
.az-gauge-ticks > button.active {
    color: #18181b;
}

.az-gauge-ticks > button.active {
    font-weight: 700;
}

/* Metric cards in a row, joined by operators (−, =). A card has a top (total) and a bottom (per unit). */
.az-metrics {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.az-metrics-op {
    display: flex;
    align-items: center;
    color: #a1a1aa;
    font-size: 20px;
    user-select: none;
}

.az-metric {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    background: #fff;
}

.az-metric-top {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
}

.az-metric-bottom {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: auto;
    padding: 12px 16px 16px;
    border-top: 1px solid #f4f4f5;
    background: #fafafa;
}

.az-metric-title {
    color: #18181b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.az-metric-sub {
    color: #a1a1aa;
    font-size: 11px;
}

.az-metric-caption {
    color: #71717a;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.az-metric-value {
    color: #18181b;
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.az-metric-unit {
    color: #18181b;
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.az-metric-hint {
    color: #71717a;
    font-size: 12px;
}

.az-metric.az-state-success,
.az-metric.az-state-danger {
    border-color: var(--az-state-border);
    background: var(--az-state-bg);
}

.az-metric.az-state-success .az-metric-value,
.az-metric.az-state-success .az-metric-unit,
.az-metric.az-state-danger .az-metric-value,
.az-metric.az-state-danger .az-metric-unit {
    color: var(--az-state);
}

.az-metric.az-state-success .az-metric-bottom,
.az-metric.az-state-danger .az-metric-bottom {
    border-top-color: var(--az-state-border);
    background: rgba(255, 255, 255, 0.45);
}

/* Wrap the metric cards by the space they get (inside a narrow card too), not by the screen. */
.az-metrics-box {
    container-type: inline-size;
}

@container (max-width: 900px) {
    .az-metrics {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .az-metrics-op {
        display: none;
    }

    .az-metrics > .az-metric:last-child {
        grid-column: span 2;
    }
}

@container (max-width: 480px) {
    .az-metrics {
        grid-template-columns: minmax(0, 1fr);
    }

    .az-metrics > .az-metric:last-child {
        grid-column: span 1;
    }
}
