﻿/* ═══════════════════════════════════════════════════════════════
   PortalDialog – Persistent tabbed modal dialog for Portal UI
   v38: v30 fixes (notifications z-index, header buttons, cursor)
   ═══════════════════════════════════════════════════════════════ */

/* ── Backdrop (per-instance) ── */

.portal-dialog-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.1s linear;
}

  .portal-dialog-backdrop.in {
    opacity: 1;
  }

/* ── Dialog (replaces Bootstrap .modal) ── */

.portal-dialog {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  outline: 0;
  opacity: 0;
  transition: opacity 0.1s linear;
}

  .portal-dialog.in {
    opacity: 1;
  }

  .portal-dialog .portal-dialog-container {
    transition: transform 0.1s ease-out;
  }

/* ── Dialog container: full-height by default ── */

.portal-dialog .portal-dialog-container {
  height: calc(100% - 10px);
  display: flex;
  flex-direction: column;
}

  .portal-dialog .portal-dialog-container.portal-dialog-fullscreen {
    width: 99%;
    margin: 5px auto;
  }

@media (max-width: 768px) {
  .portal-dialog .portal-dialog-container.portal-dialog-fullscreen {
    width: 100%;
    margin: 0;
    height: 100%;
  }

  .portal-dialog .portal-dialog-container {
    margin: 4px auto;
  }
}

/* ── Modal content: flex column ── */

.portal-dialog .modal-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── GetWindowDialog compat marker ── */

.portal-dialog-compat-marker {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  opacity: 0;
  pointer-events: none;
}

/* ── Header with tabs ── */

.portal-dialog-header.modal-header {
  display: flex;
  align-items: stretch;
  padding: 0;
  min-height: 40px;
  flex-shrink: 0;
  border-bottom: 1px solid #ddd;
  position: relative;
  z-index: 10;
}

  .portal-dialog-header.modal-header::before,
  .portal-dialog-header.modal-header::after {
    display: none;
  }

/* Tab scroll wrapper */
.portal-dialog-scroll-wrapper {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.portal-dialog-tabs-nav {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

  .portal-dialog-tabs-nav::-webkit-scrollbar {
    display: none;
  }

.portal-dialog-tabs {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
}

/* Scroll arrow buttons */
.portal-dialog-scroll-btn {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  border: none;
  color: #555;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  padding: 0;
}

  .portal-dialog-scroll-btn.left {
    left: 0;
    background: linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0.9) 60%, rgba(255, 255, 255, 0));
    margin-left: 0px;
  }

  .portal-dialog-scroll-btn.right {
    right: 0;
    background: linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0.9) 60%, rgba(255, 255, 255, 0));
  }

  .portal-dialog-scroll-btn:hover {
    color: #111;
  }

  .portal-dialog-scroll-btn:disabled {
    opacity: 0.25;
    cursor: default;
  }

/* ── Tabs ── */

.portal-dialog-tab {
  flex-shrink: 0;
}

  .portal-dialog-tab > a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    white-space: nowrap;
    text-decoration: none;
    color: #666;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
  }

    .portal-dialog-tab > a:hover,
    .portal-dialog-tab > a:focus {
      color: #333;
      border-bottom-color: #ccc;
      background-color: rgba(0, 0, 0, 0.02);
      text-decoration: none;
    }

  .portal-dialog-tab.active > a,
  .portal-dialog-tab.active > a:hover,
  .portal-dialog-tab.active > a:focus {
    color: #333;
    font-weight: 600;
    border-bottom-color: #337ab7;
    background-color: transparent;
  }

.portal-dialog-tab-title {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-dialog-tab-close {
  font-size: 15px;
  line-height: 1;
  color: #666;
  opacity: 0.5;
  cursor: pointer;
  padding: 0 2px;
  font-weight: normal;
}

  .portal-dialog-tab-close:hover {
    opacity: 1;
    color: #c00;
  }

/* ── Header actions (z-index above body) ── */

.portal-dialog-actions {
  display: flex;
  align-items: center;
  padding: 0;
  gap: 0;
  flex-shrink: 0;
  border-left: 1px solid #eee;
  position: relative;
  z-index: 20;
}

  .portal-dialog-actions .close {
    float: none;
    margin: 0;
    font-size: 15px;
    color: #666;
    opacity: 0.7;
    text-shadow: none;
    /* v30: full-height clickable buttons */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 0;
    transition: background-color 0.15s, opacity 0.15s;
    cursor: pointer;
  }

    .portal-dialog-actions .close:hover {
      opacity: 1;
      color: #333;
      background-color: rgba(0, 0, 0, 0.05);
    }

    .portal-dialog-actions .close:last-child {
      border-radius: 0 4px 0 0;
    }

.portal-dialog-actions > .portal-dialog-btn-minimize {
  font-size: 12px;
}

/* ── Body ── */

.portal-dialog-body.modal-body {
  flex: 1 1 auto;
  padding: 0;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  overflow-y: hidden;
  -webkit-overflow-scrolling: auto;
  overflow-scrolling: auto;
}

/* Tab panes */
.portal-dialog-pane {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

  .portal-dialog-pane.active {
    display: flex;
  }

.portal-dialog-iframe {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border: none;
  margin: 0;
  padding: 0;
  outline: 0;
}

.portal-dialog-pane > :not(iframe):not(.portal-dialog-iframe):not(.portal-dialog-loading) {
  overflow-y: auto;
  flex: 1 1 auto;
}

/* ── Loading overlay ── */

.portal-dialog-loading {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  color: #999;
}

/* ── Footer (v26: fixed layout – selection display left, button right) ── */

.portal-dialog-footer.modal-footer {
  flex-shrink: 0;
  padding: 8px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-dialog-footer .map-select-display-footer {
  flex: 1 1 auto;
  min-width: 0;
}

.portal-dialog-footer .map-select-display-label {
  font-size: 13px;
  color: #888;
}

.portal-dialog-footer .map-select-display.has-selection .map-select-display-label {
  color: #333;
  font-weight: 600;
}

.portal-dialog-footer .map-select-display-list {
  font-size: 13px;
  color: #333;
}

.portal-dialog-footer .map-select-display-item {
  display: inline-block;
  margin: 0 4px 0 0;
}

  .portal-dialog-footer .map-select-display-item .fa {
    color: #d9534f;
    margin-right: 2px;
  }

/* ── Floating badge (main only) ── */

.portal-dialog-badge {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 1040;
  background: #337ab7;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s, transform 0.15s;
  user-select: none;
}

  .portal-dialog-badge:hover {
    background: #286090;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .portal-dialog-badge i {
    font-size: 16px;
  }

.portal-dialog-badge-count {
  font-weight: 600;
  min-width: 12px;
  text-align: center;
}

/* ── Tab actions (× close + ▾ dropdown) ── */

.portal-dialog-tab-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
}

.portal-dialog-tab-dropdown {
  position: relative;
  display: inline-block;
}

.portal-dialog-tab-dropdown-toggle {
  font-size: 12px;
  color: #666;
  opacity: 0.5;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

  .portal-dialog-tab-dropdown-toggle:hover {
    opacity: 1;
    color: #333;
  }

.portal-dialog-tab-menu.dropdown-menu {
  display: none;
  position: fixed;
  min-width: 180px;
  z-index: 1060;
  margin: 0;
  font-size: 13px;
}

.portal-dialog-tab-dropdown.open .portal-dialog-tab-menu.dropdown-menu {
  display: block;
}

.portal-dialog-tab-menu > li.disabled > a {
  color: #aaa;
  cursor: default;
}

/* ═══════════════════════════════════════════════════════════════
   Multi-dialog switcher panel
   ═══════════════════════════════════════════════════════════════ */

.portal-dialog-switcher {
  position: fixed;
  bottom: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  gap: 4px;
  background: rgba(30, 30, 30, 0.92);
  border-radius: 8px;
  padding: 4px 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  user-select: none;
}

.portal-dialog-switcher-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

  .portal-dialog-switcher-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
  }

  .portal-dialog-switcher-item.active {
    background: rgba(51, 122, 183, 0.85);
    color: #fff;
  }

  .portal-dialog-switcher-item i {
    font-size: 14px;
    width: 16px;
    text-align: center;
  }

.portal-dialog-switcher-title {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-dialog-switcher-count {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   v26: Inline confirm overlay (rendered inside the modal)
   ═══════════════════════════════════════════════════════════════ */

.portal-dialog-confirm-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-dialog-confirm-box {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  padding: 24px 28px;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.portal-dialog-confirm-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

.portal-dialog-confirm-message {
  font-size: 14px;
  color: #555;
  margin-bottom: 20px;
  line-height: 1.5;
}

.portal-dialog-confirm-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

  .portal-dialog-confirm-buttons .btn {
    min-width: 100px;
  }

/* ═══════════════════════════════════════════════════════════════
   v30: Toast notifications above all dialogs
   ═══════════════════════════════════════════════════════════════ */

[data-notify="container"] {
  z-index: 9999 !important;
}
