/* ===========================================
   SUNDK POPUP ======================================== */

/* ===== BASE ===== */

* {
  font-family: Arial, Helvetica, sans-serif;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== HEADER ===== */

.popup-header {
  background: #162e59;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
}

.popup-header-title {
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== NAVIGATION ===== */

.popup-nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

.popup-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.popup-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.25);
}

.popup-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.popup-btn.active {
  background: rgba(255,255,255,0.3);
}

.popup-counter {
  font-size: 14px;
  min-width: 45px;
  text-align: center;
}

.popup-nav-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.3);
  margin: 0 4px;
}

/* ===== MAIN LAYOUT ===== */

.popup-main {
  display: flex;
  height: calc(100vh - 56px);
}

/* ===== SLIDES ===== */

.popup-slides {
  flex: 1;
  padding: 24px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.popup-slide {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.popup-slide.hidden {
  display: none;
}

.popup-slide-header {
  font-size: 17px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e0e0e0;
}

.popup-slide-body {
  background: #fff;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/* ===== IMAGE CONTENT ===== */

.popup-image-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  width: 100%;
  height: 100%;
}

.popup-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.popup-caption {
  margin-top: 16px;
  color: #666;
  font-size: 14px;
  text-align: center;
}

/* ===== TABLE CONTENT ===== */

.popup-table-wrap {
  overflow: auto;
  flex: 1;
}

/* ===== RESIZE HANDLE ===== */

.popup-resize {
  width: 6px;
  background: #e0e0e0;
  cursor: col-resize;
  flex-shrink: 0;
}

.popup-resize:hover, .popup-resize.dragging {
  background: #162e59;
}

/* ===== SIDEBAR ===== */

.popup-sidebar {
  width: 280px;
  min-width: 180px;
  max-width: 450px;
  background: #fff;
  border-left: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
}

.popup-sidebar.hidden {
  width: 0 !important;
  min-width: 0;
  overflow: hidden;
  border: none;
}

.popup-sidebar-header {
  padding: 14px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.popup-sidebar-list {
  list-style: none;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.popup-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 4px;
}

.popup-sidebar-item:hover {
  background: #f0f4ff;
}

.popup-sidebar-item.active {
  background: #e8f0ff;
  border-left: 3px solid #162e59;
  padding-left: 7px;
}

.popup-sidebar-num {
  font-size: 11px;
  color: #666;
  min-width: 50px;
  flex-shrink: 0;
}

.popup-sidebar-type {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

.popup-sidebar-type.type-table {
  background: #e8f0ff;
  color: #162e59;
}

.popup-sidebar-type.type-chart {
  background: #fff3e0;
  color: #e65100;
}

.popup-sidebar-type.type-download {
  background: #e0e0e0;
  color: #666;
}

.popup-sidebar-title {
  font-size: 12px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   DATA CARD POPUP STYLES
   ============================================ */

body.datacard-popup {
  display: flex;
  flex-direction: column;
}

/* ===== TOOLBAR ===== */

.popup-toolbar {
  background: #f8f9fa;
  padding: 12px 24px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  display: flex;
  gap: 24px;
  align-items: center;
}

.popup-description {
  flex: 1;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

/* ===== CONTENT AREA ===== */

.popup-content {
  flex: 1;
  padding: 2rem;
  display: flex;
  min-height: 0;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.popup-content > div {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image content gets padding */
.popup-content #image-content {
  padding: 24px;
}

.popup-content img,
.popup-content svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: auto;
}

/* Table content takes full width without padding */
.popup-content #table-content {
  padding: 0;
  overflow: auto;
}

/* Download content gets padding */
.popup-content #download-content {
  padding: 24px;
  flex-direction: column;
  text-align: center;
}

.popup-content #download-content p {
  text-align: center;
  margin: 16px 0;
}

/* ===== TABLE CONTAINER ===== */

.popup-table-container {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: auto;
  width: 100%;
}

.sort-icon {
  margin-left: 8px;
  opacity: 0.6;
}

/* ===== LOADING STATE ===== */

.popup-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  gap: 16px;
}

.popup-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #162e59;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

