/* =====================================================================
   Rally Design System — Dialog component
   Figma: rally-dialog-destructive-no (non-destructive confirm variant)
   Used by: Terms & Conditions forced-accept modal, Contact Us info dialog
   ===================================================================== */

/* Token mirror — keeps the dialog self-sufficient on pages that don't load
   rally-input-field.css (e.g. the post-login _LoginPartial host pages where
   only this stylesheet is linked). Values must stay in sync with rally-input-field.css. */
:root {
    --rally-surface: #fefefe;
    --rally-on-surface: #151515;
    --rally-on-surface-variant: #555555;
    --rally-border-color: #555555;
    --rally-focused-state: #2F2BDC;
    --rally-disabled-bg: #F3F3F3;
    --rally-disabled-text: #B0B0B0;
    --rally-spacing-xs: 4px;
    --rally-spacing-s: 8px;
    --rally-spacing-m: 16px;
    --rally-spacing-l: 24px;
    --rally-font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------------------------------------------------------------------
   Scrim — full-viewport translucent overlay
   z-index 1050 matches Bootstrap modal layering so site chrome stays below.
   pointer-events: all ensures the underlying page is fully blocked.
   Scrim click does NOT close the dialog (no click handler on scrim).
   --------------------------------------------------------------------- */
.rally-dialog-scrim {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.50);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

/* ---------------------------------------------------------------------
   Card — the white dialog box centered inside the scrim
   --------------------------------------------------------------------- */
.rally-dialog-card {
    background-color: var(--rally-surface);
    border-radius: 12px;
    padding: var(--rally-spacing-l);           /* 24px all sides */
    width: 75vw;                               /* 75% of viewport — exactly 1440px on a 1920×1080 screen */
    max-width: 1440px;                         /* caps growth on ultra-wide monitors */
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.16);
    font-family: var(--rally-font-family);
    color: var(--rally-on-surface);
    box-sizing: border-box;
}

.rally-dialog-card *,
.rally-dialog-card *::before,
.rally-dialog-card *::after {
    box-sizing: border-box;
}

/* ---------------------------------------------------------------------
   Header
   --------------------------------------------------------------------- */
.rally-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.rally-dialog-title {
    font-family: var(--rally-font-family);
    font-weight: 700;
    font-size: 24px;
    line-height: 32px;
    color: var(--rally-on-surface);
    margin: 0;
}

/* Optional subtitle — not used in T&C dialog but available for future dialogs */
.rally-dialog-subtitle {
    font-family: var(--rally-font-family);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    color: var(--rally-on-surface-variant);
    margin: var(--rally-spacing-xs) 0 0;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------------
   Body — scrollable content slot
   --------------------------------------------------------------------- */
.rally-dialog-body {
    flex: 1 1 auto;
    overflow-y: auto;
    margin-top: var(--rally-spacing-m);       /* 16px */
    /* overflow-y: auto forces overflow-x to auto, which clips focus rings on
       left-edge focusable content. The 4px inline padding gives the outline
       room. The matching negative margin keeps content visually flush. */
    padding-left: 4px;
    padding-right: 8px;                        /* breathing room before scrollbar */
    margin-left: -4px;
    /* Pin text + link colors so tenant-supplied v-html cannot drop below the WCAG 1.4.3 4.5:1 floor. */
    color: var(--rally-on-surface);
}

.rally-dialog-body a,
.rally-dialog-body a:visited {
    color: var(--rally-focused-state);
}

/* Scrollbar styling — subtle, matches Rally surface */
.rally-dialog-body::-webkit-scrollbar {
    width: 6px;
}
.rally-dialog-body::-webkit-scrollbar-track {
    background: transparent;
}
.rally-dialog-body::-webkit-scrollbar-thumb {
    background-color: var(--rally-border-color);
    border-radius: 3px;
}

/* ---------------------------------------------------------------------
   Inline checkbox row (standard single-checkbox case)
   --------------------------------------------------------------------- */
.rally-dialog-checkbox-row {
    display: flex;
    gap: var(--rally-spacing-s);               /* 8px */
    align-items: flex-start;
    margin-top: var(--rally-spacing-m);        /* 16px */
}

.rally-dialog-checkbox-row input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 3px;                           /* align with first text line */
    accent-color: var(--rally-focused-state);
    cursor: pointer;
}

.rally-dialog-checkbox-row label {
    font-family: var(--rally-font-family);
    font-size: 14px;
    line-height: 20px;
    color: var(--rally-on-surface-variant);
    margin: 0;
    cursor: pointer;
}

/* ---------------------------------------------------------------------
   Actions row — right-aligned buttons
   --------------------------------------------------------------------- */
.rally-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    margin-top: var(--rally-spacing-l);        /* 24px */
    flex-shrink: 0;
}

/* Override .rally-login-actions width:100% for dialog buttons (they should be auto-width) */
.rally-dialog-actions .btn {
    width: auto;
    min-width: 88px;
}

/* Disabled state for primary button */
.rally-dialog-actions .rally-btn-primary:disabled,
.rally-dialog-actions .rally-btn-primary[disabled] {
    background-color: var(--rally-disabled-bg);
    border-color: var(--rally-border-color);
    color: var(--rally-disabled-text);
    cursor: not-allowed;
}

.rally-dialog-actions .rally-btn-primary:disabled:hover,
.rally-dialog-actions .rally-btn-primary[disabled]:hover {
    background-color: var(--rally-disabled-bg);
    border-color: var(--rally-border-color);
    color: var(--rally-disabled-text);
}

/* ---------------------------------------------------------------------
   Info rows — plain stacked text lines used in the Contact Us dialog.
   No icons, no label prefixes — value only.
   --------------------------------------------------------------------- */
.rally-dialog-info-row {
    font-family: var(--rally-font-family);
    font-size: 16px;
    line-height: 1.5;
    color: var(--rally-on-surface);
    margin-top: var(--rally-spacing-xs);    /* 4px between rows */
}

.rally-dialog-info-row:first-child {
    margin-top: 0;
}

.rally-dialog-info-row a {
    color: inherit;
    text-decoration: underline;
}

.rally-dialog-info-row a:hover {
    color: var(--rally-focused-state);
}

/* Pre-message rich-HTML block — company-configured, shown above contact rows */
.rally-dialog-message {
    font-size: 16px;
    line-height: 1.5;
    font-weight: 600;
    margin-bottom: var(--rally-spacing-m);  /* 16px gap before contact rows */
}

/* ---------------------------------------------------------------------
   Close button — circular X icon in the top-right of the dialog header
   --------------------------------------------------------------------- */
.rally-dialog-close {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--rally-on-surface-variant, #555555);
    flex-shrink: 0;
    transition: background-color 120ms ease;
    padding: 0;
}

.rally-dialog-close:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.rally-dialog-close:focus-visible {
    outline: 2px solid var(--rally-focused-state, #2F2BDC);
    outline-offset: 2px;
}

.rally-dialog-close .fas {
    font-size: 16px;
}

/* ---------------------------------------------------------------------
   Mobile — bottom-sheet layout for phones (up to 575px covers all
   modern handsets; the old 400px cutoff missed many common widths).
   --------------------------------------------------------------------- */
@media (max-width: 575px) {
    .rally-dialog-scrim {
        align-items: flex-end;
    }

    .rally-dialog-card {
        padding: var(--rally-spacing-m);
        width: 100vw;
        min-height: 40vh;          /* feels substantial even with sparse content */
        max-height: 85dvh;
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0;
        margin: 0;
    }

    /* Drag-handle pill — visual affordance that this sheet can be dismissed */
    .rally-dialog-card::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background-color: var(--rally-divider, #dfdfdf);
        border-radius: 2px;
        margin: 0 auto var(--rally-spacing-m);
        flex-shrink: 0;
    }

    /* Bigger tap target for the header X button on mobile */
    .rally-dialog-close {
        width: 48px;
        height: 48px;
    }

    .rally-dialog-actions {
        flex-direction: column-reverse;
        gap: var(--rally-spacing-s);
    }

    .rally-dialog-actions .btn {
        width: 100%;
    }
}
