/* TarantulaDB Mobile Styles - 완전히 재작성 */

/* 모바일 전용 요소 표시 */
@media (max-width: 768px) {
    .edition-mobile-cards {
        display: block !important;
    }

    .solution-mobile-cards {
        display: block !important;
    }

    .hexagon-container {
        display: none !important;
    }

    .edition-table-custom {
        display: none !important;
    }
}

/* Hero Section Mobile */
@media (max-width: 768px) {
    .product-hero {
        min-height: 500px;
        height: auto;
        padding: 80px 0 60px;
    }

    .product-hero-content {
        padding: 0 1rem;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 8px 16px;
        margin-bottom: 1.5rem;
        letter-spacing: 0.08em;
        white-space: normal; /* 변경: 텍스트 줄바꿈 허용 */
        line-height: 1.4;
        max-width: 95%;
        display: inline-block;
        overflow: hidden; /* 애니메이션 영역 제한 */
        position: relative; /* 애니메이션 컨테이너 */
    }

    .hero-title {
        font-size: 2rem; /* 축소: 2.5rem → 2rem */
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 0.9rem; /* 축소: 1rem → 0.9rem */
        line-height: 1.5;
        margin-bottom: 2rem;
        padding: 0 10px;
    }

    .hero-subtitle br {
        display: none;
    }

    /* 버튼 크기 축소 및 정렬 개선 */
    .hero-cta {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
        padding: 0 10px;
    }

    /* Hero 버튼 공통 스타일 */
    .hero-btn {
        width: 100% !important;
        max-width: 280px !important; /* inference-server와 동일하게 280px로 증가 */
        padding: 1rem 2rem !important; /* 패딩도 증가 */
        font-size: 1rem !important; /* 폰트 크기 증가 */
        white-space: nowrap !important;
        text-align: center !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        min-width: auto !important; /* min-width 제거 */
    }

    /* Hero Primary 버튼 - 파란색으로 강제 변경 */
    .hero-btn-primary {
        background: #336791 !important; /* PostgreSQL 블루 */
        color: white !important;
        border: none !important;
        box-shadow: 0 5px 15px rgba(51, 103, 145, 0.3) !important;
    }
    
    .hero-btn-primary::before {
        display: none !important; /* 애니메이션 제거 */
    }
    
    .hero-btn-primary:hover {
        background: #265278 !important;
        transform: none !important; /* 호버 효과 제거 */
        box-shadow: 0 5px 15px rgba(51, 103, 145, 0.3) !important;
    }
    
    .hero-btn-primary:active {
        background: #1e3d5a !important;
    }
    
    /* 보조 버튼 색상 개선 */
    .hero-btn-secondary {
        background: rgba(255, 255, 255, 0.1) !important; /* 배경색 조금 더 진하게 */
        border: 2px solid rgba(255, 255, 255, 0.3) !important; /* 테두리 2px로 */
        color: white !important;
        padding: 1rem 2rem !important; /* primary와 동일한 패딩 */
    }
    
    .hero-btn-secondary:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.6) !important;
        transform: none !important;
    }
}

/* Section Headers Mobile */
@media (max-width: 768px) {
    .section-header {
        margin-bottom: 40px;
    }

    .section-badge {
        font-size: 0.7rem; /* 축소: 0.75rem → 0.7rem */
        margin-bottom: 0.75rem;
        padding: 5px 10px;
        background: rgba(51, 103, 145, 0.1);
        border-radius: 20px;
        display: inline-block;
        white-space: normal; /* 변경: 텍스트 줄바꿈 허용 */
        line-height: 1.3;
    }

    .section-title {
        font-size: 1.5rem; /* 축소: 1.75rem → 1.5rem */
        margin-bottom: 1rem;
        word-break: keep-all;
        line-height: 1.3;
    }

    .section-desc {
        font-size: 0.875rem; /* 축소: 0.95rem → 0.875rem */
        line-height: 1.6;
        word-break: keep-all;
    }

    .section-desc br {
        display: none;
    }
}

/* Overview Section Mobile */
@media (max-width: 768px) {
    .overview-section {
        padding: 60px 0;
    }

    .overview-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .overview-text h3 {
        font-size: 1.25rem; /* 축소: 1.5rem → 1.25rem */
        margin-bottom: 15px;
        text-align: center;
    }

    .overview-text p {
        font-size: 0.875rem; /* 축소: 0.95rem → 0.875rem */
        line-height: 1.6;
        margin-bottom: 20px;
        text-align: center;
    }

    .overview-features li {
        padding: 15px;
        margin-bottom: 15px;
        gap: 12px;
    }

    .overview-features li div:last-child {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
        line-height: 1.5;
        word-break: keep-all;
    }

    .feature-icon {
        width: 24px;
        height: 24px;
        font-size: 0.875rem;
    }

    .overview-visual {
        padding: 30px 20px;
    }

    .postgresql-badge img {
        width: 120px;
        margin-bottom: 20px;
    }

    .badge-info {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
        padding: 8px 16px;
        white-space: normal; /* 변경: 텍스트 줄바꿈 허용 */
    }
}

/* Why Section Mobile */
@media (max-width: 768px) {
    .why-section {
        padding: 60px 0;
    }

    .why-intro {
        padding: 30px 20px;
        margin-bottom: 30px;
    }

    .why-intro h3 {
        font-size: 1.125rem; /* 축소: 1.25rem → 1.125rem */
        margin-bottom: 15px;
    }

    .why-intro p {
        font-size: 0.875rem; /* 축소: 0.95rem → 0.875rem */
        line-height: 1.6;
    }

    .why-intro p br {
        display: none;
    }

    .why-grid {
        display: grid !important;
        grid-template-columns: 1fr !important; /* 1개씩 세로 배치 */
        gap: 20px !important;
        margin-top: 30px;
    }

    .why-card {
        padding: 25px 20px; /* 패딩 원복 */
        text-align: center;
        margin-bottom: 0;
    }

    .why-card h4 {
        font-size: 1rem; /* 폰트 크기 원복 */
        margin-bottom: 15px;
        gap: 10px;
        justify-content: center;
        line-height: 1.3;
        display: block;
    }

    .why-card ul {
        text-align: left;
        display: inline-block;
        max-width: 100%; /* 90% → 100% */
        padding: 0 5px; /* 내부 패딩 추가 */
    }

    .why-card ul li {
        font-size: 0.8rem; /* 폰트 크기 원복 */
        line-height: 1.5;
        margin-bottom: 12px;
        word-break: keep-all;
        text-align: left;
        padding-left: 20px;
    }
    
    .why-card ul li::before {
        left: 5px; /* 불릿 위치 조정 */
        font-size: 1rem; /* 불릿 크기 축소 */
    }
}

/* Architecture Section Mobile - 카드 레이아웃 */
@media (max-width: 768px) {
    .architecture-section {
        padding: 60px 0;
    }

    .edition-visual {
        padding: 0;
        background: transparent;
        border: none;
    }

    /* Edition Cards Container */
    .edition-cards-container {
        display: flex;
        flex-direction: column;
        gap: 20px;
        margin-top: 40px;
    }

    .edition-card {
        background: white;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    .edition-card-header {
        background: #f8f9fa;
        padding: 20px;
        text-align: center;
        border-bottom: 2px solid #e9ecef;
    }

    .edition-card-header h3 {
        font-size: 1.125rem; /* 축소: 1.25rem → 1.125rem */
        font-weight: 700;
        color: #333;
        margin: 0;
    }

    .edition-card-body {
        padding: 20px;
    }

    .edition-components {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 20px;
        justify-content: center;
    }

    .edition-features {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    /* Component Box Mobile */
    .edition-mobile-cards .component-box {
        padding: 8px 12px; /* 축소: 10px 15px → 8px 12px */
        font-size: 0.75rem; /* 축소: 0.8rem → 0.75rem */
        border-radius: 8px;
        margin: 0;
        white-space: normal; /* 변경: 텍스트 줄바꿈 허용 */
        line-height: 1.3;
    }

    /* Feature Label Mobile */
    .edition-mobile-cards .feature-label {
        padding: 6px 12px; /* 축소: 8px 16px → 6px 12px */
        font-size: 0.75rem; /* 축소: 0.8rem → 0.75rem */
        border-radius: 8px;
        margin: 0;
        white-space: normal; /* 변경: 텍스트 줄바꿈 허용 */
    }

    /* PostgreSQL Base Card */
    .postgres-card {
        background: #f8f9fa;
        border-radius: 16px;
        padding: 30px 20px;
        text-align: center;
        margin-top: 20px;
    }

    .postgres-card h4 {
        font-size: 1rem; /* 축소: 1.125rem → 1rem */
        font-weight: 700;
        color: #333;
        margin-bottom: 10px;
    }

    .postgres-card p {
        font-size: 0.8rem; /* 축소: 0.9rem → 0.8rem */
        color: #666;
        margin: 0;
    }
}

/* Components Section Mobile */
@media (max-width: 768px) {
    .components-section {
        padding: 60px 0;
    }

    .components-section .overview-content {
        display: block;
    }

    .components-section .overview-text {
        margin-bottom: 30px;
    }

    .components-section h3 {
        text-align: center;
        font-size: 1.125rem; /* 축소: 1.25rem → 1.125rem */
        margin-bottom: 20px;
        color: #333;
    }

    .component-list-detail {
        padding: 0 10px;
    }

    .component-list-detail li {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
        line-height: 1.5;
        margin-bottom: 15px;
        padding: 15px;
        background: #f8f9fa;
        border-radius: 8px;
        text-align: center;
        padding-left: 15px;
    }

    .component-list-detail li::before {
        display: none;
    }

    .component-list-detail li strong {
        display: block;
        color: #336791;
        font-size: 0.875rem; /* 축소: 0.95rem → 0.875rem */
        margin-bottom: 5px;
        font-weight: 700;
    }
}

/* Features Section Mobile */
@media (max-width: 768px) {
    .features-section {
        padding: 60px 0;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 40px;
    }

    .feature-item {
        padding: 20px;
        background: #f8f9fa;
        border-radius: 12px;
    }

    .feature-item h4 {
        font-size: 0.9rem; /* 축소: 1rem → 0.9rem */
        margin-bottom: 10px;
        color: #336791;
    }

    .feature-item p {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
        line-height: 1.5;
        text-align: left;
    }
}

/* Solution Section Mobile - 카드 레이아웃 */
@media (max-width: 768px) {
    .solution-section {
        padding: 60px 0;
    }

    .solution-section .section-desc br {
        display: none;
    }

    /* 통합 플랫폼 카드 */
    .solution-card {
        background: white;
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
        margin-top: 40px;
    }

    .solution-card-header {
        background: linear-gradient(135deg, #336791, #265278);
        color: white;
        text-align: center;
        padding: 40px 20px;
    }

    .solution-card-header img {
        width: 80px;
        filter: brightness(0) invert(1);
        margin-bottom: 20px;
    }

    .solution-card-header h3 {
        font-size: 1.5rem; /* 축소: 1.75rem → 1.5rem */
        margin: 0;
        font-weight: 700;
    }

    .solution-card-body {
        padding: 20px;
    }

    .solution-items-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .solution-item-card {
        background: #f8f9fa;
        border-radius: 12px;
        padding: 20px;
        text-align: center;
        transition: all 0.3s ease;
        border: 1px solid #e9ecef;
    }

    .solution-item-card:hover {
        background: #e9f0f8;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    .solution-item-card h4 {
        font-size: 0.9rem; /* 축소: 1rem → 0.9rem */
        font-weight: 700;
        color: #336791;
        margin-bottom: 8px;
    }

    .solution-item-card p {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
        color: #666;
        line-height: 1.4;
        margin: 0;
        word-break: keep-all;
    }
}

/* CTA Section Mobile */
@media (max-width: 768px) {
    .product-cta {
        padding: 60px 0;
    }

    .cta-content {
        padding: 0 1rem;
    }

    .cta-title {
        font-size: 1.25rem; /* 축소: 1.5rem → 1.25rem */
        margin-bottom: 15px;
        line-height: 1.4;
        word-break: keep-all;
    }

    .cta-title br {
        display: none;
    }

    .cta-desc {
        font-size: 0.875rem; /* 축소: 0.95rem → 0.875rem */
        margin-bottom: 30px;
        line-height: 1.5;
    }

    .cta-desc br {
        display: none;
    }

    /* CTA 버튼 크기 축소 및 정렬 개선 */
    .cta-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
        padding: 0 10px;
    }

    /* CTA 버튼 공통 스타일 */
    .cta-btn {
        width: 100% !important;
        max-width: 300px !important; /* inference-server와 동일하게 300px */
        padding: 15px 40px !important;
        font-size: 0.95rem !important; /* 폰트 크기 약간 증가 */
        white-space: nowrap !important;
        text-align: center !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        min-width: auto !important;
    }

    /* CTA Primary 버튼 색상 */
    .cta-btn-primary {
        background: #336791 !important;
        color: white !important;
        box-shadow: 0 5px 15px rgba(51, 103, 145, 0.3) !important;
        border: none !important;
    }
    
    .cta-btn-primary:hover {
        background: #265278 !important;
        transform: none !important;
    }
    
    .cta-btn-primary:active {
        background: #1e3d5a !important;
    }

    .cta-btn-secondary {
        background: rgba(255, 255, 255, 0.05) !important;
        border: 2px solid rgba(255, 255, 255, 0.5) !important; /* 2px로 통일 */
        color: white !important;
        padding: 15px 40px !important; /* primary와 동일한 패딩 */
    }
    
    .cta-btn-secondary:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.7) !important;
        transform: none !important;
    }
}

/* 390px 이하 추가 최적화 */
@media (max-width: 390px) {
    /* Container padding 조정 */
    .container,
    .section-container {
        padding: 0 15px;
    }

    .product-hero-content {
        padding: 0 0.75rem;
    }

    .hero-badge {
        font-size: 0.65rem;
        padding: 5px 12px;
        letter-spacing: 0.03em;
    }

    .hero-title {
        font-size: 1.75rem; /* 축소: 2rem → 1.75rem */
    }

    .hero-subtitle {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
    }

    .hero-btn {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
        padding: 0.75rem 1.25rem; /* 축소 */
    }

    /* 버튼 세로 배치 */
    .hero-cta,
    .cta-buttons {
        flex-direction: column;
    }

    .section-title {
        font-size: 1.25rem; /* 축소: 1.5rem → 1.25rem */
    }

    .section-desc {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
    }

    .overview-text h3 {
        font-size: 1.125rem; /* 축소: 1.25rem → 1.125rem */
    }

    .why-card h4 {
        font-size: 0.9rem; /* 축소: 1rem → 0.9rem */
    }

    /* Edition Cards 추가 조정 */
    .edition-card-header h3 {
        font-size: 1rem; /* 축소: 1.125rem → 1rem */
    }

    .edition-mobile-cards .component-box {
        font-size: 0.65rem; /* 축소: 0.7rem → 0.65rem */
        padding: 6px 10px; /* 축소 */
    }

    .edition-mobile-cards .feature-label {
        font-size: 0.65rem; /* 축소: 0.7rem → 0.65rem */
        padding: 5px 10px; /* 축소 */
    }

    /* Solution Cards 추가 조정 */
    .solution-card-header {
        padding: 30px 15px;
    }

    .solution-card-header img {
        width: 60px;
    }

    .solution-card-header h3 {
        font-size: 1.25rem; /* 축소: 1.5rem → 1.25rem */
    }

    .solution-item-card {
        padding: 15px;
    }

    .solution-item-card h4 {
        font-size: 0.85rem; /* 축소: 0.9rem → 0.85rem */
    }

    .solution-item-card p {
        font-size: 0.75rem; /* 축소: 0.8rem → 0.75rem */
    }

    .cta-title {
        font-size: 1.125rem; /* 축소: 1.25rem → 1.125rem */
    }

    .cta-desc {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
    }

    .cta-btn {
        font-size: 0.8rem; /* 축소: 0.875rem → 0.8rem */
        padding: 0.75rem 1.5rem; /* 축소 */
    }

    /* Floating buttons smaller */
    .floating-buttons {
        bottom: 15px;
        right: 15px;
        gap: 8px;
    }

    .floating-btn {
        width: 40px;
        height: 40px;
    }

    .floating-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* 텍스트 줄바꿈 최적화 */
@media (max-width: 768px) {
    /* 한글 텍스트 줄바꿈 */
    body {
        word-break: keep-all;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* 모든 텍스트 요소에 적용 */
    p, li, span, h1, h2, h3, h4, h5, h6 {
        word-break: keep-all;
        line-break: strict;
    }

    /* 컴포넌트 박스와 레이블은 줄바꿈 허용 */
    .component-box,
    .feature-label,
    .badge-info {
        white-space: normal;
        word-break: keep-all;
    }
}

/* 버튼 호버 효과 모바일에서 제거 */
@media (max-width: 768px) {
    .hero-btn:hover,
    .cta-btn:hover {
        transform: none;
        box-shadow: none;
    }

    .overview-features li:hover,
    .why-card:hover,
    .solution-item-card:hover {
        transform: none;
    }
}

/* 모바일 터치 친화적 요소 */
@media (max-width: 768px) {
    /* 터치 영역 확대 */
    .hero-btn,
    .cta-btn {
        min-height: 44px;
    }

    /* 링크 간격 확보 */
    a {
        display: inline-block;
        min-height: 40px;
        line-height: normal;
    }

    /* 카드 터치 영역 */
    .edition-card,
    .solution-item-card,
    .why-card {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
}

/* 가로 스크롤 방지 */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    main {
        overflow-x: hidden;
    }

    .section-container {
        overflow-x: hidden;
    }
}

/* Desktop only elements 숨김 처리 추가 */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}
