/* ========================================
   CSS Variables
   ======================================== */
:root {
    /* Colors */
    --color-bg: #0D0F12;
    --color-surface: #1A1D24;
    --color-surface-hover: #242830;
    --color-primary: #3B82F6;
    --color-primary-hover: #2563EB;
    --color-primary-active: #1D4ED8;
    --color-secondary: #6B7280;
    --color-secondary-hover: #4B5563;
    --color-text: #F9FAFB;
    --color-text-secondary: #D1D5DB;
    --color-text-muted: #9CA3AF;
    --color-success: #10B981;
    --color-error: #EF4444;
    --color-border: #374151;
    
    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
    
    /* Typography */
    --font-family: 'HakgyoansimBareonbatangB', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 14px;
    --font-size-sm: 16px;
    --font-size-md: 30px;
    --font-size-lg: 28px;
    --font-size-xl: 36px;
    --font-size-2xl: 48px;
    --font-size-3xl: 64px;
    
    /* Layout */
    --kiosk-width: 1920px;
    --kiosk-height: 1080px;
    --safe-area: 24px;
    --border-radius: 20px;
    --border-radius-sm: 12px;
    
    /* Animation */
    --transition-fast: 150ms;
    --transition-normal: 200ms;
    --transition-slow: 300ms;
    --transition-shake: 400ms;
}

/* ========================================
   Reset & Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: auto; /* 스크롤 허용 */
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--color-bg);
    color: var(--color-text);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* 모바일에서만 주소창 숨기기 */
@media (max-width: 1024px) {
    html,
    body {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
}

/* ========================================
   16:9 Scaling Container
   ======================================== */
.kiosk-wrapper {
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    position: relative;  /* PC는 relative */
    overflow: visible; /* 스크롤 허용 */
    padding: 40px; /* 더 많은 여백 추가 */
    box-sizing: border-box;
}

/* 모바일에서만 fixed 적용 */
@media (max-width: 1024px) {
    .kiosk-wrapper {
        position: fixed;
        top: 0;
        left: 0;
    }
}

/* 모바일 가로 모드에서 최적화 */
@media (orientation: landscape) and (max-width: 1024px) {
    .kiosk-wrapper {
        padding: 10px; /* 모바일에서는 여백 최소화 */
    }
}

.kiosk-container {
    width: var(--kiosk-width);
    height: var(--kiosk-height);
    position: relative;
    background-color: var(--color-bg);
    overflow: hidden;
    transform-origin: center center;
    transition: transform 0.3s ease-out; /* 부드러운 스케일 전환 */
    will-change: transform; /* GPU 가속 최적화 */
}

/* ========================================
   Page Layout
   ======================================== */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transform: translateY(100%);
    
    /* 배경 이미지 공통 설정 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 페이지 전환 애니메이션 준비 */
.page.transitioning {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   페이지별 배경 이미지
   ======================================== */

/* Step 0: Welcome - Blue Theme */
.page[data-step="0"] {
    /* 더미 이미지 (개발용) - 주석 처리 */
    /* background-image: 
        linear-gradient(135deg, rgba(13, 15, 18, 0.7) 0%, rgba(30, 58, 138, 0.7) 50%, rgba(13, 15, 18, 0.7) 100%),
        url('./resources/step0-bg.svg'); */
    
    /* 실제 이미지 사용 (PNG) */
    background-image: 
        url('./resources/step0-bg.png');
}

/* Step 1: Selection - Green Theme */
.page[data-step="1"] {
    /* 더미 이미지 (개발용) - 주석 처리 */
    /* background-image: url('./resources/step1-bg.svg'); */
    
    /* 실제 이미지 사용 (PNG) */
    background-image: url('./resources/step1-bg.png');
}

/* Step 2: Input - Orange Theme */
.page[data-step="2"] {
    /* 더미 이미지 (개발용) - 주석 처리 */
    /* background-image: url('./resources/step2-bg.svg'); */
    
    /* 실제 이미지 사용 (PNG) */
    background-image: url('./resources/step2-bg.png');
}

/* Step 3: Input - Purple Theme */
.page[data-step="3"] {
    /* 더미 이미지 (개발용) - 주석 처리 */
    /* background-image: url('./resources/step3-bg.svg'); */
    
    /* 실제 이미지 사용 (PNG) */
    background-image: url('./resources/step3-bg.png');
}

/* Step 4: Complete - Final Theme */
.page[data-step="4"] {
    /* 실제 이미지 사용 (PNG) */
    background-image: url('./resources/step4-bg.png');
}

.page-content {
    width: 100%;
    height: 100%;
    padding: var(--spacing-3xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2xl);
    overflow: visible; /* 버튼이 컨테이너 밖으로 나가도 보이고 클릭 가능하게 */
}

/* Step 3: 입력 폼 페이지 - 위치 조절 가능하도록 */
.page[data-step="3"] .page-content {
    justify-content: flex-start;  /* 중앙 정렬 해제 */
    padding-top: var(--spacing-3xl);  /* 기본 위쪽 여백 */
}

.page-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.page-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
}

.page-desc {
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
}

/* ========================================
   Step 0: Welcome - Button Only
   ======================================== */

/* 이미지 버튼 스타일 */
.btn-image {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform var(--transition-fast) ease, opacity var(--transition-fast) ease;
    outline: none;
    position: relative;
    display: inline-block;
    /* 플로팅 애니메이션 적용 */
    animation: floating 3s ease-in-out infinite;
    /* 위치 조정: transform으로 시각적 위치와 클릭 영역을 함께 이동 */
    transform: translateY(220%);  /* 아래로 220% 이동 */
}

.btn-image:hover {
    transform: translateY(220%) scale(1.05);
    animation-play-state: paused; /* 호버 시 애니메이션 일시정지 */
}

.btn-image:active {
    transform: translateY(220%) scale(0.98);
    animation-play-state: paused;
}

.btn-image:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 8px;
    border-radius: 8px;
}

.btn-start-image {
    /* 배경 1920x1080 대비 적절한 크기 설정 */
    width: 400px;
    height: auto;
    display: block;
    pointer-events: none;
}

.btn-submit-image {
    /* 제출 버튼 이미지 크기 */
    width: 300px;
    height: auto;
    display: block;
    pointer-events: none;
}

/* Step 1, 2 다음 버튼 스타일 */
.btn-next {
    position: absolute;
    left: 50%;
    top: 80%;  /* 화면 하단 80% 위치 */
    transform: translate(-50%, -50%);
    animation: floatingNext 3s ease-in-out infinite;  /* 플로팅 애니메이션 */
}

.btn-next:hover {
    animation-play-state: paused;  /* 호버 시 애니메이션 일시정지 */
}

.btn-next-image {
    /* 다음 버튼 이미지 크기 */
    width: 270px;  /* 300px의 90% = 270px */
    height: auto;
    display: block;
    pointer-events: none;
}

/* Step 3 제출 버튼은 플로팅 애니메이션 없이 정상 위치에 표시 */
#btn-step3-submit {
    animation: none;
    transform: none;
}

#btn-step3-submit:hover {
    transform: scale(1.05);
}

#btn-step3-submit:active {
    transform: scale(0.98);
}

/* ========================================
   Step 1: (Inline styles in HTML)
   ======================================== */

/* ========================================
   Step 2: Form
   ======================================== */
.input-form {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    
    /* 📍 위치 조절: 아래 값들을 변경하세요 */
    margin-top: 300px;      /* 위쪽 여백 (양수: 아래로, 음수: 위로) */
    margin-bottom: 0px;   /* 아래쪽 여백 */
    margin-left: auto;    /* 가로 중앙 정렬 (auto 유지) */
    margin-right: auto;   /* 가로 중앙 정렬 (auto 유지) */
    
    /* 🎯 오른쪽으로 10% 이동 */
    transform: translateX(10%);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* 두 번째 입력 그룹(요청사항)을 아래로 이동 */
.form-group:last-child {
    margin-top: 3%;  /* 아래로 5% 이동 */
}

.form-label {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--color-text);
}

.form-label .required {
    color: var(--color-error);
}

.form-input {
    width: 100%;
    padding: var(--spacing-lg) var(--spacing-xl);
    font-size: var(--font-size-md);
    font-family: inherit;                  /* 기존 폰트 유지 (HakgyoansimBareonbatangB) */
    color: #000000;                        /* 📝 글씨 색상: 검정색만 변경 */
    background-color: transparent;         /* 🎨 배경 투명 */
    border: none;                          /* 🎨 테두리 제거 */
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast) ease;
    outline: none;
    caret-color: #000000;                  /* 🖱️ 커서(깜빡이는 선) 색상: 검정색 */
}

.form-input::placeholder {
    color: #555555;                        /* placeholder 글씨: 회색 */
}

.form-input:focus {
    background-color: transparent;         /* 🎨 포커스 시에도 투명 유지 */
    outline: none;                         /* 포커스 테두리 제거 */
}

.form-input:focus-visible {
    outline: none;                         /* 키보드 포커스 테두리도 제거 */
}

/* 에러 시에도 테두리 없음 (에러 메시지로만 표시) */

.form-textarea {
    min-height: 180px;
    resize: vertical;
    line-height: 1.6;
}

.field-error {
    font-size: var(--font-size-sm);
    color: var(--color-error);
    min-height: 22px;
}

.field-info {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-align: right;
    display: none;  /* 글자 수 카운터 숨기기 */
}

/* ========================================
   Step 3: Complete (Simplified - Button Only)
   ======================================== */
.complete-hero {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg) var(--spacing-2xl);
    min-height: 96px;
    font-size: var(--font-size-md);
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast) ease;
    user-select: none;
    outline: none;
    min-width: 240px;
}

.btn:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 4px;
}

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

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-primary:active {
    background-color: var(--color-primary-active);
}

.btn-primary:disabled {
    background-color: var(--color-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-surface-hover);
    border-color: var(--color-text-muted);
}

.btn-large {
    min-width: 400px;
    min-height: 104px;
    font-size: var(--font-size-lg);
}

/* ========================================
   Page Actions (Navigation Buttons)
   ======================================== */
.page-actions {
    display: flex;
    gap: var(--spacing-lg);
    margin-top: auto;
    padding-top: var(--spacing-2xl);
}

/* Step 3 완료하기 버튼을 위로 올리기 */
.page[data-step="3"] .page-actions {
    margin-top: 0;  /* auto 대신 0으로 */
    position: relative;
    top: -232px;  /* 위로 232px 이동 (3% 추가 = 약 32px) */
}

/* ========================================
   Error Message
   ======================================== */
.error-message {
    min-height: 28px;
    font-size: var(--font-size-sm);
    color: var(--color-error);
    text-align: center;
    font-weight: 500;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-8px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(8px);
    }
}

@keyframes floating {
    0%, 100% {
        transform: translateY(220%);
    }
    50% {
        transform: translateY(calc(220% - 15px));
    }
}

@keyframes floatingNext {
    0%, 100% {
        transform: translate(-50%, -50%);
    }
    50% {
        transform: translate(-50%, calc(-50% - 15px));
    }
}

.shake {
    animation: shake var(--transition-shake) ease;
}

/* ========================================
   Accessibility
   ======================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   Responsive Design
   ======================================== */

/* 매우 작은 화면 (모바일) */
@media (max-width: 480px) {
    .kiosk-container {
        /* 매우 작은 화면에서는 최소 스케일 유지 */
        min-width: 320px;
        min-height: 180px;
    }
}

/* 작은 화면 (태블릿) */
@media (max-width: 768px) {
    .page-content {
        padding: var(--spacing-xl);
    }
    
    .selection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .selection-card {
        min-height: 180px;
        padding: var(--spacing-lg);
    }
}

/* 세로 모드 (포트레이트) - 회전 안내 메시지 */
@media (orientation: portrait) {
    body::before {
        content: "📱 화면을 가로로 회전해주세요";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.95);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        font-weight: bold;
        z-index: 999999;
        text-align: center;
        padding: 20px;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    body {
        background: white;
    }
    
    .page:not(.active) {
        display: none;
    }
}

