/* ========================================
   모바일 최적화 CSS - 강제 적용 버전
   ======================================== */

/* 기본 설정 - 모든 요소에 적용 */
* {
    word-break: keep-all !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    word-break: keep-all !important;
    line-height: 1.6 !important;
}

/* ========================================
   모바일 전용 스타일 (768px 이하)
   ======================================== */
@media (max-width: 768px) {
    
    /* 기본 폰트 크기 */
    html {
        font-size: 14px !important;
    }
    
    body {
        font-size: 14px !important;
        line-height: 1.7 !important;
    }
    
    /* 데스크탑 메뉴 완전히 숨기기 */
    header nav.hidden {
        display: none !important;
    }
    
    /* 모바일 메뉴 개선 */
    #mobileMenu {
        max-width: 100% !important;
    }
    
    #mobileMenu a {
        font-size: 1.1rem !important;
        min-height: 56px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    #mobileMenu i {
        font-size: 1.25rem !important;
        min-width: 28px !important;
    }
    
    /* 제목 크기 강제 조정 */
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
        line-height: 1.4 !important;
        margin-bottom: 0.875rem !important;
    }
    
    h3 {
        font-size: 1.125rem !important;
        line-height: 1.4 !important;
        margin-bottom: 0.75rem !important;
    }
    
    h4 {
        font-size: 1rem !important;
        line-height: 1.4 !important;
    }
    
    h5, h6 {
        font-size: 0.95rem !important;
        line-height: 1.4 !important;
    }
    
    /* 본문 텍스트 */
    p {
        font-size: 0.95rem !important;
        line-height: 1.7 !important;
        margin-bottom: 0.875rem !important;
    }
    
    /* 리스트 */
    li {
        font-size: 0.95rem !important;
        line-height: 1.7 !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Tailwind 텍스트 크기 오버라이드 */
    .text-xs {
        font-size: 0.7rem !important;
    }
    
    .text-sm {
        font-size: 0.825rem !important;
    }
    
    .text-base {
        font-size: 0.95rem !important;
    }
    
    .text-lg {
        font-size: 1rem !important;
    }
    
    .text-xl {
        font-size: 1.125rem !important;
    }
    
    .text-2xl {
        font-size: 1.25rem !important;
    }
    
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    .text-4xl {
        font-size: 1.75rem !important;
    }
    
    .text-5xl {
        font-size: 2rem !important;
    }
    
    /* 버튼 */
    button, .btn, a.btn {
        font-size: 0.95rem !important;
        padding: 0.75rem 1.25rem !important;
        line-height: 1.4 !important;
        min-height: 44px !important;
    }
    
    /* 입력 필드 - iOS 줌 방지 */
    input, 
    select, 
    textarea {
        font-size: 16px !important;
        line-height: 1.5 !important;
        padding: 0.75rem !important;
    }
    
    /* 라벨 */
    label {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* 카드 패딩 */
    .card-shadow,
    .bg-white.rounded-2xl,
    .bg-white.rounded-xl,
    .bg-white.rounded-lg {
        padding: 1.25rem !important;
    }
    
    /* 컨테이너 패딩 */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .px-8, .px-12 {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }
    
    .py-8, .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .py-16 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    /* 테이블 */
    table {
        font-size: 0.825rem !important;
    }
    
    th {
        font-size: 0.875rem !important;
        padding: 0.625rem !important;
    }
    
    td {
        font-size: 0.825rem !important;
        padding: 0.625rem !important;
    }
    
    /* Footer */
    footer {
        font-size: 0.825rem !important;
        line-height: 1.6 !important;
        padding: 1.5rem 1rem !important;
    }
    
    footer p {
        font-size: 0.825rem !important;
    }
    
    /* 알림/경고 메시지 */
    .alert,
    .notice,
    .bg-red-50,
    .bg-yellow-50,
    .bg-blue-50,
    .bg-green-50 {
        font-size: 0.875rem !important;
        line-height: 1.6 !important;
        padding: 1rem !important;
    }
    
    /* 아이콘 크기 */
    .text-6xl {
        font-size: 3rem !important;
    }
    
    .text-5xl {
        font-size: 2.5rem !important;
    }
    
    .text-4xl {
        font-size: 2rem !important;
    }
    
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    .text-2xl {
        font-size: 1.25rem !important;
    }
    
    /* 그리드 간격 */
    .gap-4 {
        gap: 0.75rem !important;
    }
    
    .gap-6 {
        gap: 1rem !important;
    }
    
    /* 마진 조정 */
    .mb-8 {
        margin-bottom: 1.5rem !important;
    }
    
    .mb-12 {
        margin-bottom: 2rem !important;
    }
    
    .mt-8 {
        margin-top: 1.5rem !important;
    }
    
    .mt-12 {
        margin-top: 2rem !important;
    }
    
    /* 특정 컴포넌트 */
    .checkbox-wrapper,
    .radio-wrapper {
        padding: 0.75rem !important;
    }
    
    .checkbox-wrapper div,
    .radio-wrapper div {
        font-size: 0.95rem !important;
    }
    
    /* 라디오 버튼 & 체크박스 터치 영역 확대 */
    input[type="radio"] + div,
    input[type="checkbox"] + div,
    .border-2.border-gray-300.rounded-lg {
        min-height: 72px !important;
        padding: 1.25rem !important;
        font-size: 1rem !important;
    }
    
    /* 서비스 선택 카드 */
    label[class*="relative"] {
        margin-bottom: 1rem !important;
    }
    
    label[class*="relative"] input[type="radio"] + div,
    label[class*="relative"] input[type="checkbox"] + div {
        padding: 1.5rem 1.25rem !important;
    }
    
    /* 아이콘 크기 */
    label[class*="relative"] i.fa-house-user,
    label[class*="relative"] i.fa-building,
    label[class*="relative"] i.fa-hospital {
        font-size: 2rem !important;
    }
    
    /* ========================================
       디자인2 전용 모바일 최적화
       ======================================== */
    
    /* 헤더 - 해바라기 & 브랜드명 */
    header .wiggle {
        font-size: 2.5rem !important;
    }
    
    header .text-2xl {
        font-size: 1.25rem !important;
    }
    
    header .text-xs {
        font-size: 0.7rem !important;
    }
    
    /* 헤더 간격 조정 */
    header .py-3 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    header .space-x-3 {
        gap: 0.5rem !important;
    }
    
    /* Hero 섹션 최적화 */
    section.relative.overflow-hidden {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* 환영 배지 */
    .inline-flex.items-center.bg-white.rounded-full {
        padding: 0.5rem 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .inline-flex.items-center.bg-white.rounded-full .text-2xl {
        font-size: 1.5rem !important;
    }
    
    .inline-flex.items-center.bg-white.rounded-full .text-sm {
        font-size: 0.8rem !important;
    }
    
    /* Hero 제목 */
    section h2.text-3xl.md\\:text-5xl {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
    }
    
    section h2 span.text-orange-600 {
        display: inline !important;
    }
    
    /* Hero 본문 */
    section p.text-lg.md\\:text-xl {
        font-size: 1rem !important;
        line-height: 1.6 !important;
        margin-bottom: 1rem !important;
    }
    
    section p.text-base.md\\:text-lg {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* 별점 & 통계 - 세로 배치 */
    .flex.flex-col.md\\:flex-row {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    /* 별점 크기 */
    .text-yellow-500 {
        font-size: 1.1rem !important;
    }
    
    /* 상담하기 버튼 (헤더) */
    header button.bg-gradient-to-r {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
    }
    
    /* 모바일 메뉴 버튼 */
    #mobileMenuBtn {
        padding: 0.5rem !important;
        font-size: 1.25rem !important;
    }
    
    /* 플로팅 상담 버튼 - 모바일 최적화 */
    #floatingConsultBtn {
        bottom: 1rem !important;
        right: 1rem !important;
    }
    
    #floatingConsultBtn button {
        box-shadow: 0 8px 24px rgba(251, 191, 36, 0.4) !important;
    }
    
    #floatingConsultBtn button:hover {
        box-shadow: 0 12px 32px rgba(251, 191, 36, 0.6) !important;
    }
    
    /* 계산기 카드 패딩 조정 */
    .bg-white.rounded-2xl.card-shadow {
        padding: 1.5rem !important;
    }
    
    /* 폼 요소 간격 */
    form .mb-8 {
        margin-bottom: 1.5rem !important;
    }
    
    /* 라벨 폰트 크기 */
    label.block.text-lg {
        font-size: 1rem !important;
    }
    
    /* 버튼 크기 */
    button[type="submit"],
    button.bg-gradient-to-r {
        padding: 1rem 2rem !important;
        font-size: 1rem !important;
    }
    
    /* Step Indicator */
    .mb-8 > .flex.items-center.justify-between {
        margin-bottom: 0.5rem !important;
    }
    
    /* 소제목 & 설명 텍스트 */
    .text-sm.text-gray-600 {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
    }
    
    .text-xs {
        font-size: 0.75rem !important;
    }
}


/* ========================================
   초소형 화면 (360px 이하)
   ======================================== */
@media (max-width: 360px) {
    html {
        font-size: 13px !important;
    }
    
    h1 {
        font-size: 1.3rem !important;
    }
    
    h2 {
        font-size: 1.15rem !important;
    }
    
    h3 {
        font-size: 1rem !important;
    }
    
    .text-3xl {
        font-size: 1.3rem !important;
    }
    
    .text-4xl {
        font-size: 1.5rem !important;
    }
    
    .text-5xl {
        font-size: 1.75rem !important;
    }
    
    .card-shadow,
    .bg-white.rounded-2xl,
    .bg-white.rounded-xl {
        padding: 1rem !important;
    }
    
    .px-8, .px-12 {
        padding-left: 0.875rem !important;
        padding-right: 0.875rem !important;
    }
}

/* ========================================
   큰 화면 (480px 이상)
   ======================================== */
@media (min-width: 480px) and (max-width: 768px) {
    html {
        font-size: 15px !important;
    }
    
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
}

/* ========================================
   가로 모드 최적화
   ======================================== */
@media (orientation: landscape) and (max-height: 500px) {
    h1 {
        font-size: 1.25rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    h2 {
        font-size: 1.125rem !important;
    }
    
    .py-8, .py-12, .py-16 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* ========================================
   유틸리티 클래스
   ======================================== */
.mobile-break {
    display: none;
}

@media (max-width: 768px) {
    .mobile-break {
        display: inline;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* ========================================
   텍스트 정렬 및 줄바꿈
   ======================================== */
.text-balance {
    text-wrap: balance;
}

.text-pretty {
    text-wrap: pretty;
}

/* 강제 줄바꿈 방지 */
.no-wrap {
    white-space: nowrap !important;
}

/* 말줄임표 */
.truncate {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.line-clamp-1 {
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.line-clamp-2 {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.line-clamp-3 {
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* ========================================
   터치 최적화
   ======================================== */
@media (max-width: 768px) {
    /* 터치 영역 확대 */
    a, button, input, select {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* 터치 피드백 */
    a:active, button:active {
        opacity: 0.7;
    }
    
    /* 스크롤 부드럽게 */
    html {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}
