/**
 * Mouse Effect Widget - Minimal (with color settings)
 */
/* ========================================
   설정 페이지 스타일
======================================== */

.settings-container { max-width: 1200px; margin: 0 auto; }


h1{
  font-size: 20px;
  font-weight: 650;
  margin: 0 0 6px;
  color: #111;
  letter-spacing: -0.2px;
}

.subtitle{
  font-size: 12px;
  color: rgba(0,0,0,0.55);
}

.section{ margin-bottom: 16px; }

.section-title{
  font-size: 13px;
  font-weight: 650;
  margin: 10px 0 3px 0;
  color: rgba(0,0,0,0.80);
}

.divider{
  height: 1px;
  background: rgba(0,0,0,0.12);
  margin: 8px 0;
}

/* =========================
   필드 그리드 (2열 → 모바일 1열)
========================= */
.field-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
/* 그리드 안에서는 반쪽 칸에서도 깨지지 않게 */
.field-grid .color-field{
  flex-wrap: wrap;
  align-items: flex-start;
}

.field-grid .color-inputs{
  width: 100%;
}

.field-grid .color-text{
  min-width: 0;     /* ✅ 기존 180px 무력화 */
  width: 100%;
}

/* 기존 margin-bottom은 gap으로 대체 */
.field-grid .checkbox-field,
.field-grid .color-field,
.field-grid .cursor-image-field{
  margin-bottom: 0;
}

/* 전체폭(두 칸) */
.field-grid .span-2{
  grid-column: 1 / -1;
}

/* ========================================
   위젯 컨테이너
======================================== */
#mouse_effect_widget{
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

/* ========================================
   관리자 설정 버튼 & 모달
======================================== */
.mouse-effect-modal{
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.55);
  z-index: 100001;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.mouse-effect-modal.active{ display: flex; }

.mouse-effect-modal-content{
  position: relative;
  width: min(500px, 92vw);
  height: min(680px, 86vh);
  padding: 20px;
  background: #f9f9f9;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  overflow: hidden;
}

.mouse-effect-modal-close{
  position: absolute;
  top: 14px; right: 14px;
  width: 38px; height: 38px;
  border: none;
  background: rgba(20,20,20,0.9);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  font-size: 22px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}

.mouse-effect-modal-close:hover{
  background: #fff;
  color: #111;
  transform: rotate(90deg);
}

.mouse-effect-modal-iframe{
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}


/* ========================================
   체크박스 필드
======================================== */
.checkbox-field{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.checkbox-field:hover{
  background: #fff;
  border-color: rgba(0,0,0,0.18);
  transform: translateY(-1px);
}

.checkbox-field input[type="checkbox"]{
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #111;
}

.checkbox-field label{
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: rgba(0,0,0,0.82);
}
/* =========================
   Toggle Switch (Minimal)
========================= */
.toggle-field{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 8px;
}

/* 텍스트 */
.toggle-label{
  font-size: 14px;
  color: rgba(0,0,0,0.85);
  white-space: nowrap;
}

/* 스위치 래퍼 */
.toggle-switch{
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

/* 실제 checkbox 숨기기 */
.toggle-switch input{
  opacity: 0;
  width: 0;
  height: 0;
}

/* 트랙 */
.toggle-slider{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.18);
  border-radius: 999px;
  transition: background 0.2s ease;
}

/* 손잡이 */
.toggle-slider::before{
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

/* ON 상태 */
.toggle-switch input:checked + .toggle-slider{
  background: rgba(60, 130, 255, 0.85);
}

.toggle-switch input:checked + .toggle-slider::before{
  transform: translateX(20px);
}

/* 포커스(접근성) */
.toggle-switch input:focus + .toggle-slider{
  box-shadow: 0 0 0 2px rgba(60,130,255,0.35);
}

/* ========================================
   색상 필드
======================================== */
.color-field{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 10px;
  margin-bottom: 10px;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.color-field:hover{
  background: #fff;
  border-color: rgba(0,0,0,0.18);
  transform: translateY(-1px);
}

.color-field label{
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

.color-label-text{
  font-size: 13px;
  font-weight: 550;
  color: rgba(0,0,0,0.82);
}

.color-preview{
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid rgba(0,0,0,0.12);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform .18s ease;
}

.color-field:hover .color-preview{
  transform: scale(1.08);
}

.color-field input[type="color"]{
  width: 42px;
  height: 32px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  padding: 2px;
  transition: transform .18s ease;
}

.color-field input[type="color"]::-webkit-color-swatch-wrapper{
  padding: 0;
}

.color-field input[type="color"]::-webkit-color-swatch{
  border: none;
  border-radius: 6px;
}

.color-field input[type="color"]:hover{
  transform: scale(1.05);
}

.color-inputs{
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-text{
  flex: 1 1 auto;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 10px;
  font-size: 14px;
}

.color-text.is-invalid{
  border-color: rgba(220, 38, 38, 0.65);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* ========================================
   잔상 이미지 필드 (독립 스타일)
======================================== */
.cursor-image-field{
  display: grid;
  grid-template-columns: 3fr 1fr;   
  gap: 12px;
  align-items: start;
}

/* 라벨은 전체 폭 */
.cursor-image-label{
  grid-column: 1 / -1;
}

/* 입력 영역은 세로 스택 */
.cursor-image-input-group{
  display: flex;
  gap: 8px;
}


.cursor-image-input{
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.cursor-image-input:focus{
  outline: none;
  border-color: rgba(0,0,0,0.35);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.cursor-image-preview-btn{
  padding: 8px 14px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  background: #fff;
  color: rgba(0,0,0,0.80);
  white-space: nowrap;
  transition: background .18s ease, transform .18s ease;
}

.cursor-image-preview-btn:hover{
  background: rgba(0,0,0,0.04);
  transform: translateY(-1px);
}

.cursor-image-preview{
  width: 100%;
  aspect-ratio: 1 / 1;             /* ✅ 정사각형 */
  background: rgba(0,0,0,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;

  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}


.cursor-image-preview::before{

  font-size: 32px;
  color: rgba(0,0,0,0.15);
  position: absolute;
  pointer-events: none;
}

/* 이미지 비율 유지 */
.cursor-image-preview img{
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
/* 이미지 로드 실패 시 broken icon 숨김 */
.cursor-image-preview img[src=""],
.cursor-image-preview img:not([src]){
  opacity: 0;
}

.cursor-image-hint{
  font-size: 11.5px;
  line-height: 1.5;
  color: rgba(0,0,0,0.55);
}

.cursor-image-hint strong{
  color: rgba(0,0,0,0.70);
  font-weight: 600;
}
/* =========================
   토글 2열 / 셀렉트 2열
========================= */
.toggle-grid-2{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

/* 2열 레이아웃 유지 */
.select-grid-2{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* effect-section은 그리드 아이템이니까 항상 자리 차지 */
.select-grid-2 .effect-section{
  display: block;
  margin-top: 0;              /* ✅ 그리드에서는 위 여백 불필요 */
}

/* OFF 상태: 흐리게 + 클릭 불가 */
.select-grid-2 .effect-section{
  opacity: 0.35;
  pointer-events: none;
}
.select-grid-2 .effect-section.active{
  opacity: 1;
  pointer-events: auto;
}

/* 셀렉트 스타일은 한 군데로 통일 */
.select-grid-2 select{
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.8);
  font-size: 13px;
  cursor: pointer;
}


/* ========================================
   버튼
======================================== */
.effect-btn-group{
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.effect-ui-btn{
  flex: 1;
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  background: #111;
  color: #fff;
  transition: transform .16s ease, background .16s ease;
}
 
.effect-ui-btn:hover{
  transform: translateY(-1px);
  background: #000;
}

/* ========================================
   커서 색상 접기/펼치기
======================================== */
.color-accordion .accordion-toggle{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.color-accordion .accordion-icon{
  display: inline-block;
  transform: rotate(0deg);
  transition: transform .18s ease;
  opacity: .7;
}

.color-accordion.is-collapsed .accordion-icon{
  transform: rotate(-90deg);
}

.color-accordion .accordion-body{
  margin-top: 12px;
}

.color-accordion.is-collapsed .accordion-body{
  display: none;
}

/* ========================================
   토글 버튼 (좌측 하단)
======================================== */
.widget-effect{
  position: fixed;
  bottom: 8%;
  left: 1%;
  z-index: 99990;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
}

.widget-effect-toggle{
  width: 35px;
  height: 35px;
  border: none;
  border-radius: 8px;
  background: var(--btn-primary-bg, #64748b);
  color: var(--btn-primary-text, #fff);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--content-font-size) * 1.2);
}

.widget-effect-toggle:hover{
  transform: scale(1.05);
  filter: brightness(1.1);
}

.widget-effect-toggle.active{
  background: var(--btn-accent-bg, rgba(0,0,0,0.88));
}

/* ========================================
   반응형
======================================== */
@media (max-width: 768px){
  body{ padding: 0; }
  
  .mouse-effect-modal{ padding: 14px; }
  
  .mouse-effect-modal-content{
    width: 96vw;
    height: 88vh;
    border-radius: 10px;
  }
  
  h1{ font-size: 20px; }
  
  .widget-effect{ display: none; }
  
  .cursor-image-input-group{
    flex-direction: column;
    align-items: stretch;
  }
  
  .cursor-image-preview-btn{
    width: 100%;
  }
}