/* AI CineCatch — 상세 모달 작품 공유 UI (PC 팝오버 / 모바일 바텀시트) */

.modal-share-layer {
  position: fixed;
  inset: 0;
  z-index: 10020;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-share-layer.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

/* 모바일 — 아주 약한 추가 dim */
.modal-share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.modal-share-layer.is-open .modal-share-backdrop {
  opacity: 1;
}

@media (min-width: 769px) {
  .modal-share-backdrop {
    display: none;
  }
}

/* 공유 패널 공통 */
.modal-share-panel {
  position: fixed;
  z-index: 10021;
  box-sizing: border-box;
  background: linear-gradient(165deg, #12141a 0%, #0a0b0f 100%);
  border: 1px solid rgba(242, 193, 78, 0.22);
  border-radius: 16px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.85),
    0 0 32px rgba(242, 193, 78, 0.06);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition:
    opacity 0.26s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-share-layer.is-open .modal-share-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* PC — 공유 아이콘 근처 팝오버 */
@media (min-width: 769px) {
  .modal-share-panel {
    width: min(320px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

  .modal-share-handle {
    display: none;
  }
}

/* 모바일 — 하단 바텀시트 */
@media (max-width: 768px) {
  .modal-share-panel {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: none !important;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(100%);
  }

  .modal-share-layer.is-open .modal-share-panel {
    transform: translateY(0);
  }

  .modal-share-handle {
    display: block;
    width: 44px;
    height: 5px;
    margin: 10px auto 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.18);
    cursor: grab;
    flex-shrink: 0;
  }
}

.modal-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-share-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main, #f3f4f6);
  letter-spacing: -0.02em;
}

.modal-share-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-share-close:hover {
  border-color: rgba(242, 193, 78, 0.35);
  color: var(--accent-gold, #f2c14e);
  background: rgba(242, 193, 78, 0.08);
}

.modal-share-body {
  padding: 12px 16px 16px;
}

.modal-share-work-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 6px;
  word-break: keep-all;
}

.modal-share-work-meta {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.45;
  margin-bottom: 8px;
}

.modal-share-work-desc {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.modal-share-link-row {
  margin-bottom: 14px;
}

.modal-share-link-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 0.72rem;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  outline: none;
  cursor: text;
}

.modal-share-link-input:focus {
  border-color: rgba(242, 193, 78, 0.35);
  box-shadow: 0 0 0 2px rgba(242, 193, 78, 0.08);
}

.modal-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.modal-share-btn--primary {
  margin-bottom: 12px;
  color: #0b0c0e;
  background: linear-gradient(135deg, var(--accent-gold, #f2c14e) 0%, #d4a035 100%);
  border: 1px solid rgba(242, 193, 78, 0.5);
  box-shadow: 0 4px 14px rgba(242, 193, 78, 0.2);
}

/* 모바일 — Web Share API 시스템 공유 (바텀시트 내부) */
.modal-share-btn--native {
  margin-bottom: 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(242, 193, 78, 0.28);
  box-shadow: 0 0 16px rgba(242, 193, 78, 0.06);
}

.modal-share-btn--native:hover {
  border-color: rgba(242, 193, 78, 0.45);
  background: rgba(242, 193, 78, 0.1);
}

.modal-share-btn--native[hidden] {
  display: none !important;
}

.modal-share-btn--primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 18px rgba(242, 193, 78, 0.28);
}

.modal-share-btn--primary:active {
  transform: scale(0.98);
}

.modal-share-sns-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.38);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.modal-share-sns-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.modal-share-sns-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-share-sns-btn:hover {
  border-color: rgba(242, 193, 78, 0.28);
  background: rgba(242, 193, 78, 0.07);
  color: #fff;
}

.modal-share-sns-btn:active {
  transform: scale(0.97);
}

.modal-share-sns-btn .sns-icon {
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
}

/* 공유 아이콘 활성 상태 */
.md-sub-share-btn.is-share-open {
  background-color: rgba(242, 193, 78, 0.14);
  border-color: rgba(242, 193, 78, 0.45);
  color: var(--accent-gold, #f2c14e);
  box-shadow: 0 0 12px rgba(242, 193, 78, 0.18);
}
