/* 커스텀 스타일 및 반응형 개선 */

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* 카드 호버 효과 개선 */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
}

/* 그라데이션 텍스트 */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 테이블 반응형 개선 */
@media (max-width: 768px) {
    .responsive-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .responsive-table table {
        min-width: 600px;
    }
}

/* 폼 입력 포커스 효과 */
input:focus, 
select:focus, 
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 체크박스 스타일 개선 */
input[type="checkbox"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

/* 버튼 로딩 상태 */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    right: 12px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 배지 애니메이션 */
.badge-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* 차트 컨테이너 */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

@media (max-width: 768px) {
    .chart-container {
        height: 250px;
    }
}

/* 모달 오버레이 애니메이션 */
#modal {
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#modal > div {
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 프로그레스 바 애니메이션 */
.progress-bar {
    transition: width 1s ease-out;
}

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

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #1f2937;
    color: white;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 8px;
}

.tooltip:hover::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    z-index: 100;
}

/* 스켈레톤 로딩 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

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

/* 탭 전환 효과 */
.tab-content {
    animation: tabFadeIn 0.3s ease-out;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 프린트 스타일 */
@media print {
    header, footer, button {
        display: none !important;
    }
    
    .bg-gradient-to-r,
    .bg-gradient-to-br {
        background: white !important;
        color: black !important;
    }
}

/* 다크모드 준비 (향후 확장용) */
@media (prefers-color-scheme: dark) {
    /* 다크모드 스타일은 추후 적용 가능 */
}

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

/* 포커스 표시 (키보드 네비게이션) */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 링크 스타일 */
a {
    transition: color 0.2s ease;
}

/* 이미지 최적화 */
img {
    max-width: 100%;
    height: auto;
}

/* 반응형 유틸리티 */
@media (max-width: 640px) {
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-hide {
        display: none !important;
    }
}

/* 인쇄 최적화 */
@page {
    margin: 1cm;
}

/* 테이블 반응형 개선 (모바일) */
@media (max-width: 640px) {
    .responsive-table thead {
        display: none;
    }
    
    .responsive-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
    }
    
    .responsive-table td {
        display: flex;
        justify-content: space-between;
        padding: 0.75rem;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .responsive-table td:last-child {
        border-bottom: none;
    }
    
    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
    }
}
