/* -------------------------------------------------------------------------
   LOGIN — MODULE CHOOSER

   Shown after the credentials check, in place of the login fields. One card per
   module the account may enter.
   ------------------------------------------------------------------------- */

.lm-head {
    width: 100%;
    text-align: center;
    margin-bottom: 18px;
}

.lm-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: #32325d;
    /* Sentence case, not capitalize: "Choose A Module" reads as a headline
       fighting the card labels below it. */
    text-transform: none;
}

.lm-sub {
    margin-top: 3px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: #8f97a8;
    text-transform: none;
}

/*
 * Only the list scrolls — the title and the back link stay put.
 *
 * Finance has eight roles, which pushed the card past the bottom of the
 * viewport and took "Back to modules" with it. The cap is in vh so it adapts to
 * the window rather than to a guessed row count, with a px ceiling so the list
 * does not sprawl on a tall monitor. The right padding is for the scrollbar:
 * without it the accent border on the cards sits under it.
 */
.lm-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 46vh;
    max-height: min(46vh, 430px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: #cfd6e6 transparent;
}

.lm-list::-webkit-scrollbar {
    width: 6px;
}

.lm-list::-webkit-scrollbar-track {
    background: transparent;
}

.lm-list::-webkit-scrollbar-thumb {
    background: #cfd6e6;
    border-radius: 3px;
}

.lm-list::-webkit-scrollbar-thumb:hover {
    background: #b6bfd4;
}

/* A card lifts on hover; without this the transform is clipped by the scroller. */
.lm-list > .lm-card {
    flex: 0 0 auto;
}

/* Short windows (laptops, split screens) give the list less room, not none. */
@media (max-height: 760px) {
    .lm-list {
        max-height: 38vh;
    }
}

@media (max-height: 560px) {
    .lm-list {
        max-height: 200px;
    }
}

.lm-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e6e9f0;
    border-left: 4px solid var(--lm-accent, #5e72e4);
    border-radius: 10px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    animation: lmCardIn 0.32s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    transition: background-color 0.18s ease, border-color 0.18s ease,
        box-shadow 0.18s ease, transform 0.18s ease;
}

.lm-card:hover {
    background: #f7f8fc;
    border-color: #d3d9e6;
    border-left-color: var(--lm-accent, #5e72e4);
    box-shadow: 0 6px 16px rgba(50, 50, 93, 0.09);
    transform: translateY(-1px);
}

.lm-card:active {
    transform: scale(0.985);
}

.lm-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 10px;
    background: var(--lm-accent, #5e72e4);
    color: #fff;
    font-size: 16px;
}

.lm-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.lm-card-label {
    font-size: 13px;
    font-weight: 600;
    color: #32325d;
    text-transform: capitalize;
}

.lm-card-desc {
    font-size: 10.5px;
    font-weight: 500;
    color: #aeb5c4;
    /* A sentence, so it keeps the casing it was written in — capitalize turned
       "Onsite appointments, visits and inspections" into Title Case. */
    text-transform: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lm-card-go {
    color: #c3c9d8;
    font-size: 12px;
    transition: color 0.18s ease, transform 0.18s ease;
}

.lm-card:hover .lm-card-go {
    color: var(--lm-accent, #5e72e4);
    transform: translateX(3px);
}

/* -------------------------------------------------------------------------
   SERVICE TILES

   The service step is the same question /login-dashboard asks in its modals, so
   it is asked the same way: two columns of solid colour tiles carrying the
   icon, the English name and the Arabic one. The module and role steps keep the
   list cards above — those are a different kind of choice (one line of
   explanation each), and the colour here comes from the master rows, which the
   modules do not have.
   ------------------------------------------------------------------------- */
.lm-list.lm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-content: start;
}

.lm-tile {
    /* The .ribbon-shine sweep is an absolutely positioned ::after, so the tile
       has to be its containing block and has to clip it — without the overflow
       the highlight runs out past the rounded corners. */
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 116px;
    padding: 18px 12px;
    border: 0;
    border-radius: 10px;
    background: var(--lm-tile, #5e72e4);
    color: #fff;
    text-align: center;
    cursor: pointer;
    animation: lmCardIn 0.32s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    transition: box-shadow 0.18s ease, transform 0.18s ease, filter 0.18s ease;
}

/* The sweep sits under the label, not over it. */
.lm-tile-icon,
.lm-tile-label,
.lm-tile-label-ar {
    position: relative;
    z-index: 1;
}

.lm-tile:hover {
    filter: brightness(1.08);
    box-shadow: 0 8px 18px rgba(50, 50, 93, 0.22);
    transform: translateY(-2px);
}

.lm-tile:active {
    transform: scale(0.97);
}

.lm-tile-icon {
    font-size: 24px;
    line-height: 1;
}

.lm-tile-label {
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.25;
    /* The names arrive already cased from the master rows ("Export Without
       Plate Number"); capitalize would only fight them. */
    text-transform: none;
}

.lm-tile-label-ar {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.85);
    direction: rtl;
}

/* An odd tile last in the grid centres on its own row rather than hugging the
   left column — seven registration types should not read as a broken grid. */
.lm-tile:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: calc(50% - 5px);
    justify-self: center;
}

.lm-back {
    display: block;
    margin: 16px auto 0;
    border: 0;
    background: none;
    color: #8f97a8;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    cursor: pointer;
    transition: color 0.18s ease;
}

.lm-back:hover {
    color: #5e72e4;
}

/*
 * The cards and the back link are <button>s, and the theme
 * (argon.min.css) puts `outline: -webkit-focus-ring-color auto 5px` on
 * `button:focus`. Clicking leaves focus behind, so the ring stayed drawn around
 * "Back to login" after the click — read as a stuck active state.
 *
 * The ring is dropped for pointer focus only. :focus-visible still fires for
 * keyboard users, who get an on-brand ring instead: removing the indicator
 * outright would make this screen impossible to navigate by keyboard.
 */
.lm-card:focus,
.lm-tile:focus,
.lm-back:focus {
    outline: none;
    box-shadow: none;
}

.lm-card:focus-visible,
.lm-tile:focus-visible,
.lm-back:focus-visible {
    outline: 2px solid #5e72e4;
    outline-offset: 2px;
    border-radius: 6px;
}

@keyframes lmCardIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lm-card,
    .lm-tile {
        animation: none;
        transition: none;
    }

    .lm-card:hover,
    .lm-card:active,
    .lm-tile:hover,
    .lm-tile:active {
        transform: none;
    }

    /* The shared .ribbon-shine sweep loops for as long as the pointer rests on
       the tile, which is exactly the kind of motion this query exists to stop. */
    .lm-tile:hover::after {
        animation: none;
        content: none;
    }

    .lm-card-go,
    .lm-back {
        transition: none;
    }
}
