/* Sales 관리 최적화를 위한 CSS */

/* 인라인 에디터 스타일 */
.editable-field {
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 4px;
}

.editable-field:hover {
    background-color: #f3f4f6 !important;
    cursor: pointer;
}

.inline-edit-input,
.inline-edit-textarea {
    width: 100%;
    padding: 4px 8px;
    border: 2px solid #3b82f6;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: white;
}

.inline-edit-textarea {
    resize: vertical;
    min-height: 60px;
}

.inline-edit-buttons {
    margin-top: 4px;
    display: flex;
    gap: 4px;
}

/* 로딩 상태 */
.loading-spinner {
    display: inline-block;
}

.table-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* 테이블 행 호버 효과 개선 */
.table-row {
    transition: background-color 0.2s ease;
}

.table-row:hover {
    background-color: #f8fafc;
}

/* 우선순위 표시 개선 */
.priority-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.priority-urgent {
    background-color: #dc2626;
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.5);
    animation: pulse 2s infinite;
}

.priority-high {
    background-color: #ea580c;
}

.priority-medium {
    background-color: #ca8a04;
}

.priority-low {
    background-color: #6b7280;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* 상태 배지 개선 */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

/* 빠른 액션 버튼 */
.quick-action-btn {
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.quick-action-btn.primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.quick-action-btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* 알림 스타일 개선 */
.custom-alert {
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* 새로고침 버튼 */
.refresh-btn {
    position: relative;
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 검색 필터 스타일 */
.sales-filter {
    transition: border-color 0.2s ease;
}

.sales-filter:focus {
    border-color: #3b82f6;
    ring: 2px;
    ring-color: rgba(59, 130, 246, 0.1);
}

/* 모바일 반응형 개선 */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-row {
        font-size: 14px;
    }
    
    .inline-edit-buttons {
        flex-direction: column;
    }
    
    .custom-alert {
        left: 16px;
        right: 16px;
        top: 16px;
        transform: translateY(-100%);
        max-width: none;
    }
    
    .custom-alert.show {
        transform: translateY(0);
    }
}

/* 페이지네이션 개선 */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.pagination-container nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.pagination-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.pagination-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 데이터 로딩 상태 */
.data-loading .table-row {
    opacity: 0.6;
    pointer-events: none;
}

.skeleton-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 컨텍스트 메뉴 (우클릭 메뉴) */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 4px 0;
    z-index: 1000;
    min-width: 160px;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: background-color 0.2s ease;
}

.context-menu-item:hover {
    background-color: #f3f4f6;
}

.context-menu-item.danger {
    color: #dc2626;
}

.context-menu-item.danger:hover {
    background-color: #fef2f2;
}

.context-menu-separator {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

/* 툴팁 */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* 드래그 앤 드롭 */
.draggable {
    cursor: move;
}

.dragging {
    opacity: 0.5;
}

.drop-zone {
    border: 2px dashed #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

/* 접근성 개선 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 포커스 표시 개선 */
.focus-visible:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    .table-row:hover {
        background-color: #1f2937;
    }
    
    .editable-field:hover {
        background-color: #374151 !important;
    }
    
    .inline-edit-input,
    .inline-edit-textarea {
        background: #1f2937;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .context-menu {
        background: #1f2937;
        border-color: #4b5563;
    }
    
    .context-menu-item {
        color: #f9fafb;
    }
    
    .context-menu-item:hover {
        background-color: #374151;
    }
}