/* 로딩 애니메이션 */
.fade-out {
    animation: fadeOut 1.5s ease-in-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* 글자 통통 튀는 애니메이션 */
.bounce-letter {
    display: inline-block;
    animation: bounceLetter 1.5s ease-in-out infinite;
}

.bounce-letter:nth-child(1) { animation-delay: 0s; }
.bounce-letter:nth-child(2) { animation-delay: 0.1s; }
.bounce-letter:nth-child(3) { animation-delay: 0.2s; }
.bounce-letter:nth-child(4) { animation-delay: 0.3s; }
.bounce-letter:nth-child(5) { animation-delay: 0.4s; }

@keyframes bounceLetter {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.slide-in {
    animation: slideIn 0.8s ease-out forwards;
}

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

/* 서명 캔버스 스타일 */
#signature-canvas {
    border-radius: 8px;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 모달 애니메이션 */
.modal-enter {
    animation: modalEnter 0.3s ease-out forwards;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 페이지 전환 애니메이션 */
.page-transition {
    transition: transform 0.5s ease-in-out;
}

/* 반응형 디자인 */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    #signature-canvas {
        height: 12rem;
    }
}

/* 서약서 내용 컨테이너 스타일 */
#nda-container {
    /* PC 기본 스타일 */
    max-height: 200px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: relative;
}

/* 모바일 스타일 */
@media (max-width: 768px) {
    #nda-container {
        max-height: 60vh !important; /* 화면 높이의 60% */
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
}

/* 스크롤바 스타일링 */
#nda-container::-webkit-scrollbar {
    width: 6px;
}

#nda-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#nda-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#nda-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 서약서 내용 스타일 */
#nda-content {
    position: relative;
}

#nda-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
    list-style-type: decimal;
    list-style-position: outside;
}

#nda-content li {
    margin: 0.5rem 0;
    line-height: 1.6;
    display: list-item;
}

#nda-content span {
    display: inline;
}

#nda-content ol ol {
    margin: 0.5rem 0;
    padding-left: 1rem;
    list-style-type: decimal;
}

#nda-content ol ol li {
    margin: 0.3rem 0;
}

/* 문서 형태 스타일 */
.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 페이지 컨테이너 스타일 */
.page-container {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .page-container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        position: relative;
    }
    
    .max-w-4xl {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .bg-white.shadow-lg.rounded-lg.p-6 {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .text-center.mb-8.border-b.border-gray-200.pb-6 {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .text-sm.text-gray-700.leading-relaxed.mb-8 {
        margin-bottom: 1.5rem;
    }
    
    .border-t.border-gray-200.pt-6 {
        padding-top: 1rem;
    }
    
    .flex.justify-between.items-end {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .text-right.text-sm.text-gray-500 {
        text-align: left;
        margin-top: 0.5rem;
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    .hover\:bg-blue-700:hover {
        background-color: rgb(29 78 216);
    }
    
    .hover\:bg-gray-600:hover {
        background-color: rgb(75 85 99);
    }
    
    .hover\:bg-gray-700:hover {
        background-color: rgb(55 65 81);
    }
}

/* 줌인 방지 및 모바일 최적화 */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

input, textarea, [contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 모바일에서 가로 스크롤 방지 */
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* 메인 컨텐츠 영역 */
#main-content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* 서약서 페이지 모바일 최적화 */
@media (max-width: 640px) {
    .page-container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .page-container .container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 1rem;
        padding-right: 1rem;
        box-sizing: border-box;
    }
    
    /* Tailwind max-w-md 클래스 오버라이드 */
    .max-w-md {
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        box-sizing: border-box;
    }
    
    /* mx-auto 클래스 오버라이드 */
    .mx-auto {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .bg-white.shadow-lg.rounded-lg.p-4 {
        padding: 0.75rem;
        margin-bottom: 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .text-xl {
        font-size: 1.125rem;
    }
    
    .text-sm {
        font-size: 0.8rem;
    }
    
    .leading-relaxed {
        line-height: 1.4;
    }
    
    /* 페이지 전환 시 레이아웃 유지 */
    #page-1,
    #page-2 {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
        position: relative;
    }
    
    /* 페이지 전환 애니메이션 시 레이아웃 유지 */
    #page-1[style*="transform"],
    #page-2[style*="transform"] {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* 메인 컨텐츠 영역 모바일 최적화 */
    #main-content {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        position: relative;
        box-sizing: border-box;
    }
}

/* 모바일 전용 클래스 */
.mobile-full-width {
    width: 100% !important;
    max-width: 100% !important;
}

/* 모바일 기기에서만 적용되는 스타일 (터치 디바이스) */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
    .page-container .container,
    .page-container .container.mobile-full-width {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .max-w-md,
    .max-w-md.mobile-full-width {
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .mx-auto {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* 추가 모바일 대응 (더 넓은 범위) */
@media screen and (max-width: 768px) {
    .mobile-full-width {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .page-container .container.mobile-full-width {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
