/* ══════════════════════════════════════════════════════════════════
   Shared device-settings stylesheet
   ──────────────────────────────────────────────────────────────────
   Single source of truth for the radio device "further details" panels
   (M330 / M423 / M503 / M505 *DeviceSettings* components). Hosted in the
   RadioCanvas RCL because it is the in-house static-asset library that
   BOTH apps (SRCTutor.FrontEnd and RadioTutor) already load via
   _content/RadioCanvas/... . Each device component opts in by setting
   Class="device-settings" on its root <MudForm>.

   Design goals (same as the Simulation settings panel refactor):
   - spacing owned by containers (flex + gap), no floats / negative
     position offsets;
   - one density scale via the tokens below — re-scale from one place;
   - self-contained: defines its own tokens, colours and the MudBlazor
     overrides it needs, so it renders identically in either app without
     depending on that app's app.css.
   Selectors are prefixed with .device-settings so they win over the
   legacy global rules in SRCTutor.FrontEnd/app.css and never leak out.
   ══════════════════════════════════════════════════════════════════ */

.device-settings {
    /* density knobs — edit here to re-scale the whole panel */
    --ds-control-height: 36px;
    --ds-font-size: 12px;
    --ds-title-size: 13px;
    --ds-field-gap: 4px;   /* label → control */
    --ds-col-gap: 12px;    /* between columns in a row */
    --ds-section-gap: 14px;/* between sections */
    /* palette (panel sits on a dark surface) */
    --ds-text: #fff;
    --ds-label: rgba(255, 255, 255, 0.7);
    --ds-control-bg: #f8fbff;
    --ds-control-border: rgba(127, 141, 162, 0.30);
    --ds-accent: #263e78;

    font-family: 'Urbanist', sans-serif;
    /* the host panel centres text; settings content is always left-aligned */
    text-align: left;
}

/* ── Sections ─────────────────────────────────────────────────────── */
.device-settings .section {
    margin-bottom: var(--ds-section-gap);
}

.device-settings .section-title {
    margin: 0 0 var(--ds-col-gap) 0;
    color: var(--ds-text);
    font-size: var(--ds-title-size);
    font-weight: 500;
    text-align: left;
}

.device-settings .srow {
    display: flex;
    gap: var(--ds-col-gap);
    margin: 0;
}

.device-settings .scolumn {
    flex: 1;
    min-width: 0; /* shrink instead of overflow */
}

.device-settings h6 {
    margin: 0 0 var(--ds-field-gap) 0;
    color: var(--ds-text);
    font-size: var(--ds-font-size);
    font-weight: 400;
    text-align: left;
}

/* ── Text fields (label stacked over input) ───────────────────────── */
.device-settings .input-group {
    display: flex;
    flex-direction: column;
    gap: var(--ds-field-gap);
    margin-bottom: var(--ds-col-gap);
}

.device-settings .input-label {
    color: var(--ds-label);
    font-size: var(--ds-font-size);
}

.device-settings .input-group .mud-input > input.mud-input-root {
    width: 100%;
    padding: 4px 2px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    color: var(--ds-text);
    font-family: 'Urbanist', sans-serif;
    font-size: var(--ds-font-size);
}

    .device-settings .input-group .mud-input > input.mud-input-root:focus {
        border-bottom: 1px solid rgba(255, 255, 255, 1);
    }

/* remove MudBlazor's own underline pseudo-elements (we use the border) */
.device-settings .input-group .mud-input.mud-input-underline::before,
.device-settings .input-group .mud-input.mud-input-underline::after {
    border-bottom: none !important;
    content: none !important;
}

/* ── Checkbox rows (flow layout, no negative offsets) ─────────────── */
.device-settings .gps-chkbox,
.device-settings .shipinfo-chkbox,
.device-settings .menu-select-distress {
    display: flex;
    align-items: center;
    gap: var(--ds-field-gap);
    margin: var(--ds-field-gap) 0 0 0;
    padding: 0;
    /* explicitly reset the legacy negative-offset hacks */
    position: static;
    top: auto;
    left: auto;
    color: var(--ds-text);
}

.device-settings .gps-chkbox span,
.device-settings .shipinfo-chkbox span,
.device-settings .menu-select-distress span {
    position: static;
    top: auto;
    left: auto;
    color: var(--ds-text);
    font-size: var(--ds-font-size);
    line-height: 1.3;
}

.device-settings input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: #3183f5;
    cursor: pointer;
}

/* ── GPS detail (lat/long) ────────────────────────────────────────── */
.device-settings .gps-detail {
    margin-top: var(--ds-col-gap);
    padding: var(--ds-col-gap);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.device-settings .gps-status {
    margin: 0 0 var(--ds-field-gap) 0;
    color: #9fe2bf;
    font-size: var(--ds-font-size);
}

/* ── Channel-mode / menu select ───────────────────────────────────── */
.device-settings .menu-style-config {
    position: relative;
}

    /* leading icon lives inside the control box — centred, no offsets */
    .device-settings .menu-style-config svg {
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: 20px;
        height: 20px;
        z-index: 1;
        pointer-events: none;
    }

    .device-settings .menu-style-config .mud-input {
        height: var(--ds-control-height);
        min-height: var(--ds-control-height);
        background: var(--ds-control-bg);
        border: 1px solid var(--ds-control-border);
        border-radius: 8px;
        display: flex;
        align-items: center;
    }

    /* value text: centred, room for the leading icon, panel font size */
    .device-settings .menu-style-config .mud-input-slot.mud-input-root {
        padding: 0 12px 0 38px;
        margin: 0;
        max-width: none;
        height: auto;
        font-family: 'Urbanist', sans-serif;
        font-size: var(--ds-font-size);
        text-align: left;
        text-overflow: ellipsis;
    }

    /* drop MudBlazor underline on the filled select */
    .device-settings .menu-style-config .mud-input.mud-input-underline::before,
    .device-settings .menu-style-config .mud-input.mud-input-underline::after {
        border-bottom: none !important;
        content: none !important;
    }

/* ══════════════════════════════════════════════════════════════════
   Responsive: mobile portrait — stack columns; light-on-light labels.
   ══════════════════════════════════════════════════════════════════ */
@media screen and (max-width: 700px) {
    .device-settings .srow {
        flex-direction: column;
        gap: var(--ds-col-gap);
    }

    .device-settings .mobile-menu {
        flex-direction: column;
    }

    .device-settings .section-title {
        color: #1a2338;
        text-align: center;
    }

    .device-settings .input-label,
    .device-settings h6 {
        color: #718aad;
    }

    .device-settings .gps-chkbox span,
    .device-settings .shipinfo-chkbox span,
    .device-settings .menu-select-distress span {
        color: #1a2338;
    }
}
