/*
***************************************************************************
** Shared layout/responsive rules for OTGW web UI (light + dark themes)
** Keep theme colors in index.css / index_dark.css.
***************************************************************************
*/

.settingDiv:not(.fixed-ip-section) {
  display: flex;
  align-items: center;
}

.settings-field-container {
  box-sizing: border-box;
  flex: 0 0 480px;
  width: 480px;
  float: none;
  margin-right: 0;
  padding-left: 24px;
  text-align: left;
}

.settings-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  text-align: left;
}

/* Shared responsive OT log behavior for phones/tablets */

/* Shared drag-to-resize handles for OpenTherm data tables. */
.ot-stats-table th .col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 11;
}

.ot-stats-table th .col-resizer:hover,
.ot-stats-table th .col-resizer.dragging {
    opacity: 1;
}

body.col-resizing,
body.col-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}
@media (max-width: 768px) {
  #otLogSection {
    display: none !important;
  }

  .ot-log-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-log-control,
  .log-search,
  .log-control-label {
    width: 100%;
  }

  .ot-log-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .ot-log-container.collapsed {
    max-height: 150px;
  }

  .ot-log-container:not(.collapsed) {
    max-height: 400px;
  }
}

/* Theme toggle button — sits as a direct flex child of nav-container */
.theme-toggle-btn {
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.25em;
  line-height: 1;
  border-radius: 6px;
  margin-left: 8px;
  margin-right: 4px;
  cursor: pointer;
  -webkit-transition: background 0.2s, box-shadow 0.2s;
  transition: background 0.2s, box-shadow 0.2s;
}

/* Shared mobile nav/settings layout */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .nav-container .nav-left,
  .nav-container .nav-right {
    width: 100%;
    flex-basis: auto;
    flex-grow: 0;
    min-height: 0;
    justify-content: stretch;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .nav-container .nav-item {
    width: 100%;
    min-height: 44px;
  }

  .nav-right .adv_dropdown {
    position: static;
    top: auto;
    right: auto;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    margin-top: 4px;
  }

  .settingDiv,
  .settingDiv:not(.fixed-ip-section) {
    display: block;
    min-width: 0;
    width: auto;
    max-width: 100%;
    text-align: left;
    border-width: 2px;
    box-sizing: border-box;
    padding: 8px 10px;
    margin: 0 0 6px 0;
  }

  .settings-field-container {
    display: block;
    flex: none;
    float: none;
    width: auto;
    padding-left: 0;
    margin: 0 0 6px 0 !important;
    font-weight: 600;
  }

  .settings-input-container {
    display: block;
  }

  .settingDiv input[type="text"],
  .settingDiv input[type="password"],
  .settingDiv input[type="number"] {
    width: 100%;
    max-width: 100%;
    min-height: 40px;
    font-size: 16px;
    box-sizing: border-box;
  }

  .settingDiv input[type="checkbox"] {
    transform: scale(1.2);
    transform-origin: left center;
  }

  .fixed-ip-section .fixed-ip-row {
    display: block;
    padding: 8px 0;
  }

  .fixed-ip-section .fixed-ip-field-label {
    display: block;
    padding-left: 0;
  }

  .fixed-ip-section .octet-group {
    display: inline-flex;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .fixed-ip-section .octet-input {
    flex: 0 0 40px;
    width: 40px;
    max-width: 40px;
    min-height: 40px;
    padding-left: 0;
    padding-right: 0;
  }

  #settingMessage {
    width: auto;
    max-width: 100%;
    margin: 8px 10px;
    box-sizing: border-box;
  }

  /* On mobile the nav stacks vertically; keep the toggle button compact and right-aligned */
  .nav-container > .theme-toggle-btn {
    align-self: flex-end;
    margin-left: 0;
    margin-right: 4px;
  }
}
