/* Lansitec Trackers Payload Decoder - beta compact layout */

.lansitec-box {
    max-width: 1120px;
    margin: 32px auto;
    padding: 0;
    box-sizing: border-box;
    color: #1d2939;
    font-family: Arial, Helvetica, sans-serif;
}

.lansitec-box *,
.lansitec-box *::before,
.lansitec-box *::after {
    box-sizing: border-box;
}

.lansitec-box [hidden] {
    display: none !important;
}

.decoder-section {
    padding: 28px;
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    box-shadow: 0 8px 26px rgba(16, 24, 40, 0.06);
}

.decoder-section + .decoder-section {
    margin-top: 24px;
}

.lansitec-box h3 {
    margin: 0 0 22px;
    padding: 0 0 12px;
    border-bottom: 2px solid #eaf2f8;
    color: #0057a8;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.lansitec-box h4 {
    margin: 10px 0 0;
    color: #0057a8;
    font-size: 19px;
    line-height: 1.3;
}

.lansitec-box label {
    display: block;
    margin: 0 0 7px;
    color: #344054;
    font-size: 14px;
    font-weight: 700;
}

.lansitec-box input,
.lansitec-box select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    color: #101828;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.lansitec-box input:hover,
.lansitec-box select:hover {
    border-color: #98a2b3;
}

.lansitec-box input:focus,
.lansitec-box select:focus {
    outline: none;
    border-color: #0057a8;
    box-shadow: 0 0 0 3px rgba(0, 87, 168, 0.13);
}

.lansitec-box input:invalid:focus {
    border-color: #d92d20;
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

.lansitec-box select:disabled,
.lansitec-box input:disabled {
    background: #f2f4f7;
    color: #667085;
    cursor: not-allowed;
}

.lansitec-box optgroup {
    color: #344054;
    font-weight: 700;
}

.lansitec-box button {
    margin-top: 16px;
    padding: 12px 26px;
    background: #0057a8;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: background 0.2s, opacity 0.2s;
}

.lansitec-box button:hover {
    background: #003f7a;
}

.lansitec-box button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.uplink-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 26px;
    align-items: start;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-field,
.downlink-field {
    min-width: 0;
}

.payload-field {
    margin-top: 18px;
}

.input-hint,
.field-note {
    margin: 7px 0 0;
    color: #667085;
    font-size: 12px;
    line-height: 1.45;
}

.compact-note {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    color: #475467;
    font-size: 12px;
    line-height: 1.5;
}

.compact-note--lorawan {
    background: #eff8ff;
    border-color: #b2ddff;
    color: #175cd3;
}

.compact-note--warning {
    margin: 0 0 18px;
    background: #fffaeb;
    border-color: #fedf89;
    color: #7a2e0e;
}

.product-card {
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #dfe5ec;
    border-radius: 12px;
}

.product-media {
    padding: 16px;
    background: #f8fafc;
    border-bottom: 1px solid #eaecf0;
}

.product-image {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: contain;
}

.product-info {
    padding: 16px;
}

.product-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.product-connectivity,
.product-role {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.product-connectivity {
    background: #eaf3fb;
    color: #0057a8;
}

.product-role {
    background: #f2f4f7;
    color: #475467;
}

.decoder-assignment {
    display: grid;
    gap: 3px;
    margin-top: 14px;
    padding: 10px 12px;
    background: #f8fafc;
    border-left: 3px solid #0057a8;
    border-radius: 0 7px 7px 0;
}

.decoder-assignment span {
    color: #667085;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.decoder-assignment strong {
    color: #344054;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.product-link {
    display: inline-block;
    margin-top: 12px;
    color: #0057a8;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.product-link:hover {
    text-decoration: underline;
}

.downlink-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 22px;
}

.downlink-field--wide {
    grid-column: 1 / -1;
}

.field-help {
    margin-top: 7px;
    color: #667085;
    font-size: 12px;
    line-height: 1.45;
}

.field-help strong {
    display: none;
}

.field-help p {
    margin: 0;
}

.downlink-message,
.decoder-message {
    margin-top: 12px;
    padding: 13px 15px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.downlink-message {
    background: #f8fafc;
    border: 1px solid #e4e7ec;
    color: #475467;
}

.decoder-message--loading {
    background: #eff8ff;
    border: 1px solid #b2ddff;
    color: #175cd3;
}

.decoder-message--error {
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: #b42318;
}

.decoder-result {
    margin-top: 18px;
}

.decoder-result-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 14px;
    margin-top: 18px;
    padding: 12px 14px;
    background: #eef6ff;
    border: 1px solid #b9daf7;
    border-radius: 10px 10px 0 0;
}

.decoder-result-header strong {
    color: #0057a8;
}

.decoder-result-header span {
    color: #475467;
    font-size: 12px;
}

.decoder-result-reminder {
    margin: 0;
    padding: 10px 14px;
    background: #f8fafc;
    border-right: 1px solid #e4e7ec;
    border-left: 1px solid #e4e7ec;
    color: #667085;
    font-size: 12px;
    line-height: 1.5;
}

.decoder-raw,
#downlink-result pre {
    margin: 0;
    padding: 18px;
    overflow: auto;
    background: #0b1f33;
    border-radius: 0 0 10px 10px;
    color: #9fd3ff;
    font-family: "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

#downlink-result > pre:first-child {
    margin-top: 18px;
    border-radius: 10px;
}

@media (max-width: 900px) {
    .lansitec-box {
        margin: 20px 14px;
    }

    .uplink-grid {
        grid-template-columns: 1fr;
    }

    .uplink-product-column {
        max-width: 460px;
    }
}

@media (max-width: 680px) {
    .decoder-section {
        padding: 20px;
        border-radius: 12px;
    }

    .lansitec-box h3 {
        font-size: 20px;
    }

    .form-grid,
    .downlink-grid {
        grid-template-columns: 1fr;
    }

    .downlink-field--wide {
        grid-column: auto;
    }

    .product-image {
        height: 175px;
    }

    .decoder-result-header {
        flex-direction: column;
    }
}
