/* Projects Page Mobile Styles */

/* CSS 변수 정의 */
:root {
    --bg-darker: #0d0d0d;
    --bg-dark: #1a1a1a;
    --bg-black: #000000;
    --border-gray: #333333;
    --text-gray: #cccccc;
    --text-light: #999999;
    --text-white: #ffffff;
    --primary-red: #ff3333;
    --primary-dark: #cc0000;
}

/* 가로 스크롤 방지 - 전역 설정 */
html, body {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

@media (max-width: 768px) {
    /* 모든 섹션에 overflow 제한 */
    * {
        max-width: 100vw !important;
    }

    section {
        overflow-x: hidden !important;
    }

    .container {
        padding: 0 !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Hero 섹션 모바일 조정 */
    .page-hero {
        height: 400px !important;
        margin-top: 60px !important;
        overflow-x: hidden !important;
    }

    .page-hero h1 {
        font-size: 2.5rem !important;
        margin-bottom: 1rem !important;
        line-height: 1.2 !important;
    }

    .page-hero p {
        font-size: 1rem !important;
        padding: 0 1rem !important;
    }

    /* 프로젝트 탭 모바일 - 숨기기 */
    .project-tabs {
        display: none !important;
    }

    /* PC 필터 버튼들 모바일에서 숨기기 */
    .filter-buttons {
        display: none !important;
    }

    /* 모바일 필터 드롭다운 */
    .mobile-project-filter {
        display: block !important;
        width: calc(100% - 30px) !important;
        max-width: 100% !important;
        margin: 0 15px 30px 15px !important;
        padding: 15px 20px;
        background: var(--bg-darker);
        border: 1px solid var(--border-gray);
        color: #ffffff;
        font-size: 1.1rem;
        font-weight: 500;
        border-radius: 8px;
        cursor: pointer;
        appearance: none;
        background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2714%27%20height%3D%278%27%20viewBox%3D%270%200%2014%208%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpolyline%20points%3D%271%201%207%207%2013%201%27%20stroke%3D%27%23ff3333%27%20stroke-width%3D%272%27%20fill%3D%27none%27%20fill-rule%3D%27evenodd%27/%3E%3C/svg%3E');
        background-repeat: no-repeat;
        background-position: right 20px center;
        padding-right: 50px;
        box-sizing: border-box !important;
    }

    .mobile-project-filter:focus {
        outline: none;
        border-color: var(--primary-red);
        box-shadow: 0 0 0 2px rgba(255, 51, 51, 0.2);
    }

    .mobile-project-filter option {
        background: var(--bg-darker);
        color: #ffffff;
        padding: 10px;
    }

    /* 프로젝트 그리드 모바일 */
    .projects-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 15px !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* 프로젝트 카드 모바일 최적화 */
    .project-card {
        margin-bottom: 0 !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
        max-width: 100% !important;
    }

    .project-image {
        height: 200px !important;
        position: relative !important;
        overflow: hidden !important;
    }

    .project-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* 프로젝트 태그 모바일 */
    .project-tag {
        top: 15px !important;
        left: 15px !important;
        padding: 6px 16px !important;
        font-size: 0.85rem !important;
        border-radius: 20px !important;
    }

    /* 프로젝트 컨텐츠 모바일 */
    .project-content {
        padding: 20px !important;
    }

    .project-content h3 {
        font-size: 1.3rem !important;
        margin-bottom: 8px !important;
        line-height: 1.3 !important;
    }

    .project-content p {
        font-size: 0.95rem !important;
        margin-bottom: 12px !important;
        line-height: 1.5 !important;
    }

    .project-info {
        font-size: 0.85rem !important;
        color: var(--text-light) !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    .project-info span {
        display: inline-block !important;
    }

    /* 프로젝트 CTA 모바일 */
    .projects-cta {
        margin-top: 40px !important;
        padding: 0 15px !important;
    }

    .projects-cta .btn-more {
        width: 100% !important;
        padding: 15px 30px !important;
        font-size: 1rem !important;
        justify-content: center !important;
    }

    /* 연도별 섹션 모바일 */
    .year-section {
        margin-bottom: 50px !important;
    }

    .year-title {
        font-size: 2rem !important;
        margin-bottom: 20px !important;
        padding-bottom: 15px !important;
        text-align: center !important;
        color: var(--primary-red) !important;
        border-bottom: 2px solid var(--border-gray) !important;
    }

    /* 프로젝트 리스트 모바일 */
    .project-list {
        padding: 0 !important;
    }

    .project-item {
        background: var(--bg-darker) !important;
        border: 1px solid var(--border-gray) !important;
        border-radius: 10px !important;
        padding: 20px !important;
        margin-bottom: 15px !important;
        transition: all 0.3s ease !important;
    }

    .project-item:hover {
        background: var(--bg-dark) !important;
        border-color: var(--primary-red) !important;
        transform: translateY(-2px) !important;
    }

    .project-item-header {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        margin-bottom: 15px !important;
    }

    .project-date {
        color: var(--primary-red) !important;
        font-size: 0.9rem !important;
        font-weight: 600 !important;
    }

    .project-name {
        color: var(--text-white) !important;
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        line-height: 1.3 !important;
    }

    .project-details {
        display: grid !important;
        gap: 8px !important;
    }

    .project-detail-item {
        display: flex !important;
        align-items: flex-start !important;
        gap: 10px !important;
        font-size: 0.9rem !important;
        color: var(--text-gray) !important;
    }

    .project-detail-item strong {
        color: var(--text-light) !important;
        min-width: 80px !important;
        flex-shrink: 0 !important;
    }

    /* 스태틱스 섹션 모바일 */
    .stats-container,
    .projects-stats {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 20px 15px !important;
        margin: 0 15px !important;
        max-width: calc(100% - 30px) !important;
        box-sizing: border-box !important;
    }

    .stat-item {
        background: var(--bg-darker) !important;
        border: 1px solid var(--border-gray) !important;
        padding: 30px !important;
        text-align: center !important;
        border-radius: 12px !important;
    }

    .stat-number {
        font-size: 2.5rem !important;
        margin-bottom: 10px !important;
    }

    .stat-label {
        font-size: 1rem !important;
    }

    /* 검색 박스 모바일 */
    .search-box {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 0 15px !important;
        margin-bottom: 30px !important;
        max-width: 100% !important;
    }

    .search-input {
        width: 100% !important;
        max-width: 100% !important;
        padding: 14px 20px !important;
        font-size: 1rem !important;
        box-sizing: border-box !important;
    }

    .search-btn {
        width: 100% !important;
        padding: 14px 30px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
    }

    /* 테이블 컨테이너 모바일 - 가로 스크롤 제거 */
    .projects-table-container {
        overflow-x: hidden !important;
        margin: 0 15px !important;
        max-width: calc(100vw - 30px) !important;
        border-radius: 8px !important;
    }

    /* 테이블 모바일 반응형 - 카드 형태로 변경 */
    .projects-table {
        display: block !important;
        width: 100% !important;
    }

    .projects-table thead {
        display: none !important;
    }

    .projects-table tbody {
        display: block !important;
    }

    .projects-table tr {
        display: block !important;
        margin-bottom: 15px !important;
        background: var(--bg-darker) !important;
        border: 1px solid var(--border-gray) !important;
        border-radius: 8px !important;
        padding: 15px !important;
    }

    .projects-table td {
        display: block !important;
        padding: 8px 0 !important;
        border: none !important;
        position: relative !important;
        padding-left: 35% !important;
    }

    .projects-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 30%;
        padding-left: 10px;
        font-weight: 600;
        color: var(--text-light);
    }

    /* 각 td에 라벨 추가 */
    .projects-table td:nth-child(1)::before { content: "공사명"; }
    .projects-table td:nth-child(2)::before { content: "공법"; }
    .projects-table td:nth-child(3)::before { content: "납품처"; }
    .projects-table td:nth-child(4)::before { content: "납품일"; }
    .projects-table td:nth-child(5)::before { content: "비고"; }

    /* 프로젝트 년도 스타일 수정 - 왼쪽 정렬 */
    .projects-table .project-year {
        text-align: left !important;
        font-weight: 600 !important;
    }

    .projects-table .project-name {
        font-weight: 700 !important;
        color: #ffffff !important;
    }

    .projects-table .project-method {
        color: var(--primary-red) !important;
    }

    /* CTA 섹션 모바일 */
    .cta-section {
        padding: 60px 0 !important;
        overflow-x: hidden !important;
    }

    .cta-content {
        padding: 0 15px !important;
    }

    .cta-content h2 {
        font-size: 1.8rem !important;
        margin-bottom: 15px !important;
        line-height: 1.3 !important;
    }

    .cta-content p {
        font-size: 1rem !important;
        margin-bottom: 25px !important;
    }

    .cta-buttons {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    .btn-white,
    .btn-outline {
        width: 100% !important;
        padding: 15px 30px !important;
        font-size: 1rem !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    /* 모달 스타일 모바일 */
    .modal-content {
        margin: 20px !important;
        padding: 30px 20px !important;
        max-height: calc(100vh - 40px) !important;
        overflow-y: auto !important;
        max-width: calc(100% - 40px) !important;
    }

    .modal-title {
        font-size: 1.5rem !important;
    }

    .modal-body {
        font-size: 0.9rem !important;
        max-height: none !important;
    }

    .modal-close {
        font-size: 24px !important;
        top: 10px !important;
        right: 10px !important;
        width: 35px !important;
        height: 35px !important;
    }

    /* 이미지 갤러리 모바일 */
    .project-gallery {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        margin-top: 20px !important;
    }

    .gallery-image {
        width: 100% !important;
        height: 200px !important;
        object-fit: cover !important;
        border-radius: 8px !important;
        cursor: pointer !important;
    }

    /* 로딩 애니메이션 모바일 */
    .loading-spinner {
        width: 40px !important;
        height: 40px !important;
    }

    /* 섹션 패딩 조정 */
    section {
        padding: 60px 0 !important;
    }

    /* 기존 푸터 숨기기 */
    footer:not(.mobile-footer),
    .footer {
        display: none !important;
    }
    
    /* 모바일 푸터만 표시 */
    .mobile-footer {
        display: block !important;
    }

    /* 스크롤 성능 최적화 */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* 애니메이션 비활성화 (성능) */
    .project-card,
    .project-item {
        animation: none !important;
    }

    /* 터치 영역 최적화 */
    button,
    a,
    .project-card {
        min-height: 44px;
        touch-action: manipulation;
    }
}

/* PC에서 모바일 드롭다운 숨기기 */
@media (min-width: 769px) {
    .mobile-project-filter {
        display: none !important;
    }
}

/* 작은 모바일 기기 (480px 이하) */
@media (max-width: 480px) {
    .page-hero h1 {
        font-size: 2rem !important;
    }

    .mobile-project-filter {
        padding: 12px 16px !important;
        font-size: 0.95rem !important;
    }

    .project-content h3 {
        font-size: 1.2rem !important;
    }

    .stat-number {
        font-size: 2rem !important;
    }

    .cta-content h2 {
        font-size: 1.5rem !important;
    }

    .year-title {
        font-size: 1.8rem !important;
    }
}

/* 태블릿 대응 (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 25px !important;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .project-tabs {
        justify-content: center !important;
    }
}

/* 가로 모드 대응 */
@media (max-width: 768px) and (orientation: landscape) {
    .page-hero {
        height: 300px !important;
    }

    .project-image {
        height: 150px !important;
    }
}

/* iOS Safari 대응 */
@supports (-webkit-touch-callout: none) {
    .project-tabs {
        -webkit-overflow-scrolling: touch;
    }

    .modal-body {
        -webkit-overflow-scrolling: touch;
    }
}

/* 다크모드 대응 */
@media (prefers-color-scheme: dark) {
    .project-card {
        background: var(--bg-darker) !important;
    }

    .project-item {
        background: var(--bg-darker) !important;
    }
}
