/* Global reset to avoid unexpected gutters (bootstrap/body defaults) */
html, body {
  margin: 0 !important;
  padding: 0 !important;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 12px;
}

/* Ensure a consistent font across common elements */
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Ensure Blazor root does not introduce margin/padding */
app, #app, .layout-root, .content-wrapper, main.main {
  margin: 0;
}

/* Remove any bootstrap-like horizontal gutter on common containers if present */
.container, .container-fluid {
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Conversions: comparison expression (WinForms-like) */
.conv-compare {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.conv-compare .maps-input[type="number"] {
  width: 110px;
}

.conv-x {
  font-weight: 600;
  color: #111827;
  min-width: 14px;
  text-align: center;
}

.conv-op {
  color: #111827;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}

.topbar-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 12px;
}

.topbar-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.pwd-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.pwd-modal {
    width: min(520px, calc(100vw - 32px));
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
    overflow: hidden;
}

.pwd-modal__header {
    background: #0b4a67;
    color: #fff;
    padding: 10px 16px;
    font-weight: 600;
}

.pwd-modal__title {
    text-align: center;
}

.pwd-modal__body {
    padding: 16px;
}

.pwd-modal__subtitle {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #222;
}

.pwd-modal__divider {
    margin: 10px 0 14px 0;
}

.pwd-modal__template {
    font-weight: 600;
    margin-bottom: 10px;
}

.pwd-modal__text {
    color: #444;
    font-size: 13px;
    line-height: 1.35;
    margin-bottom: 14px;
}

.pwd-row {
    margin-bottom: 12px;
}

.pwd-label {
    display: block;
    margin-bottom: 6px;
    color: #222;
}

.pwd-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwd-input {
    flex: 1;
}

.pwd-eye {
    width: 28px;
    height: 28px;
    border: 1px solid #cfcfcf;
    background: #f7f7f7;
    border-radius: 4px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23999' d='M12 5c-7 0-10 7-10 7s3 7 10 7 10-7 10-7-3-7-10-7Zm0 12a5 5 0 1 1 0-10 5 5 0 0 1 0 10Zm0-8a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
}

.pwd-strength {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.pwd-error {
    margin-top: 8px;
    color: #b00020;
    font-size: 13px;
}

.pwd-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px 16px 16px;
}

.pwd-strength-bar {
    height: 2px;
    background: #e6e6e6;
    border-radius: 999px;
    overflow: hidden;
    width: 100%;
    margin-top: 4px;
}

.pwd-strength-bar__fill {
    height: 100%;
    width: 0;
}

.pwd-eye-toggle {
    width: 32px;
    height: 32px;
    border: 1px solid #cfcfcf;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    flex: 0 0 32px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
    /* crossed eye by default */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23999' d='M12 5c-7 0-10 7-10 7s3 7 10 7 10-7 10-7-3-7-10-7Zm0 12a5 5 0 0 1-5-5c0-.7.1-1.3.4-1.9l1.5 1.5a3 3 0 0 0 3.6 3.6l1.5 1.5c-.6.2-1.3.3-2 .3Z'/%3E%3Cpath fill='%23999' d='M3.3 2.3 2 3.6l3.1 3.1C3 8.4 2 10 2 12c0 0 3 7 10 7 2.1 0 3.9-.6 5.4-1.4l3 3L21.7 19 3.3 2.3Zm8.7 14.2a5 5 0 0 1-5-5c0-.7.1-1.3.4-1.9l1.5 1.5a3 3 0 0 0 3.6 3.6l1.5 1.5c-.6.2-1.3.3-2 .3Z'/%3E%3C/svg%3E");
}

.pwd-eye-toggle:active {
    /* open eye while pressed */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23999' d='M12 5c-7 0-10 7-10 7s3 7 10 7 10-7 10-7-3-7-10-7Zm0 12a5 5 0 1 1 0-10 5 5 0 0 1 0 10Zm0-8a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z'/%3E%3C/svg%3E");
}

/* Password modal: add space for padlock + align like desktop */
.pwd-modal__content {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 14px;
    align-items: start;
}

.pwd-modal__padlock {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-top: 6px;
}

/* Connection page (WinForms-like) */
.connection-panel {
  padding: 12px 12px 10px 12px;
}

.connection-title {
  font-size: 13px;
  color: #444;
  margin-bottom: 8px;
}

.connection-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.connection-left {
  min-width: 360px;
}

.connection-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.connection-label {
  font-weight: 600;
  color: #111;
  padding-top: 0;
  margin-top: 2px;
  white-space: normal;
}

.connection-radios {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connection-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  color: #111;
}

.connection-list-wrap {
  width: 170px;
}

.connection-list {
  width: 170px;
  height: 360px;
  border: 1px solid #808080;
  background: #fff;
  padding: 2px;
  font-family: inherit;
  display: block;
}

.connection-refresh {
  width: 170px;
  height: 26px;
  padding: 2px 8px;
}

.connection-pwd {
  width: 200px;
  height: 26px;
  padding: 2px 6px;
}

.connection-info-row {
  grid-column: 1 / -1;
  color: #0c5460;
  background: #d1ecf1;
  padding: 8px;
  border-radius: 4px;
  font-size: 0.85em;
  margin-bottom: 10px;
}

.connection-right {
  min-width: 0;
  overflow: hidden;
}

.connection-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border: 1px solid #bdbdbd;
  border-collapse: collapse;
}

.connection-table thead th {
  background: #f2f2f2;
  border: 1px solid #bdbdbd;
  padding: 4px 8px;
  text-align: left;
  font-weight: 600;
}

.connection-table tbody td {
  border: 1px solid #d6d6d6;
  padding: 3px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-table tbody tr:nth-child(even) td {
  background: #fbfbfb;
}

.connection-table tbody tr:hover td {
  background: #eef5ff;
}

.connection-table thead th:first-child,
.connection-table tbody td:first-child {
  width: 240px;
}

.connection-desc {
  font-weight: 600;
  color: #111;
}

.connection-val {
  color: #111;
}

.connection-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.connection-footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-com {
  width: 150px;
  height: 26px;
  padding: 2px 6px;
}

.connection-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-btn {
  min-width: 110px;
  height: 28px;
  padding: 2px 10px;
}

/* New Project (template selection) */
.np-templates-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.templates-table tbody tr {
  cursor: pointer;
}

.templates-table tbody tr.selected-row td {
  background: #0b4a67;
  color: #fff;
}

.templates-table tbody tr.selected-row td a,
.templates-table tbody tr.selected-row td span {
  color: inherit;
}

.templates-table tbody tr:hover td {
  background: #eef5f9;
}

.templates-table tbody tr.selected-row:hover td {
  background: #0b4a67;
}

.serial-firstuse-banner {
  width: 360px;
  max-width: 100%;
  border: 1px solid #d0d0d0;
  background: #fffbea;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.serial-firstuse-text {
  color: #333;
  font-size: 12px;
  line-height: 1.25;
}

.serial-firstuse-btn {
  white-space: nowrap;
}

.connection-statusbar{
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.connection-statusbar.disconnected{
    background: #e9ecef;
    color: #343a40;
}

.connection-statusbar.waiting{
    background: #ffe8a1;
    color: #5c4500;
}

.connection-statusbar.connected{
    background: #0d6efd;
    color: white;
}

.connection-status-error{
    font-weight: 500;
    opacity: 0.95;
}

/* Receive / Send page */
.maps-left-tab {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  color: #111;
  cursor: pointer;
}

.maps-left-tab:hover {
  background: #eef5f9;
}

.maps-left-tab-active {
  background: #0b4a67;
  color: #fff;
}

.maps-muted {
  color: #444;
  margin: 8px 0 18px 0;
  max-width: 720px;
}

.maps-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
