/* 관리자 페이지 모바일 전용 스타일 */
@media screen and (max-width: 768px) {
    /* 전체 페이지 오버플로우 방지 */
    body {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    /* 컨테이너 패딩 조정 */
    .admin-container {
        padding: 10px !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* 헤더 모바일 최적화 */
    .admin-header {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    .admin-header h1 {
        font-size: 24px !important;
    }
    
    .admin-header p {
        font-size: 12px !important;
    }
    
    /* 탭 버튼 모바일 최적화 - 2열 그리드 */
    .admin-tabs {
        padding: 8px !important;
        margin-bottom: 15px !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-auto-rows: minmax(40px, auto) !important;
        gap: 5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .admin-tabs .tab-button {
        padding: 8px 12px !important;
        font-size: 12px !important;
        text-align: center !important;
        box-sizing: border-box !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
        margin: 0 !important;
        flex: none !important;
        display: block !important;
    }
    
    /* 탭 콘텐츠 패딩 조정 */
    .tab-content {
        padding: 15px !important;
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* 업로드 섹션 모바일 최적화 */
    .upload-section {
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* 채널 선택 모바일 최적화 */
    .channel-selector {
        flex-wrap: wrap !important;
        gap: 5px !important;
    }
    
    .channel-option {
        padding: 8px 12px !important;
        font-size: 12px !important;
        flex: 1 !important;
        min-width: calc(33.33% - 4px) !important;
        text-align: center !important;
    }
    
    /* 업로드 영역 모바일 최적화 */
    .file-upload-area {
        padding: 20px !important;
    }
    
    .file-upload-area .upload-icon {
        font-size: 36px !important;
    }
    
    .file-upload-area p {
        font-size: 12px !important;
    }
    
    /* 그리드 컨트롤 모바일 최적화 */
    .grid-controls {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: stretch !important;
    }
    
    .search-box {
        max-width: 100% !important;
    }
    
    .search-box input {
        width: 100% !important;
        padding: 10px !important;
        font-size: 14px !important;
    }
    
    /* 테이블 모바일 반응형 */
    .data-table,
    table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        max-width: 100% !important;
    }
    
    /* 테이블 컨테이너 */
    div[style*="overflow-x: auto"] {
        max-width: 100% !important;
        overflow-x: auto !important;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px !important;
        font-size: 12px !important;
    }
    
    /* 테이블을 카드 형식으로 변환 */
    @media (max-width: 480px) {
        .data-table thead {
            display: none !important;
        }
        
        .data-table tbody {
            display: block !important;
        }
        
        .data-table tr {
            display: block !important;
            margin-bottom: 15px !important;
            background: #f8f8fc !important;
            border: 1px solid #ddd !important;
            border-radius: 8px !important;
            padding: 10px !important;
        }
        
        .data-table td {
            display: block !important;
            text-align: left !important;
            padding: 5px 10px !important;
            white-space: normal !important;
        }
        
        /* CSS로 라벨 추가 - 접속 로그 테이블 */
        #accessLogsTable td:nth-child(1):before { content: "접속시간: "; font-weight: bold; }
        #accessLogsTable td:nth-child(2):before { content: "채널: "; font-weight: bold; }
        #accessLogsTable td:nth-child(3):before { content: "아이디: "; font-weight: bold; }
        #accessLogsTable td:nth-child(4):before { content: "이름: "; font-weight: bold; }
        #accessLogsTable td:nth-child(5):before { content: "직급: "; font-weight: bold; }
        #accessLogsTable td:nth-child(6):before { content: "팀: "; font-weight: bold; }
        #accessLogsTable td:nth-child(7):before { content: "회사: "; font-weight: bold; }
        #accessLogsTable td:nth-child(8):before { content: "지점: "; font-weight: bold; }
        #accessLogsTable td:nth-child(9):before { content: "페이지: "; font-weight: bold; }
        #accessLogsTable td:nth-child(10):before { content: "IP: "; font-weight: bold; }
        
        /* CSS로 라벨 추가 - 제품 선택 로그 테이블 */
        #productLogsTable td:nth-child(1):before { content: "선택시간: "; font-weight: bold; }
        #productLogsTable td:nth-child(2):before { content: "채널: "; font-weight: bold; }
        #productLogsTable td:nth-child(3):before { content: "회사: "; font-weight: bold; }
        #productLogsTable td:nth-child(4):before { content: "지점: "; font-weight: bold; }
        #productLogsTable td:nth-child(5):before { content: "사용자: "; font-weight: bold; }
        #productLogsTable td:nth-child(6):before { content: "제품모델: "; font-weight: bold; }
        #productLogsTable td:nth-child(7):before { content: "카테고리: "; font-weight: bold; }
        #productLogsTable td:nth-child(8):before { content: "계약기간: "; font-weight: bold; }
        #productLogsTable td:nth-child(9):before { content: "월구독료: "; font-weight: bold; }
        #productLogsTable td:nth-child(10):before { content: "제휴카드: "; font-weight: bold; }
        #productLogsTable td:nth-child(11):before { content: "관리: "; font-weight: bold; }
    }
    
    /* 버튼 모바일 최적화 */
    .btn-save,
    .btn-delete,
    .btn-add,
    .btn-action {
        padding: 8px 16px !important;
        font-size: 12px !important;
        width: 100% !important;
    }
    
    .benefit-actions {
        flex-direction: column !important;
        gap: 5px !important;
    }
    
    /* 입력 필드 모바일 최적화 */
    .benefit-item-editor input,
    .benefit-item-editor textarea,
    select {
        font-size: 14px !important;
        padding: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* 모든 input과 textarea 요소 */
    input[type="text"],
    input[type="number"],
    input[type="url"],
    input[type="email"],
    textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .benefit-item-editor textarea {
        min-height: 80px !important;
    }
    
    /* 이미지 미리보기 모바일 최적화 */
    .image-preview {
        max-width: 150px !important;
    }
    
    /* 통계 카드 모바일 최적화 */
    .stat-cards {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    
    .stat-card {
        padding: 15px !important;
    }
    
    .stat-card h4 {
        font-size: 12px !important;
    }
    
    .stat-card .stat-value {
        font-size: 20px !important;
    }
    
    /* 모달 모바일 최적화 */
    .modal-content {
        width: 95% !important;
        margin: 2.5% auto !important;
        padding: 15px !important;
    }
    
    .modal-header {
        padding: 10px !important;
    }
    
    .modal-header h2 {
        font-size: 16px !important;
    }
    
    .modal-body {
        padding: 15px !important;
    }
    
    /* 공지사항 편집기 모바일 최적화 */
    .notice-editor {
        padding: 15px !important;
    }
    
    .notice-editor input,
    .notice-editor textarea {
        font-size: 14px !important;
    }
    
    /* 카드 혜택 편집 모바일 최적화 */
    .card-benefit-editor {
        padding: 15px !important;
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* 혜택 편집기 모바일 최적화 */
    .benefits-editor {
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* 혜택 아이템 편집기 */
    .benefit-item-editor {
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    .form-group {
        margin-bottom: 15px !important;
    }
    
    .form-group label {
        font-size: 12px !important;
        margin-bottom: 5px !important;
        display: block !important;
    }
    
    /* 파일 선택 버튼 모바일 최적화 */
    input[type="file"] {
        font-size: 12px !important;
    }
    
    /* 스크롤바 스타일 */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }
    
    /* 홈으로 버튼 */
    .home-button {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
        z-index: 1000 !important;
    }
    
    /* 페이지네이션 모바일 최적화 */
    .pagination {
        display: flex !important;
        gap: 5px !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
    
    .pagination button {
        padding: 6px 10px !important;
        font-size: 12px !important;
        min-width: 30px !important;
    }
    
    /* 드롭다운 메뉴 모바일 최적화 */
    select {
        width: 100% !important;
        padding: 8px !important;
        font-size: 14px !important;
    }
    
    /* 알림 메시지 모바일 최적화 */
    .alert {
        padding: 10px !important;
        font-size: 12px !important;
        margin-bottom: 10px !important;
    }
    
    /* 로딩 스피너 */
    .loading-spinner {
        width: 30px !important;
        height: 30px !important;
    }
    
    /* 빈 상태 메시지 */
    .empty-state {
        padding: 30px 15px !important;
    }
    
    .empty-state h3 {
        font-size: 16px !important;
    }
    
    .empty-state p {
        font-size: 12px !important;
    }
    
    /* 모든 div 요소 오버플로우 방지 */
    div {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* 모든 섹션 요소들 */
    section, article, aside, nav {
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
}

/* 아주 작은 화면 (480px 이하) 추가 최적화 */
@media screen and (max-width: 480px) {
    .admin-tabs {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 5px !important;
    }
    
    .tab-button {
        min-width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        width: 100% !important;
    }
    
    .channel-option {
        min-width: 100% !important;
    }
    
    .stat-cards {
        grid-template-columns: 1fr !important;
    }
    
    .admin-header h1 {
        font-size: 20px !important;
    }
}