/* ==========================================================
   스마트79 — Photosheet (Phase4) CSS
   #screen-photo 전용 스타일
   px 고정값 금지 (border 1~2px 제외) / inline style 금지
   editor.css의 #main-hdr/.doc-tabs/.section/.editor-view/.list-* 재사용
   ========================================================== */

#screen-photo {
  background: var(--gray-bg);
}

/* ==========================================================
   #photo-main-hdr — editor.css #main-hdr와 동일 (ID 중복 회피용 복제)
   .hdr-top/.hdr-btn-icon/.editor-title/.hdr-btns/.doc-tabs/.doc-tab은
   class 기반이라 editor.css 정의를 그대로 재사용함.
   ========================================================== */
#photo-main-hdr {
  background: var(--blue-grad);
  padding: var(--sp-xl) var(--sp-lg) var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ==========================================================
   레이아웃 설정 (열/행 선택)
   ========================================================== */
.photo-layout-row {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}
.photo-layout-select {
  flex: 1;
  min-width: clamp(72px, 18vw, 100px);
  padding: var(--sp-sm) var(--sp-md);
  font-size: var(--fs-md);
  border: 1.5px solid var(--gray-border);
  border-radius: var(--radius-sm);
  background: var(--gray-bg);
  color: var(--text);
}

/* ==========================================================
   사진 그리드
   ========================================================== */
.photo-grid {
  display: grid;
  gap: var(--sp-sm);
}

.photo-cell {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

/* 빈 셀 — 추가 버튼 */
.photo-cell-empty {
  aspect-ratio: 1 / 1;
}
.photo-cell-add {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xs);
  border: 2px dashed var(--gray-border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  color: var(--text-sub);
  transition: border-color 0.15s;
}
.photo-cell-add:active {
  border-color: var(--green);
}
.photo-cell-add-icon {
  font-size: var(--icon-md);
}
.photo-cell-add-text {
  font-size: var(--fs-xs);
}
.photo-cell-add input[type=file] {
  display: none;
}

/* 채워진 셀 */
.photo-cell-filled {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.photo-cell-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
}
.photo-cell-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-cell-remove {
  position: absolute;
  top: var(--sp-xs);
  right: var(--sp-xs);
  width: clamp(24px, 6vw, 32px);
  height: clamp(24px, 6vw, 32px);
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: var(--white);
  border: none;
  font-size: var(--fs-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-cell-size {
  position: absolute;
  bottom: var(--sp-xs);
  left: var(--sp-xs);
  font-size: var(--fs-xs);
  color: var(--white);
  background: rgba(0,0,0,0.55);
  border-radius: var(--radius-sm);
  padding: 1px var(--sp-xs);
}
.photo-cell-caption {
  padding: var(--sp-xs);
}

/* ==========================================================
   캡션 선택 (CaptionSelect)
   ========================================================== */
.caption-chips {
  display: flex;
  gap: var(--sp-xs);
  flex-wrap: wrap;
}
.caption-chip {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-sub);
  background: var(--gray-bg);
  border: 1.5px solid var(--gray-border);
  border-radius: 999px;
  padding: var(--sp-xs) var(--sp-sm);
}
.caption-chip.active {
  color: var(--white);
  background: var(--blue);
  border-color: var(--blue);
}
.caption-custom-input {
  width: 100%;
  margin-top: var(--sp-xs);
  padding: var(--sp-xs) var(--sp-sm);
  font-size: var(--fs-xs);
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-sm);
  background: var(--gray-bg);
  color: var(--text);
  cursor: pointer;
}

/* "+ 추가" 칩 */
.caption-chip-add {
  color: var(--blue);
  background: var(--blue-light);
  border-color: var(--blue);
}

/* 현재 선택된 최종 캡션 표시 */
.caption-current {
  margin-top: var(--sp-xs);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--blue);
}

/* ==========================================================
   진행상태 선택 모달 (CaptionSelect singleton)
   .modal-overlay/.modal-box/.modal-confirm은 components.css 재사용
   ========================================================== */
.caption-status-box {
  max-width: clamp(260px, 80vw, 340px);
  text-align: center;
  padding: var(--sp-xl);
}
.caption-status-title {
  font-size: var(--fs-md);
  font-weight: 800;
  color: var(--text);
  margin-bottom: var(--sp-md);
}
.caption-status-options {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-md);
}
.caption-status-btn {
  width: 100%;
  padding: var(--sp-md);
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-light);
  border: 1.5px solid var(--blue);
  border-radius: var(--radius-sm);
}
.caption-status-btn:active {
  background: var(--blue);
  color: var(--white);
}
.caption-status-cancel {
  width: 100%;
}

/* ==========================================================
   용량 표시
   ========================================================== */
.cap-row {
  margin-bottom: var(--sp-sm);
}
.cap-row:last-child {
  margin-bottom: 0;
}
.cap-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: var(--sp-xs);
}
.cap-bar {
  width: 100%;
  height: clamp(6px, 1.5vw, 8px);
  background: var(--gray-border);
  border-radius: 999px;
  overflow: hidden;
}
.cap-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.2s;
}
.cap-bar-fill.over {
  background: var(--red);
}

/* ==========================================================
   Breakpoints
   ========================================================== */
@media (min-width: 985px) {
  #photo-screen-edit {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-md);
    padding: var(--sp-md);
    align-items: start;
  }
  #photo-screen-edit .section {
    margin: 0;
  }
  #photo-screen-edit .section:nth-child(3) {
    grid-column: 1 / -1;
  }
  #photo-screen-edit .editor-save-btn,
  #photo-screen-edit #photo-save-msg {
    grid-column: 1 / -1;
    margin: 0;
  }
}
