/* ============================================================
   보라톡 이미지 박스 스타일
   ============================================================ */

/* ─── 이미지 박스 화면 헤더 ──────────────────────────────── */
.imgbox-header {
  background: linear-gradient(135deg, #7C3AED, #5B21B6) !important;
  border-bottom: none !important;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.imgbox-add-folder-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.imgbox-add-folder-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* ─── 이미지 박스 컨텐츠 영역 ────────────────────────────── */
.imgbox-content {
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

/* ─── 설명 바 ────────────────────────────────────────────── */
.imgbox-desc-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: #F5F3FF;
  border-bottom: 1px solid #EDE9FE;
  font-size: 11.5px;
  color: #5B21B6;
  font-weight: 500;
  line-height: 1.5;
}

/* ─── 폴더 그리드 ────────────────────────────────────────── */
.imgbox-folder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
}

.imgbox-folder-card {
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(124,58,237,0.08);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  border: 1.5px solid #EDE9FE;
}
.imgbox-folder-card:hover,
.imgbox-folder-card:focus {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124,58,237,0.18);
  outline: none;
}
.imgbox-folder-card:active {
  transform: translateY(0);
}

/* 폴더 미리보기 이미지 영역 */
.imgbox-folder-preview {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #EDE9FE, #DDD6FE);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.ibf-preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ibf-no-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}

/* 폴더 정보 */
.imgbox-folder-info {
  padding: 8px 10px 6px;
}
.ibf-emoji-name {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}
.ibf-emoji { font-size: 16px; }
.ibf-name {
  font-size: 12px;
  font-weight: 700;
  color: #1F2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.ibf-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #9CA3AF;
}
.ibf-checked {
  color: #7C3AED;
  font-weight: 600;
}

/* 폴더 액션 버튼 */
.ibf-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.imgbox-folder-card:hover .ibf-actions {
  opacity: 1;
}
.ibf-share-btn,
.ibf-del-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.ibf-share-btn {
  background: rgba(124,58,237,0.85);
  color: white;
}
.ibf-share-btn:hover { background: #7C3AED; }
.ibf-del-btn {
  background: rgba(239,68,68,0.85);
  color: white;
}
.ibf-del-btn:hover { background: #EF4444; }

/* ─── 빈 상태 ────────────────────────────────────────────── */
.imgbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.imgbox-empty-icon { font-size: 52px; margin-bottom: 14px; opacity: 0.5; }
.imgbox-empty-title { font-size: 16px; font-weight: 700; color: #374151; margin-bottom: 6px; }
.imgbox-empty-desc { font-size: 12px; color: #9CA3AF; margin-bottom: 20px; line-height: 1.6; }
.imgbox-empty-btn {
  background: linear-gradient(135deg, #7C3AED, #5B21B6);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.imgbox-empty-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}

/* ─── 폴더 내부 헤더 ─────────────────────────────────────── */
.imgbox-inner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: white;
  border-bottom: 1px solid #EDE9FE;
  position: sticky;
  top: 0;
  z-index: 10;
}
.imgbox-back-folder-btn {
  background: none;
  border: none;
  color: #7C3AED;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.imgbox-back-folder-btn:hover { background: #F5F3FF; }

.imgbox-folder-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.imgbox-folder-emoji { font-size: 18px; }
.imgbox-folder-name-display { font-size: 14px; font-weight: 800; color: #1F2937; }

.imgbox-inner-actions {
  display: flex;
  gap: 6px;
}
.imgbox-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.imgbox-action-btn {
  background: #F5F3FF;
  color: #7C3AED;
}
.imgbox-action-btn:hover { background: #EDE9FE; }
.imgbox-add-img-btn {
  background: linear-gradient(135deg, #7C3AED, #5B21B6) !important;
  color: white !important;
}

/* ─── 이미지 그리드 ──────────────────────────────────────── */
.imgbox-img-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px;
}

.imgbox-img-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #F3F4F6;
  cursor: pointer;
  aspect-ratio: 1;
  transition: transform 0.15s;
  border: 2px solid transparent;
}
.imgbox-img-card:hover { transform: scale(1.02); }
.imgbox-img-card:focus { outline: 2px solid #7C3AED; }
.imgbox-img-card.img-checked {
  border-color: #7C3AED;
}

.imgbox-img-thumb {
  width: 100%;
  height: 100%;
  position: relative;
}
.imgbox-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.imgbox-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #F5F3FF;
  font-size: 28px;
}
.ibimg-fname {
  font-size: 8px;
  color: #6B7280;
  text-align: center;
  padding: 0 4px;
  word-break: break-all;
  max-width: 100%;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 70px;
}

.imgbox-img-check-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #7C3AED;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.imgbox-img-meta {
  display: none; /* 그리드에서는 숨김 — 호버 시 표시 */
}

.ibimg-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 5px;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.imgbox-img-card:hover .ibimg-actions { opacity: 1; }

.ibimg-check-btn,
.ibimg-del-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.ibimg-check-btn { background: rgba(124,58,237,0.85); }
.ibimg-check-btn.checked { background: #7C3AED; }
.ibimg-del-btn { background: rgba(239,68,68,0.75); }
.ibimg-mark-btn { background: rgba(249,115,22,0.85); }
.ibimg-mark-btn:hover { background: rgba(249,115,22,1); }

/* 마킹 배지 (이미지 우상단) */
.imgbox-img-mark-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #F97316;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

/* 마킹 설명 미리보기 */
.imgbox-img-desc-preview {
  font-size: 10px;
  color: #F97316;
  padding: 2px 6px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 폴더 내 빈 상태 */
.imgbox-inner-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  text-align: center;
}

/* ─── 폴더 만들기 모달 ────────────────────────────────────── */
.imgbox-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.imgbox-modal-sheet {
  background: white;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 430px;
  padding-bottom: 20px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUpSheet 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); opacity: 0.5; }
  to   { transform: translateY(0); opacity: 1; }
}

.imgbox-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #F3F4F6;
}
.imgbox-modal-title {
  font-size: 15px;
  font-weight: 800;
  color: #1F2937;
}
.imgbox-modal-close {
  background: #F3F4F6;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  color: #6B7280;
  display: flex;
  align-items: center;
  justify-content: center;
}
.imgbox-modal-close:hover { background: #E5E7EB; }

.imgbox-modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 이모지 선택 */
.imgbox-emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.imgbox-emoji-opt {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 2px solid #E5E7EB;
  background: #F9FAFB;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.imgbox-emoji-opt:hover { border-color: #7C3AED; background: #F5F3FF; }
.imgbox-emoji-opt.selected {
  border-color: #7C3AED;
  background: #EDE9FE;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}

.imgbox-name-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #E5E7EB;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.imgbox-name-input:focus { border-color: #7C3AED; }
.imgbox-name-input.input-error { border-color: #EF4444; animation: shake 0.3s; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.imgbox-confirm-btn {
  background: linear-gradient(135deg, #7C3AED, #5B21B6);
  color: white;
  border: none;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.imgbox-confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.35);
}

/* ─── 이미지 뷰어 모달 ────────────────────────────────────── */
.imgbox-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.imgbox-viewer-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  flex-shrink: 0;
}
.imgbox-viewer-close {
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.imgbox-viewer-title {
  font-size: 13px;
  font-weight: 700;
  color: white;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.imgbox-viewer-action {
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.imgbox-viewer-action:hover { background: rgba(255,255,255,0.25); }
.imgbox-viewer-del { color: #FCA5A5; }

.imgbox-viewer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 16px;
  position: relative;
}

/* 체크 오버레이 */
.imgbox-check-overlay {
  position: absolute;
  inset: 0;
  background: rgba(124,58,237,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}
.imgbox-check-badge {
  background: #7C3AED;
  color: white;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.imgbox-viewer-footer {
  width: 100%;
  padding: 14px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.imgbox-viewer-check-btn {
  background: linear-gradient(135deg, #7C3AED, #5B21B6);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
  width: 100%;
  justify-content: center;
  max-width: 340px;
}
.imgbox-viewer-check-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}
.imgbox-viewer-info {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}

/* ─── 통화 중 이미지 박스 모달 ───────────────────────────── */
.imgbox-call-sheet {
  max-height: 75vh;
}

.imgbox-call-tabs {
  display: flex;
  border-bottom: 1px solid #F3F4F6;
  padding: 0 18px;
}
.imgbox-call-tab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: #9CA3AF;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.imgbox-call-tab.active {
  color: #7C3AED;
  border-bottom-color: #7C3AED;
}

.imgbox-call-panel { display: none; }
.imgbox-call-panel.active { display: block; }

/* 폴더 목록 */
.call-imgbox-folder-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px 0;
}

.call-folder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.15s;
}
.call-folder-item:hover { background: #F5F3FF; }

.cfi-thumb {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  overflow: hidden;
  background: #EDE9FE;
  flex-shrink: 0;
}
.cfi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cfi-no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.cfi-info { flex: 1; min-width: 0; }
.cfi-name { font-size: 13px; font-weight: 700; color: #1F2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cfi-meta { font-size: 11px; color: #9CA3AF; margin-top: 2px; }
.cfi-arrow { background: none; border: none; color: #9CA3AF; font-size: 12px; cursor: pointer; }

/* 최근 이미지 그리드 */
.call-imgbox-recent-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.call-recent-img {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: all 0.15s;
}
.call-recent-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.call-recent-img.selected {
  border-color: #7C3AED;
}
.cri-overlay {
  position: absolute;
  inset: 0;
  background: rgba(124,58,237,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}
.call-recent-img.selected .cri-overlay { display: flex; }

/* 선택된 이미지 미리보기 */
.imgbox-call-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #F5F3FF;
  border-top: 1px solid #EDE9FE;
}
.imgbox-selected-preview {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 1;
  overflow: hidden;
}
.ibsel-thumb {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  border: 1.5px solid #DDD6FE;
}
.ibsel-file {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #EDE9FE;
  font-size: 16px;
}
.ibsel-more {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #7C3AED;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
.imgbox-selected-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.imgbox-share-now-btn {
  background: linear-gradient(135deg, #7C3AED, #5B21B6);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s;
  white-space: nowrap;
}
.imgbox-share-now-btn:hover { transform: scale(1.03); }
.imgbox-share-now-btn:disabled { opacity: 0.4; cursor: default; transform: none; }

/* ─── 폴더 내부 이미지 선택 모달 ────────────────────────── */
.call-imgbox-inner-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 10px;
  max-height: 380px;
  overflow-y: auto;
}

.cii-thumb {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: all 0.15s;
  background: #F5F3FF;
}
.cii-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cii-no-img {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
}
.cii-thumb.selected {
  border-color: #7C3AED;
}
.cii-thumb.already-checked {
  border-color: #10B981;
}
.cii-checked-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #10B981;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}
.cii-select-overlay {
  position: absolute;
  inset: 0;
  background: rgba(124,58,237,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
}
.cii-thumb.selected .cii-select-overlay { display: flex; }
.cii-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 8px;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.imgbox-call-inner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 14px;
  border-top: 1px solid #F3F4F6;
}

/* ─── vsm 모달: 이미지 박스에서 선택 버튼 ───────────────── */
.vsm-imgbox-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 24px);
  margin: 6px 12px 0;
  padding: 9px 14px;
  background: linear-gradient(135deg, #5B21B6, #7C3AED);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.vsm-imgbox-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.35);
}

/* ─── 영상통화 FAB: 이미지 박스 버튼 ────────────────────── */
.fab-imgbox {
  background: linear-gradient(135deg, #7C3AED, #5B21B6) !important;
  position: relative;
}
.fab-imgbox::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid rgba(255,255,255,0.3);
  pointer-events: none;
}

/* ─── vtab 이미지 박스 버튼 강조 ────────────────────────── */
.vtab-img-icon {
  background: linear-gradient(135deg, #7C3AED, #5B21B6) !important;
  color: white !important;
}
