/* public/css/service-management.css */

/* 팝업창 전용 기본 스타일 */
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-color);
  min-width: 0 !important;
}

.service-management-container {
  display: flex;
  height: 100%;
  width: 100%;
}

/* 좌측 네비게이션 메뉴 영역 */
.split-left {
  width: 250px;
  background: rgba(0,0,0,0.02);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.split-resizer {
  width: 5px;
  cursor: col-resize;
  background: var(--border-color);
  flex-shrink: 0;
  transition: background 0.2s;
  z-index: 10;
}
.split-resizer:hover { background: var(--primary-color); }

/* 우측 컨텐츠 렌더링 영역 (스크롤 담당) */
.split-right {
  flex: 1;
  min-width: 0;
  padding: 0px; 
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card-bg);
  position: relative;
}

/* Angular ng-if 및 ng-controller 래퍼들이 Flex 영역을 꽉 채우도록 설정 */
.split-right > div,
.split-right > div > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* 메뉴 리스트 아이템 */
.menu-item {
  padding: 15px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: 0.2s;
  font-weight: 500;
  font-size: 1.05rem;
}
.menu-item:hover { background: rgba(0,0,0,0.05); color: var(--text-main); }
.menu-item.active { background: var(--primary-color); color: white; border-right: 4px solid var(--accent-gold); }

.dark-theme .split-left { background: rgba(0,0,0,0.2); border-right: 1px solid rgba(255,255,255,0.05); }
.dark-theme .menu-item { border-bottom: 1px solid rgba(255,255,255,0.05); }
.dark-theme .menu-item:hover { background: rgba(255,255,255,0.05); }

/* ====================================================
   통합 페이지 UI (Service Management 내부 화면용)
   ==================================================== */

.sm-page {
  padding: 20px 30px 15px 30px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
}

.sm-header {
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sm-header i {
  color: var(--primary-color);
}

.sm-toolbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  background: rgba(0,0,0,0.02);
  padding: 12px 15px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.dark-theme .sm-toolbar {
  background: rgba(255,255,255,0.02);
}

.sm-table-container {
  /* 테이블 컨테이너 자체 스크롤 적용. split-right는 flex로 고정 */
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  border-bottom: 1px solid var(--border-color); /* 하단 스크롤 경계 명확히 */
  min-height: 0;
}

.sm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  text-align: left;
}

.sm-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card-bg);
  padding: 12px 15px;
  font-weight: 600;
  color: var(--text-sub);
  border-bottom: 2px solid var(--border-color);
  box-shadow: 0 1px 0 var(--border-color); /* 명확한 경계 */
}

.dark-theme .sm-table th {
  background: #1e1e1e; /* 다크모드 var(--card-bg) 색상과 유사하게 고정 */
}

.sm-table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.sm-table tr:hover { background-color: rgba(0,0,0,0.02); }
.dark-theme .sm-table tr:hover { background-color: rgba(255,255,255,0.03); }
.sm-table tr.selected-row { background-color: rgba(61, 90, 254, 0.1); }
.sm-table tr.selected-row td:first-child { box-shadow: inset 3px 0 0 0 var(--primary-color); }

/* 테이블 요소 - 인풋 & 셀렉트 */
.sm-input {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px 12px;
  color: var(--text-main);
  width: 100%;
  font-size: 0.9rem;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.sm-input:focus { outline: none; border-color: var(--primary-color); }
.sm-input:disabled { opacity: 0.6; cursor: not-allowed; }

/* 텍스트 말줄임 및 확장 토글 */
.sm-text-box {
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.5;
  width: 100%;
}
.sm-text-truncate {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
}
.sm-text-expanded {
  display: block;
  max-height: calc(1.5em * 4); /* 최대 4줄 */
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  padding-right: 5px;
}
.sm-text-expanded::-webkit-scrollbar { width: 6px; }
.sm-text-expanded::-webkit-scrollbar-thumb { background: #888; border-radius: 3px; }

/* 버튼 */
.sm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--card-bg); border: 1px solid var(--border-color);
  color: var(--text-main); padding: 8px 14px; border-radius: 4px;
  cursor: pointer; transition: all 0.2s; font-size: 0.9rem; font-weight: 500;
}
.sm-btn:hover { background: rgba(0,0,0,0.05); }
.dark-theme .sm-btn:hover { background: rgba(255,255,255,0.1); }
.sm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sm-btn.primary { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.sm-btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.sm-btn.danger { background: #e74c3c; border-color: #c0392b; color: #fff; }
.sm-btn.danger:hover:not(:disabled) { filter: brightness(1.1); }

.sm-btn-icon {
  background: none; border: none; color: var(--text-sub);
  cursor: pointer; padding: 6px 8px; border-radius: 4px; transition: all 0.2s;
}
.sm-btn-icon:hover { color: var(--primary-color); background: rgba(0,0,0,0.05); }
.dark-theme .sm-btn-icon:hover { background: rgba(255,255,255,0.1); }

/* Toggle Switch (Public) */
.sm-toggle-switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.sm-toggle-switch input { opacity: 0; width: 0; height: 0; }
.sm-toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.sm-toggle-slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.sm-toggle-switch input:checked + .sm-toggle-slider { background-color: var(--primary-color); }
.sm-toggle-switch input:checked + .sm-toggle-slider:before { transform: translateX(14px); }

/* Image Preview Overlay */
.sm-img-preview-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85); z-index: 10000;
  display: flex; justify-content: center; align-items: center;
  animation: fadeIn 0.2s ease-out;
}
.sm-img-preview-content {
  position: relative; max-width: 90%; max-height: 90%;
  box-shadow: 0 0 20px rgba(0,0,0,0.5); border-radius: 8px; overflow: hidden; background: #222;
}
.sm-img-preview-content img { display: block; max-width: 100%; max-height: 80vh; object-fit: contain; }
.sm-img-preview-close {
  position: absolute; top: 10px; right: 15px; font-size: 2rem; color: white; cursor: pointer;
  background: rgba(0,0,0,0.5); border-radius: 50%; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center; border: none; z-index: 10001;
}
.sm-img-preview-close:hover { background: rgba(211,47,47,0.8); }

/* Context Menu */
.sm-context-menu {
  position: fixed; background-color: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); z-index: 10000;
  min-width: 200px; padding: 10px 0; animation: fadeIn 0.1s ease-out;
}
.sm-context-menu-header {
  padding: 5px 15px; font-size: 0.8rem; color: var(--text-sub); border-bottom: 1px solid var(--border-color);
  margin-bottom: 5px; display: flex; justify-content: space-between; align-items: center;
}
.sm-context-menu-list { list-style: none; padding: 0; margin: 0; max-height: 200px; overflow-y: auto; }
.sm-context-menu-item { padding: 8px 15px; cursor: pointer; font-size: 0.9rem; color: var(--text-main); transition: background 0.2s; }
.sm-context-menu-item:hover { background-color: rgba(61,90,254,0.1); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ====================================================
   서비스 관리 팝업: 메뉴별 컨텐츠 영역 배경 투명 + 정보 영역만 시인성 보정
   - 컨텐츠 영역(.split-right)은 투명하게 하여 배경 이미지가 보이도록 함
   - 정보가 표시되는 부분(테이블 셀, 툴바, 입력창)만 뒤 배경을 보정 (backdrop-filter)
     다크: 어둡게 / 라이트: 밝게
   - 레이드 목록(.raid-list-table)은 난이도 카드에 자체 보정이 있으므로 제외
     (부모에 backdrop-filter 가 있으면 자식 카드의 backdrop-filter 가 배경 이미지를 보지 못함)
   ==================================================== */
.service-management-container .split-right {
  background: transparent;
}

.split-right .sm-table:not(.raid-list-table) td,
.split-right .sm-toolbar,
.split-right .sm-input {
  backdrop-filter: blur(2px) brightness(1.25);
}

.dark-theme .split-right .sm-table:not(.raid-list-table) td,
.dark-theme .split-right .sm-toolbar,
.dark-theme .split-right .sm-input {
  backdrop-filter: blur(2px) brightness(0.5);
}

.split-right .sm-header,
.split-right .sm-table td {
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.6);
}

.dark-theme .split-right .sm-header,
.dark-theme .split-right .sm-table td {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
