/* e.emach.pl v9.8.244 — isolated device tile header
   -------------------------------------------------
   This component intentionally uses device-tile-* class names. The historical
   device-card-header/copy/type/description/id/live-status rules in style.css
   cannot match it, which removes the old cascade from card-header geometry.

   Information hierarchy:
     1. label + semantic status
     2. description
     3. numeric device ID + device type

   Optional description/type rows collapse. All identifying metadata stays
   left-aligned; the right side is reserved exclusively for connectivity.
*/

.device-card .device-tile-header.device-card-header-clickable {
    position: relative;
    display: grid;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 72px;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    column-gap: var(--space-2);
    padding: 7px 10px 7px var(--space-3);
    border: 0;
    border-bottom: 1px solid var(--iot-card-panel-border);
    border-radius: 0;
    background: linear-gradient(145deg, var(--iot-card-header), var(--iot-card-header-2));
    color: var(--device-card-header-text);
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.device-card .device-tile-header.device-card-header-clickable:focus-visible {
    outline: 2px solid var(--brand-focus);
    outline-offset: -2px;
}

.device-card .device-tile-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    align-self: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--icon-neutral);
    font-size: 1.1875rem;
    line-height: 1;
    box-shadow: none;
}


.device-card .device-tile-copy {
    display: grid;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    grid-auto-flow: row;
    grid-auto-rows: min-content;
    align-content: space-between;
    justify-items: stretch;
    row-gap: 2px;
    margin: 0;
    padding: 0;
    text-align: left;
    overflow: hidden;
}

/* Connectivity is an overlay at the card's top-right. Only lines that can
   reach its vertical area reserve width, and only while the icon is present. */
.device-card .device-tile-title-row {
    display: flex;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding-right: 0;
    text-align: left;
}

.device-card .device-tile-title {
    display: block;
    min-width: 0;
    max-width: 100%;
    flex: 0 1 auto;
    margin: 0;
    overflow: hidden;
    color: var(--device-card-header-text);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    line-height: 1.12;
    letter-spacing: 0;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-card .device-tile-status {
    display: none;
    width: max-content;
    min-height: 18px;
    flex: 0 0 auto;
    align-items: center;
    margin: 0;
    padding: 1px 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-2xs);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    letter-spacing: .01em;
    text-transform: none;
    white-space: nowrap;
}

.device-card .device-tile-status.is-offline {
    display: inline-flex;
    border-color: var(--state-offline-border);
    background: var(--state-offline-soft);
    color: var(--state-offline-text);
}

.device-card .device-tile-status.is-online,
.device-card .device-tile-status.is-waiting {
    display: none;
}

.device-card .device-tile-description {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: var(--device-card-header-muted);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    line-height: 1.12;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-card .device-tile-description[hidden] {
    display: none;
}

.device-card .device-tile-technical-row {
    display: flex;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    align-items: baseline;
    justify-content: flex-start;
    column-gap: 8px;
    margin: 0;
    padding: 0;
    text-align: left;
}

.device-card .device-tile-type {
    display: block;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--device-card-header-muted);
    font-size: var(--font-size-2xs);
    font-weight: var(--font-weight-medium);
    line-height: 1.1;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-card .device-tile-type[hidden] {
    display: none;
}

.device-card .device-tile-id {
    display: block;
    min-width: 0;
    margin: 0;
    justify-self: start;
    color: var(--device-card-header-muted);
    font-family: var(--font-family-mono);
    font-size: var(--font-size-2xs);
    font-weight: var(--font-weight-semibold);
    line-height: 1.1;
    text-align: left;
    white-space: nowrap;
}


/* v9.8.272 — only meaningful copy is selectable. The header remains a
   navigation target; native drag/double-click/long-press selection is kept
   for label, description and the raw numeric device ID. */
.device-card .device-tile-title,
.device-card .device-tile-description,
.device-card .device-tile-id-value {
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
    cursor: text;
}

/* Keep the three-row hierarchy compact on narrow screens without changing
   the alignment model. */
@media (max-width: 700px) {
    .device-card .device-tile-header.device-card-header-clickable {
        min-height: 69px;
        grid-template-columns: 55px minmax(0, 1fr);
        column-gap: var(--space-2);
        padding: 7px var(--space-2) 7px var(--space-3);
    }

    .device-card .device-tile-icon {
        width: 55px;
        height: 55px;
        font-size: 1.125rem;
    }


    .device-card .device-tile-copy {
        min-height: 42px;
        row-gap: 1px;
    }

    .device-card .device-tile-title-row,
    .device-card .device-tile-description {
        padding-right: 0;
    }
}

/* v9.8.298 — the compact card reserves the top-right slot exclusively for
   current connectivity. Device actions moved to the detail topbar. Offline is
   intentionally silent: an empty right side means there is no live connection. */
.device-card .device-card-side-actions {
    display: flex !important;
    position: absolute;
    top: 36px !important;
    right: 8px !important;
    transform: translateY(-50%);
    z-index: 12;
    width: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible;
    pointer-events: none;
}

.device-card.has-connection-indicator .device-card-side-actions {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
}

.device-card .device-card-connection-status {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    color: var(--icon-neutral);
    pointer-events: none;
}

.device-card .device-card-connection-status[hidden] {
    display: none !important;
}

.device-card.has-connection-indicator .device-tile-title-row,
.device-card.has-connection-indicator .device-tile-description {
    padding-right: 44px;
}

/* Shared connectivity component used by compact cards and the detail topbar. */
.device-connection-indicator {
    --connection-halo: var(--iot-card-header);
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 33.8px;
    height: 33.8px;
    flex: 0 0 33.8px;
    color: var(--icon-neutral);
    line-height: 1;
    vertical-align: middle;
}

.device-connection-indicator .device-connection-icon {
    display: block;
    width: 29.9px;
    height: 29.9px;
    color: currentColor;
}

.device-connection-indicator[data-connection-type="radio"] .device-connection-icon {
    width: 31.2px;
    height: 31.2px;
}

.device-connection-hop {
    position: absolute;
    right: -4px;
    bottom: -2px;
    z-index: 2;
    min-width: 13px;
    height: 12px;
    padding: 0 2px;
    border-radius: 3px;
    background: var(--connection-halo);
    color: currentColor;
    font-family: var(--font-family-mono);
    font-size: 9.6px;
    font-weight: 800;
    line-height: 12px;
    letter-spacing: -.04em;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 0 0 1.6px var(--connection-halo);
}

@media (max-width: 700px) {
    .device-card .device-card-side-actions {
        top: 34.5px !important;
        right: 7px !important;
    }

    .device-card.has-connection-indicator .device-tile-title-row,
    .device-card.has-connection-indicator .device-tile-description {
        padding-right: 44px;
    }
}

