/*==================================================
  PEULGO 모바일 크리티컬 최적화 CSS
  모든 모바일 기기에서 완벽하게 작동
==================================================*/

/* 모바일 우선 설계 */
@media screen and (max-width: 992px) {
    
    /* ===== 헤더 완전 재설계 ===== */
    .header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 60px !important;
        background-color: #ffffff !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
        z-index: 9999 !important;
        padding: 0 !important;
    }
    
    .header .container {
        height: 60px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 15px !important;
    }
    
    .navbar {
        height: 100% !important;
        width: 100% !important;
    }
    
    .navbar-brand {
        z-index: 10000 !important;
    }
    
    .navbar-brand img {
        height: 30px !important;
        width: auto !important;
    }
    
    /* 햄버거 메뉴 개선 */
    .hamburger {
        display: block !important;
        width: 50px !important;
        height: 50px !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .hamburger .line {
        width: 28px !important;
        height: 3px !important;
        background-color: #333 !important;
        margin: 4px 0 !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
    }
    
    /* 모바일 메뉴 완전 재설계 */
    .mobile-menu {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 85% !important;
        max-width: 320px !important;
        height: 100vh !important;
        background-color: #ffffff !important;
        z-index: 10001 !important;
        transition: right 0.3s ease !important;
        box-shadow: -5px 0 20px rgba(0,0,0,0.2) !important;
    }
    
    .mobile-menu.active {
        right: 0 !important;
    }
    
    .mobile-menu-container {
        padding: 20px !important;
        height: 100% !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .mobile-menu-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding-bottom: 20px !important;
        border-bottom: 1px solid #eee !important;
        margin-bottom: 20px !important;
    }
    
    .close-menu {
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 28px !important;
        cursor: pointer !important;
    }
    
    /* 네비게이션 메뉴 */
    .mobile-menu .nav-menu {
        list-style: none !important;
        padding: 0 !important;
        margin: 0 0 20px 0 !important;
    }
    
    .mobile-menu .nav-item {
        margin: 0 !important;
        border-bottom: 1px solid #f0f0f0 !important;
    }
    
    .mobile-menu .nav-link {
        display: block !important;
        padding: 15px 10px !important;
        font-size: 16px !important;
        color: #333 !important;
        text-decoration: none !important;
        font-weight: 500 !important;
        min-height: 50px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .mobile-menu .nav-link:active,
    .mobile-menu .nav-link:hover {
        background-color: #f8f9fa !important;
        color: #4361ee !important;
    }
    
    /* 인증 버튼 */
    .mobile-menu .auth-buttons {
        padding-top: 20px !important;
        border-top: 1px solid #eee !important;
    }
    
    .mobile-menu .login-btn,
    .mobile-menu .signup-btn {
        display: block !important;
        width: 100% !important;
        padding: 12px !important;
        margin: 10px 0 !important;
        text-align: center !important;
        font-size: 16px !important;
        border-radius: 8px !important;
        min-height: 48px !important;
        font-weight: 600 !important;
    }
    
    /* ===== 컨텐츠 영역 조정 ===== */
    body {
        padding-top: 60px !important;
    }
    
    /* ===== Hero 섹션 모바일 최적화 ===== */
    .hero-section {
        height: calc(100vh - 60px) !important;
        min-height: 400px !important;
        max-height: 600px !important;
    }
    
    .hero-content {
        padding: 20px !important;
    }
    
    .hero-title {
        font-size: 28px !important;
        line-height: 1.3 !important;
        margin-bottom: 15px !important;
        font-weight: 700 !important;
    }
    
    .hero-text {
        font-size: 16px !important;
        line-height: 1.6 !important;
        margin-bottom: 20px !important;
    }
    
    .hero-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .hero-buttons .primary-btn,
    .hero-buttons .outline-btn,
    .hero-buttons .secondary-btn {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        min-height: 48px !important;
        border-radius: 8px !important;
    }
    
    /* ===== 섹션 패딩 조정 ===== */
    section {
        padding: 40px 0 !important;
    }
    
    .container {
        padding: 0 15px !important;
    }
    
    /* ===== 타이포그래피 모바일 최적화 ===== */
    h1 { font-size: 28px !important; }
    h2 { font-size: 24px !important; }
    h3 { font-size: 20px !important; }
    h4 { font-size: 18px !important; }
    h5 { font-size: 16px !important; }
    h6 { font-size: 14px !important; }
    
    p, li, td, span {
        font-size: 15px !important;
        line-height: 1.6 !important;
    }
    
    /* ===== 버튼 모바일 최적화 ===== */
    button, 
    .btn,
    .primary-btn,
    .secondary-btn,
    .outline-btn,
    a[class*="btn"] {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 12px 20px !important;
        font-size: 16px !important;
        border-radius: 8px !important;
        font-weight: 600 !important;
    }
    
    /* ===== 폼 요소 최적화 ===== */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important; /* iOS 줌 방지 */
        padding: 12px !important;
        min-height: 44px !important;
        border-radius: 8px !important;
        width: 100% !important;
    }
    
    /* ===== 카드/그리드 레이아웃 ===== */
    .categories-grid,
    .products-grid,
    .services-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .category-item,
    .product-card,
    .service-card {
        margin-bottom: 15px !important;
        border-radius: 12px !important;
    }
    
    /* ===== 이미지 최적화 ===== */
    img {
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
    }
    
    .hero-bg,
    .banner-image {
        height: 100% !important;
        object-fit: cover !important;
    }
    
    /* ===== 푸터 모바일 최적화 ===== */
    .footer {
        padding: 30px 0 20px !important;
    }
    
    .footer-top {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    
    .footer-links-container {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .footer-bottom {
        flex-direction: column !important;
        text-align: center !important;
        padding: 15px 0 !important;
    }
    
    /* ===== 스와이퍼 모바일 최적화 ===== */
    .swiper-button-next,
    .swiper-button-prev {
        display: none !important;
    }
    
    .swiper-pagination {
        bottom: 20px !important;
    }
    
    .swiper-pagination-bullet {
        width: 10px !important;
        height: 10px !important;
        margin: 0 4px !important;
    }
    
    /* ===== 모달/팝업 최적화 ===== */
    .modal-dialog {
        margin: 10px !important;
        max-width: calc(100% - 20px) !important;
    }
    
    .modal-content {
        border-radius: 12px !important;
    }
    
    /* ===== 테이블 모바일 최적화 ===== */
    table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* ===== 유틸리티 클래스 ===== */
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    /* ===== 성능 최적화 ===== */
    * {
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
    }
    
    /* 애니메이션 단순화 */
    *,
    *::before,
    *::after {
        animation-duration: 0.3s !important;
        transition-duration: 0.3s !important;
    }
    
    /* 스크롤 성능 */
    .scroll-container {
        -webkit-overflow-scrolling: touch !important;
        overflow-y: scroll !important;
    }
}

/* ===== 초소형 디바이스 (320px) ===== */
@media screen and (max-width: 375px) {
    .hero-title {
        font-size: 24px !important;
    }
    
    .container {
        padding: 0 10px !important;
    }
    
    .navbar-brand img {
        height: 28px !important;
    }
}

/* ===== 가로 모드 대응 ===== */
@media screen and (max-width: 992px) and (orientation: landscape) {
    .header {
        height: 50px !important;
    }
    
    .header .container {
        height: 50px !important;
    }
    
    body {
        padding-top: 50px !important;
    }
    
    .hero-section {
        height: calc(100vh - 50px) !important;
        max-height: 500px !important;
    }
    
    .hero-title {
        font-size: 24px !important;
    }
}

/* ===== 다크모드 대응 ===== */
@media (prefers-color-scheme: dark) {
    .header {
        background-color: #1a1a1a !important;
    }
    
    .mobile-menu {
        background-color: #1a1a1a !important;
    }
    
    .mobile-menu .nav-link {
        color: #ffffff !important;
    }
    
    .hamburger .line {
        background-color: #ffffff !important;
    }
}

/* ===== 터치 기기 전용 ===== */
@media (hover: none) and (pointer: coarse) {
    /* 호버 효과 제거 */
    a:hover,
    button:hover {
        opacity: 1 !important;
        transform: none !important;
    }
    
    /* 터치 피드백 */
    a:active,
    button:active {
        opacity: 0.8 !important;
        transform: scale(0.98) !important;
    }
}