/* 즐겨찾기 추가 모달 스타일 */

.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

.form-group input[type="text"],
.form-group input[type="url"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 아이콘 선택 */
.icon-selector {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-behavior: smooth;
}

/* 스크롤바 스타일링 */
.icon-selector::-webkit-scrollbar {
  height: 8px;
}

.icon-selector::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

.icon-selector::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.icon-selector::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.icon-option {
  min-width: 48px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  flex-shrink: 0;
}

.icon-option i {
  font-size: 1.25rem;
  color: #6b7280;
}

.icon-option:hover {
  border-color: #3b82f6;
  background-color: #eff6ff;
}

.icon-option.selected {
  border-color: #3b82f6;
  background-color: #dbeafe;
}

.icon-option.selected i {
  color: #3b82f6;
}

/* 색상 선택 */
.color-selector {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}

.color-option {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: 3px solid transparent;
  position: relative;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: #111827;
  box-shadow: 0 0 0 2px white, 0 0 0 4px #111827;
}

.color-option.selected::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 1.25rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 컬러 피커 버튼 */
.color-picker-option {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: 3px solid #e5e7eb;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg,
    #ff0000 0%, #ff7f00 16.67%, #ffff00 33.33%,
    #00ff00 50%, #0000ff 66.67%, #8b00ff 83.33%, #ff0000 100%);
  background-size: 200% 200%;
  overflow: hidden;
}

.color-picker-option:hover {
  transform: scale(1.1);
  border-color: #3b82f6;
}

.color-picker-option.selected {
  border-color: #111827;
  box-shadow: 0 0 0 2px white, 0 0 0 4px #111827;
}

.color-picker-option i {
  position: relative;
  z-index: 1;
  font-size: 1.25rem;
  color: white;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.custom-color-picker-hidden {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

/* 버튼 */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background-color: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

.btn-secondary:active {
  transform: scale(0.98);
}

/* 애니메이션 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 컨텍스트 메뉴 */
.context-menu {
  display: none;
  position: fixed;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
  z-index: 10000;
  min-width: 140px;
}

.context-menu.active {
  display: block;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
  color: #374151;
  font-size: 0.875rem;
}

.context-menu-item:hover {
  background-color: #f3f4f6;
}

.context-menu-item i {
  font-size: 0.875rem;
  width: 16px;
  text-align: center;
}

.context-menu-item:last-child {
  color: #dc2626;
}

.context-menu-item:last-child:hover {
  background-color: #fee2e2;
}

/* 반응형 */
@media (max-width: 640px) {
  .icon-selector {
    grid-template-columns: repeat(6, 1fr);
  }

  .color-selector {
    grid-template-columns: repeat(4, 1fr);
  }

  .modal-content {
    width: 95%;
    max-height: 95vh;
  }
}
