/* 
=============================================================
    세창인스트루먼트 모바일 전용 CSS
    기존 색상 패턴 유지하며 모바일 최적화
    techinfo 제품검색 중심 설계
=============================================================
*/

/* ========================================
   세창 브랜드 색상 변수 (기존 유지)
======================================== */
:root {
    --sechang-primary: #5466CC;        /* 기존 링크 색상 */
    --sechang-hover-bg: #EAEAEA;       /* 기존 호버 배경 */
    --sechang-hover-text: blue;        /* 기존 호버 텍스트 */
    --sechang-border: #A7A6A5;         /* 기존 검색창 테두리 */
    --sechang-focus: #007bff;          /* 포커스 색상 */
    --sechang-white: white;
    --sechang-light-gray: #f8f9fa;
    --sechang-dark-gray: #666666;
    --sechang-success: #28a745;
    --sechang-warning: #ffc107;
    --sechang-danger: #dc3545;
}

/* ========================================
   모바일 기본 설정
======================================== */
@media only screen and (max-width: 768px) {
    * {
        box-sizing: border-box;
    }
    
    body {
        background-color: var(--sechang-white);
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", Arial, sans-serif;
        font-size: 14px;
        line-height: 1.4;
        margin: 0;
        padding: 0;
        -webkit-text-size-adjust: 100%;
    }
    
    /* 기존 데스크톱 요소 숨김 */
    #navigation, #topmenu, .desktop-only {
        display: none !important;
    }
    
    /* 메인 컨테이너 모바일 최적화 */
    #container, #wrap {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* ========================================
   모바일 헤더 (세창 브랜드 유지)
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-header {
        background: linear-gradient(135deg, var(--sechang-primary) 0%, #4a5bc4 100%);
        color: white;
        padding: 10px;
        position: sticky;
        top: 0;
        z-index: 1000;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .mobile-logo {
        text-align: center;
        padding: 8px 0;
    }
    
    .mobile-logo img {
        max-height: 35px;
        width: auto;
    }
    
    .mobile-logo h1 {
        color: white;
        font-size: 16px;
        margin: 5px 0 0 0;
        font-weight: normal;
    }
}

/* ========================================
   모바일 검색창 (techinfo 제품검색 중심)
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-search-container {
        background: var(--sechang-light-gray);
        padding: 15px;
        border-bottom: 1px solid #ddd;
    }
    
    .mobile-search-title {
        color: var(--sechang-primary);
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 12px;
        text-align: center;
    }
    
    .mobile-search-box {
        position: relative;
        margin-bottom: 10px;
    }
    
    .mobile-search-input {
        width: 100%;
        padding: 12px 45px 12px 15px;
        border: 2px solid var(--sechang-border);
        border-radius: 25px;
        font-size: 16px; /* iOS zoom 방지 */
        outline: none;
        background: white;
        transition: all 0.3s ease;
        -webkit-appearance: none;
    }
    
    .mobile-search-input:focus {
        border-color: var(--sechang-focus);
        box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
    }
    
    .mobile-search-btn {
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        background: var(--sechang-primary);
        color: white;
        border: none;
        border-radius: 20px;
        padding: 8px 12px;
        font-size: 14px;
        cursor: pointer;
        transition: background 0.3s ease;
    }
    
    .mobile-search-btn:hover {
        background: #4a5bc4;
    }
}

/* ========================================
   모바일 자동완성 (기존 스타일 유지)
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-autocomplete {
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        margin-top: 8px;
        max-height: 250px;
        overflow-y: auto;
        display: none;
    }
    
    .mobile-autocomplete-category {
        background: var(--sechang-light-gray);
        padding: 8px 12px;
        font-size: 12px;
        color: var(--sechang-dark-gray);
        border-bottom: 1px solid #eee;
        font-weight: bold;
    }
    
    .mobile-autocomplete-item {
        padding: 12px 15px;
        border-bottom: 1px solid #f5f5f5;
        font-size: 14px;
        color: #333;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-autocomplete-item:hover,
    .mobile-autocomplete-item.selected {
        background: var(--sechang-hover-bg);
        color: var(--sechang-hover-text);
    }
    
    .mobile-autocomplete-item.chatgpt-suggestion {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        font-weight: bold;
    }
    
    .mobile-autocomplete-item.part-found {
        background: #e8f5e8;
        border-left: 3px solid var(--sechang-success);
        font-weight: bold;
    }
}

/* ========================================
   모바일 제품 카드 (techinfo 스타일)
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-product-grid {
        padding: 10px;
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .mobile-product-card {
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
    }
    
    .mobile-product-card:hover {
        border-color: var(--sechang-primary);
        box-shadow: 0 4px 8px rgba(84, 102, 204, 0.15);
    }
    
    .mobile-product-title {
        color: var(--sechang-primary);
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 8px;
        line-height: 1.3;
    }
    
    .mobile-product-model {
        color: var(--sechang-dark-gray);
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .mobile-product-specs {
        background: var(--sechang-light-gray);
        padding: 8px;
        border-radius: 4px;
        font-size: 12px;
        color: #555;
        margin-bottom: 10px;
    }
    
    .mobile-product-actions {
        display: flex;
        gap: 8px;
        margin-top: 12px;
    }
    
    .mobile-btn {
        flex: 1;
        padding: 8px 12px;
        border: none;
        border-radius: 20px;
        font-size: 12px;
        cursor: pointer;
        transition: all 0.3s ease;
        text-decoration: none;
        text-align: center;
        display: block;
    }
    
    .mobile-btn-primary {
        background: var(--sechang-primary);
        color: white;
    }
    
    .mobile-btn-primary:hover {
        background: #4a5bc4;
    }
    
    .mobile-btn-secondary {
        background: white;
        color: var(--sechang-primary);
        border: 1px solid var(--sechang-primary);
    }
    
    .mobile-btn-secondary:hover {
        background: var(--sechang-hover-bg);
    }
}

/* ========================================
   모바일 네비게이션 (하단 고정)
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 2px solid var(--sechang-primary);
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        z-index: 1000;
        display: flex;
        padding: 8px 0;
    }
    
    .mobile-nav-item {
        flex: 1;
        text-align: center;
        padding: 8px 4px;
        color: var(--sechang-dark-gray);
        text-decoration: none;
        font-size: 11px;
        transition: all 0.3s ease;
    }
    
    .mobile-nav-item:hover,
    .mobile-nav-item.active {
        color: var(--sechang-primary);
        background: var(--sechang-hover-bg);
    }
    
    .mobile-nav-icon {
        font-size: 18px;
        display: block;
        margin-bottom: 2px;
    }
    
    /* 하단 네비게이션으로 인한 여백 */
    body {
        padding-bottom: 70px;
    }
}

/* ========================================
   모바일 검색 결과 (techinfo 스타일)
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-search-results {
        padding: 10px;
    }
    
    .mobile-search-header {
        background: var(--sechang-light-gray);
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 15px;
        border-left: 4px solid var(--sechang-primary);
    }
    
    .mobile-search-keyword {
        color: var(--sechang-primary);
        font-weight: bold;
        font-size: 16px;
    }
    
    .mobile-search-count {
        color: var(--sechang-dark-gray);
        font-size: 14px;
        margin-top: 4px;
    }
    
    .mobile-no-results {
        text-align: center;
        padding: 40px 20px;
        background: #fff3cd;
        border-radius: 8px;
        margin: 20px 10px;
        border: 1px solid var(--sechang-warning);
    }
    
    .mobile-no-results h3 {
        color: #856404;
        margin-bottom: 15px;
        font-size: 18px;
    }
    
    .mobile-suggestion-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 15px 0;
        justify-content: center;
    }
    
    .mobile-chip {
        background: var(--sechang-primary);
        color: white;
        padding: 6px 12px;
        border-radius: 15px;
        font-size: 12px;
        text-decoration: none;
        transition: all 0.3s ease;
    }
    
    .mobile-chip:hover {
        background: #4a5bc4;
        transform: translateY(-1px);
    }
}

/* ========================================
   모바일 ChatGPT 구조 시스템
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-chatgpt-rescue {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        padding: 20px;
        border-radius: 12px;
        margin: 15px 10px;
        text-align: center;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    .mobile-chatgpt-title {
        font-size: 18px;
        font-weight: bold;
        margin-bottom: 10px;
    }
    
    .mobile-chatgpt-subtitle {
        font-size: 14px;
        opacity: 0.9;
        margin-bottom: 15px;
    }
    
    .mobile-intent-options {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        margin: 15px 0;
    }
    
    .mobile-intent-btn {
        background: rgba(255, 255, 255, 0.2);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
        padding: 12px 15px;
        border-radius: 20px;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.3s ease;
        text-align: left;
    }
    
    .mobile-intent-btn:hover {
        background: rgba(255, 255, 255, 0.3);
        border-color: rgba(255, 255, 255, 0.5);
    }
    
    .mobile-contact-form {
        background: rgba(255, 255, 255, 0.15);
        padding: 15px;
        border-radius: 10px;
        margin-top: 20px;
    }
    
    .mobile-contact-input {
        width: 100%;
        padding: 10px 12px;
        border: none;
        border-radius: 20px;
        font-size: 14px;
        margin-bottom: 8px;
        background: white;
        color: #333;
    }
    
    .mobile-contact-btn {
        width: 100%;
        padding: 12px;
        background: var(--sechang-success);
        color: white;
        border: none;
        border-radius: 20px;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
        margin-top: 10px;
        transition: background 0.3s ease;
    }
    
    .mobile-contact-btn:hover {
        background: #218838;
    }
}

/* ========================================
   모바일 제품 리스트 (techinfo 스타일)
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-product-list {
        padding: 0 10px;
    }
    
    .mobile-product-item {
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        margin-bottom: 10px;
        padding: 12px;
        transition: all 0.3s ease;
    }
    
    .mobile-product-item:hover {
        border-color: var(--sechang-primary);
        box-shadow: 0 2px 8px rgba(84, 102, 204, 0.15);
    }
    
    .mobile-product-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 8px;
    }
    
    .mobile-product-name {
        color: var(--sechang-primary);
        font-weight: bold;
        font-size: 14px;
        flex: 1;
        line-height: 1.3;
    }
    
    .mobile-product-stock {
        background: var(--sechang-success);
        color: white;
        padding: 2px 6px;
        border-radius: 8px;
        font-size: 10px;
        margin-left: 8px;
    }
    
    .mobile-product-model {
        color: var(--sechang-dark-gray);
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .mobile-product-description {
        font-size: 12px;
        color: #555;
        line-height: 1.4;
        margin-bottom: 10px;
    }
    
    .mobile-product-price {
        color: var(--sechang-primary);
        font-weight: bold;
        font-size: 15px;
        margin-bottom: 8px;
    }
    
    .mobile-product-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

/* ========================================
   모바일 키워드 분할 표시
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-keyword-analysis {
        background: #fff3cd;
        border: 2px solid var(--sechang-warning);
        padding: 15px;
        border-radius: 10px;
        margin: 15px 10px;
    }
    
    .mobile-analysis-title {
        color: #856404;
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 10px;
        text-align: center;
    }
    
    .mobile-analysis-subtitle {
        color: #666;
        font-size: 13px;
        text-align: center;
        margin-bottom: 15px;
    }
    
    .mobile-keyword-parts {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        margin: 15px 0;
    }
    
    .mobile-keyword-part {
        background: #e3f2fd;
        color: #1976d2;
        padding: 8px 15px;
        border-radius: 20px;
        font-size: 13px;
        font-weight: bold;
        border: 2px solid #2196f3;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .mobile-keyword-part:hover {
        background: #1976d2;
        color: white;
        transform: scale(1.05);
    }
    
    .mobile-analysis-note {
        background: rgba(84, 102, 204, 0.1);
        padding: 10px;
        border-radius: 8px;
        font-size: 12px;
        color: var(--sechang-primary);
        text-align: center;
        margin-top: 15px;
    }
}

/* ========================================
   모바일 필터 및 정렬
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-filters {
        background: white;
        padding: 10px 15px;
        border-bottom: 1px solid #eee;
        position: sticky;
        top: 60px;
        z-index: 999;
    }
    
    .mobile-filter-row {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .mobile-filter-btn {
        background: var(--sechang-light-gray);
        color: var(--sechang-dark-gray);
        border: 1px solid #ddd;
        padding: 6px 12px;
        border-radius: 15px;
        font-size: 12px;
        white-space: nowrap;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .mobile-filter-btn.active {
        background: var(--sechang-primary);
        color: white;
        border-color: var(--sechang-primary);
    }
}

/* ========================================
   모바일 로딩 및 상태 표시
======================================== */
@media only screen and (max-width: 768px) {
    .mobile-loading {
        text-align: center;
        padding: 20px;
        color: var(--sechang-primary);
    }
    
    .mobile-loading-spinner {
        width: 20px;
        height: 20px;
        border: 2px solid #f3f3f3;
        border-top: 2px solid var(--sechang-primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        display: inline-block;
        margin-right: 8px;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    .mobile-error {
        background: #f8d7da;
        color: #721c24;
        padding: 15px;
        border-radius: 8px;
        margin: 15px 10px;
        text-align: center;
    }
    
    .mobile-success {
        background: #d4edda;
        color: #155724;
        padding: 15px;
        border-radius: 8px;
        margin: 15px 10px;
        text-align: center;
    }
}

/* ========================================
   모바일 터치 최적화
======================================== */
@media only screen and (max-width: 768px) {
    /* 터치 영역 최소 44px */
    .mobile-touch {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 스크롤 개선 */
    .mobile-scroll {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    /* 터치 피드백 */
    .mobile-touchable {
        -webkit-tap-highlight-color: rgba(84, 102, 204, 0.2);
    }
    
    /* iOS Safari 확대 방지 */
    .mobile-no-zoom {
        touch-action: manipulation;
    }
}

/* ========================================
   데스크톱에서는 모바일 CSS 비활성화
======================================== */
@media only screen and (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
    
    .mobile-header,
    .mobile-search-container,
    .mobile-bottom-nav {
        display: none !important;
    }
}