/* i.nsw.cz – Bootstrap 5 doplnky (plna sirka, filtry, toolbar, header, footer, itemedit) */

:root {
  --insw-nav: #1a1d21;
  --insw-brand: #0d6efd;
  --insw-bg: #f4f6f9;
  --insw-surface: #ffffff;
  --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html, body {
  min-height: 100%;
}

/* ---- Login ---- */
.insw-login-page {
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
  background: linear-gradient(145deg, #0d1117 0%, #1a2332 45%, #243447 100%);
}

.insw-login-page main.container {
  max-width: 100%;
  overflow-x: hidden;
}

.insw-login-card {
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.35);
}

.insw-login-card .card-header {
  background: var(--insw-nav);
  color: #fff;
  border-radius: 1rem 1rem 0 0 !important;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.insw-login-card-header {
  border-bottom: 0;
}

.insw-login-logo {
  display: inline-block;
  height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

@media (max-width: 576px) {
  .insw-login-logo {
    height: 36px;
    max-width: 180px;
  }
}

body.insw-app {
  padding-top: 3.5rem;
  padding-bottom: 3.25rem;
  background: #f4f6f9;
}

.insw-page-body {
  width: 100%;
  max-width: none;
  padding-top: 0.5rem;
}

.insw-container-wide {
  width: 100%;
  max-width: none;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

#contentBody {
  width: 100%;
  max-width: none;
}

/* ---- Navbar ---- */
.insw-navbar.navbar {
  background: var(--insw-nav) !important;
  border: 0 !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  z-index: 1030;
  margin: 0;
  width: 100%;
  max-width: 100vw;
  left: 0;
  right: 0;
}

.insw-navbar > .container-fluid,
.insw-navbar-flex {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
}

/* Prepis legacy nav pravidel z insw.css (rozbijely Bootstrap menu) */
.insw-navbar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.insw-navbar .navbar-nav > .nav-item {
  display: list-item;
  margin-top: 0;
  list-style: none;
}

.insw-navbar li:hover {
  background-color: transparent;
}

.insw-navbar li > ul.dropdown-menu {
  display: none;
  position: absolute;
  margin-top: 0;
  background-color: #fff;
}

.insw-navbar li > ul.dropdown-menu.show {
  display: block !important;
}

.insw-navbar .dropdown-menu .dropdown-item {
  color: #212529;
  font-weight: 500;
}

.insw-navbar .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.92) !important;
}

.insw-navbar .navbar-nav .nav-link:hover,
.insw-navbar .navbar-nav .nav-link:focus {
  color: #fff !important;
}

.insw-navbar .dropdown-menu {
  border: 0;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
  z-index: 1050;
}

.insw-navbar-brand {
  display: inline-flex !important;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  line-height: 1;
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100% - 7.5rem);
  margin-right: 0.25rem;
}

.insw-navbar-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.insw-navbar .nav-link {
  font-weight: 500;
  padding: 0.5rem 0.85rem !important;
}

.insw-navbar .dropdown-item:active {
  background-color: var(--insw-brand);
}

.insw-navbar-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
}

.insw-navbar-tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  margin-left: auto;
  max-width: 100%;
}

.insw-account-dropdown {
  flex: 0 1 auto;
  min-width: 0;
}

.insw-navbar-toggler {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  padding: 0.3rem 0.55rem;
}

.insw-navbar .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.insw-navbar .navbar-toggler-icon {
  width: 1.35em;
  height: 1.35em;
}

.insw-navbar-collapse {
  flex-grow: 1;
}

@media (max-width: 991.98px) {
  .insw-navbar-brand {
    order: 1;
    max-width: calc(100% - 6.75rem);
  }

  .insw-navbar-tools {
    order: 2;
  }

  .insw-navbar-tools .insw-navbar-toggler {
    display: inline-flex;
  }

  .insw-navbar-collapse {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
  }

  .insw-navbar .navbar-nav > .nav-item {
    display: block;
    width: 100%;
  }
}

@media (min-width: 992px) {
  .insw-navbar-brand {
    order: 1;
    max-width: none;
  }

  .insw-navbar-collapse {
    order: 2;
    flex-grow: 1;
  }

  .insw-navbar-tools {
    order: 3;
  }
}

.insw-account-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  border-color: rgba(255, 255, 255, 0.35) !important;
  color: #e6edf3 !important;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.06);
}

.insw-account-toggle:hover,
.insw-account-toggle:focus,
.insw-account-toggle.show {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.55) !important;
  color: #fff !important;
}

.insw-account-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  opacity: 0.9;
}

.insw-account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insw-account-menu {
  min-width: 11rem;
}

.insw-account-menu .insw-account-logout {
  color: #dc3545;
}

.insw-account-menu .insw-account-logout:hover {
  background-color: rgba(220, 53, 69, 0.1);
  color: #b02a37;
}

@media (max-width: 991.98px) {
  .insw-account-name {
    max-width: 5.5rem;
  }

  .insw-navbar-logo {
    height: 28px;
  }
}

@media (max-width: 639.98px) {
  .insw-navbar-brand {
    max-width: calc(100% - 5.5rem);
  }

  .insw-account-name {
    display: inline;
    max-width: 4.5rem;
    font-size: 0.62rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
  }

  .insw-account-toggle {
    padding: 0.2rem 0.35rem;
    font-size: 0.62rem;
    gap: 0.2rem;
  }

  .insw-account-icon {
    font-size: 0.95rem;
  }

  .insw-navbar-logo {
    height: 26px;
  }

  .insw-navbar-tools {
    gap: 0.15rem;
  }
}

@media (max-width: 399.98px) {
  .insw-navbar > .container-fluid,
  .insw-navbar-flex {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }
}

/* Skryt legacy header/menu z insw.css */
#contentHeader nav:not(.insw-navbar),
#contentHeader #programname,
#contentHeader #userpanel {
  display: none !important;
}

.insw-navbar.navbar,
.insw-navbar.navbar .container-fluid {
  overflow: visible;
}

#contentHeader {
  position: static !important;
  background: transparent !important;
  border: 0 !important;
  height: 0;
  overflow: visible;
}

/* ---- Footer ---- */
#contentFooter,
.insw-footer {
  background: var(--insw-nav);
  color: #adb5bd;
  font-size: 0.8rem;
  text-align: center;
  padding: 0.65rem 1rem;
  height: auto !important;
  min-height: 2.5rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
  opacity: 1 !important;
  filter: none !important;
  border: 0;
  z-index: 1020;
}

#contentFooter a,
.insw-footer a {
  color: #9ec5fe;
  text-decoration: none;
}

#contentFooter a:hover,
.insw-footer a:hover {
  color: #fff;
}

.insw-footer-version {
  opacity: 0.85;
}

/* ---- Alerts ---- */
.oznameni {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: inherit;
  font-weight: inherit;
  text-align: inherit;
}

.oznameni .alert {
  margin-bottom: 0.5rem;
}

#contentBody {
  width: 100%;
  max-width: none;
}

.mainwin {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.5rem 0.75rem;
  box-sizing: border-box;
}

#list_title {
  background: linear-gradient(90deg, #0d6efd, #0a58ca) !important;
  border-radius: 0.5rem;
  line-height: 1.4 !important;
  width: auto !important;
  text-align: left !important;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem !important;
}

.filtering,
.filter_datum,
.filter2_items,
.paging {
  background: #f8f9fa !important;
  border: 1px solid #dee2e6 !important;
  border-radius: 0.5rem;
  color: #495057 !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem !important;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box;
}

.filtering form,
.filter_datum form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.filter2_items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
}

.filter2_items .filter2_label {
  font-weight: 600;
  margin-right: 0.15rem;
  color: #212529;
}

.filter2_items a.filter2_notactive,
.filter2_items a.filter2_active {
  text-decoration: none !important;
  background-image: none !important;
  padding: 0.25rem 0.65rem !important;
  border-radius: 0.375rem !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
}

.filter2_items a.filter2_notactive {
  color: #0d6efd !important;
  background-color: transparent !important;
  border: 1px solid #0d6efd !important;
}

.filter2_items a.filter2_notactive:hover {
  color: #fff !important;
  background-color: #0d6efd !important;
}

.filter2_items a.filter2_active {
  color: #fff !important;
  background-color: #0d6efd !important;
  border: 1px solid #0d6efd !important;
}

.filter2_items a.filter2_clear {
  color: #dc3545 !important;
  border: 1px solid #dc3545 !important;
  background: transparent !important;
  text-decoration: none !important;
  padding: 0.2rem 0.55rem !important;
  border-radius: 0.375rem !important;
  font-size: 0.8rem !important;
  font-weight: 600;
  margin-right: 0.35rem;
}

.filter2_items a.filter2_clear:hover {
  color: #fff !important;
  background-color: #dc3545 !important;
}

.filtering .inputText,
.filter_datum input[type="text"],
.mainwin input[type="text"],
.mainwin input[type="password"],
.mainwin select,
.mainwin textarea {
  border-radius: 0.375rem;
  border: 1px solid #ced4da;
  padding: 0.35rem 0.55rem;
  resize: both; /* Bootstrap default is vertical-only */
}

.submitButtonSave,
.submitButtonMag,
.submitButtonCan,
.submitButtonNew,
.submitButtonFiltr,
.filter_datum input[type="submit"] {
  border-radius: 0.375rem !important;
  padding: 0.35rem 0.85rem !important;
  border: 1px solid transparent !important;
  font-weight: 500;
  background-image: none !important;
}

.submitButtonSave { background: #198754 !important; color: #fff !important; }
.submitButtonMag { background: #0d6efd !important; color: #fff !important; }
.submitButtonCan { background: #6c757d !important; color: #fff !important; }
.submitButtonNew { background: #0dcaf0 !important; color: #000 !important; }
.filter_datum input[type="submit"] { background: #0d6efd !important; color: #fff !important; }

.insw-il-toolbar .btn {
  font-weight: 500;
}

.newitem.insw-il-toolbar .btn,
.newitem.insw-il-toolbar a.btn {
  background-image: none !important;
  text-decoration: none !important;
}

.newitem.insw-il-toolbar #itemadd,
.newitem.insw-il-toolbar #itemadd_bottom,
.newitem.insw-il-toolbar #itemprint {
  padding: 0.375rem 0.75rem !important;
}

.paging {
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.paging a {
  color: #0d6efd !important;
  text-decoration: none;
}

.paging a:hover {
  text-decoration: underline;
}

@media (max-width: 576px) {
  .mainwin {
    padding: 0.5rem 0.35rem;
  }

  .insw-container-wide {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .filtering form,
  .filter_datum form {
    justify-content: stretch;
  }

  .filtering .inputText {
    width: 100%;
    max-width: 100%;
  }
}

/* ---- Itemedit: mobilni / uzka obrazovka ---- */
@media (max-width: 767.98px) {
  #wysiwyg .form {
    text-align: left;
    padding: 0 0.15rem;
  }

  #wysiwyg .formline {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    margin-bottom: 0.65rem;
    padding-bottom: 0;
  }

  #wysiwyg .formline:after {
    display: none;
  }

  #wysiwyg .formline .left,
  #wysiwyg .formline .right {
    float: none !important;
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    text-align: left !important;
    margin-right: 0 !important;
    min-height: 0 !important;
    padding-top: 0;
  }

  #wysiwyg .formline .left {
    font-weight: 600;
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 0.2rem;
  }

  #wysiwyg .right input.text,
  #wysiwyg .right input[type="password"],
  #wysiwyg .right input[type="text"],
  #wysiwyg .right select,
  #wysiwyg .right textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    margin-right: 0 !important;
  }

  #wysiwyg .right input.defwidth,
  #wysiwyg .right .inputText,
  #wysiwyg .right .inputTextarea {
    width: 100% !important;
    max-width: 100% !important;
  }

  #wysiwyg .item_addtext {
    float: none;
    display: block;
    margin-top: 0.25rem;
    font-size: 0.78rem;
  }

  #wysiwyg .formsubmit {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dee2e6;
  }

  #wysiwyg .formsubmit .submitButtonSave,
  #wysiwyg .formsubmit .submitButtonCan {
    width: 100%;
    margin: 0 !important;
  }

  #wysiwyg .inner_fieldset {
    width: 100%;
    margin: 1.25rem 0;
  }

  #wysiwyg .inner_table {
    margin: 0;
    width: 100%;
    font-size: 0.85rem;
  }

  #wysiwyg .inner_table th,
  #wysiwyg .inner_table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  #wysiwyg .inner_table tr {
    display: block;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #dee2e6;
  }
}

@media (min-width: 768px) {
  #wysiwyg .formline .right input.text,
  #wysiwyg .formline .right select,
  #wysiwyg .formline .right textarea {
    max-width: 100%;
  }
}
