'use client';

import React from 'react';

type NoticeCancelModalProps = {
  open: boolean;
  onClose: () => void;
  onConfirm: () => void;
};

/**
 * 공지사항 작성 취소 확인 모달
 */
export default function NoticeCancelModal({
  open,
  onClose,
  onConfirm,
}: NoticeCancelModalProps) {
  if (!open) return null;

  return (
    <div className="fixed inset-0 z-[60] flex items-center justify-center">
      <div
        className="absolute inset-0 bg-black/40"
        onClick={onClose}
        aria-hidden="true"
      />
      <div className="relative z-10 bg-white rounded-[8px] p-[24px] shadow-[0px_8px_20px_0px_rgba(0,0,0,0.06),0px_24px_60px_0px_rgba(0,0,0,0.12)] flex flex-col gap-[32px] items-end justify-end w-[400px]">
        <div className="flex flex-col gap-[16px] items-start justify-center w-full">
          <div className="flex gap-[8px] items-start w-full">
            <p className="text-[18px] font-semibold leading-[1.5] text-[#333c47]">
              작성 중인 내용이 있습니다.
            </p>
          </div>
          <div className="flex gap-[8px] items-start w-full">
            <div className="text-[15px] font-normal leading-[1.5] text-[#4c5561]">
              <p className="mb-0">정말 취소하시겠습니까?</p>
            </div>
          </div>
        </div>
        <div className="flex gap-[8px] items-center justify-end shrink-0">
          <button
            type="button"
            onClick={onClose}
            className="bg-[#f1f3f5] h-[40px] rounded-[8px] px-[8px] flex items-center justify-center shrink-0 w-[80px] hover:bg-[#e9ecef] cursor-pointer transition-colors"
          >
            <p className="text-[16px] font-semibold leading-[1.5] text-[#4c5561] text-center whitespace-pre">
              취소
            </p>
          </button>
          <button
            type="button"
            onClick={onConfirm}
            className="bg-[#1f2b91] h-[40px] rounded-[8px] px-[8px] flex items-center justify-center shrink-0 w-[80px] hover:bg-[#1a2478] cursor-pointer transition-colors"
          >
            <p className="text-[16px] font-semibold leading-[1.5] text-white text-center whitespace-pre">
              확인
            </p>
          </button>
        </div>
      </div>
    </div>
  );
}

