/* 커스텀 스타일 */

/* 도서 카드 스타일 */
.book-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.book-cover {
    aspect-ratio: 3/4;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.book-card:hover .book-cover {
    transform: scale(1.05);
}

/* 카테고리 버튼 활성 상태 */
.category-btn.active {
    background-color: #3B82F6;
    color: white;
    border-color: #3B82F6;
}

.category-btn.active:hover {
    background-color: #2563EB;
}

/* 신청 버튼 스타일 */
.apply-btn {
    transition: all 0.2s ease;
    color: white;
    font-weight: 600;
}

.apply-btn:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.apply-btn.owned {
    background-color: #DC2626;
    color: white;
    border: 2px solid #DC2626;
}

.apply-btn.owned:hover {
    background-color: #B91C1C;
    border-color: #B91C1C;
}

.apply-btn.applied {
    background-color: #3B82F6;
    color: white;
}

.apply-btn.applied:hover {
    background-color: #2563EB;
}

.apply-btn.budget-exceeded {
    background-color: #F59E0B;
    color: white;
}

.apply-btn.budget-exceeded:hover {
    background-color: #D97706;
}

.apply-btn.available {
    background-color: #10B981;
    color: white;
}

.apply-btn.available:hover {
    background-color: #059669;
}

/* 로딩 애니메이션 */
.loading-spinner {
    animation: spin 1s linear infinite;
}

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

/* 토스트 애니메이션 */
.toast-enter {
    animation: slideInRight 0.3s ease-out;
}

.toast-exit {
    animation: slideOutRight 0.3s ease-in;
}

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

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

/* 모달 애니메이션 */
.modal-enter {
    animation: fadeIn 0.3s ease-out;
}

.modal-exit {
    animation: fadeOut 0.3s ease-in;
}

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

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

/* 반응형 디자인 */
@media (max-width: 768px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .sidebar {
        display: none;
    }
    
    .mobile-filter-toggle {
        display: block;
    }
}

@media (max-width: 480px) {
    .book-grid {
        grid-template-columns: repeat(1, 1fr);
    }
    
    .class-info-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

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

/* 포커스 스타일 개선 */
.focus-ring:focus {
    outline: none;
    ring: 2px;
    ring-color: #3B82F6;
    ring-offset: 2px;
}

/* 예산 바 애니메이션 */
.budget-bar {
    transition: width 0.5s ease-in-out;
}

/* 도서 카드 상태별 오버레이 */
.book-card .status-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.status-overlay.owned {
    background-color: #DC2626;
    border: 2px solid #B91C1C;
}

.status-overlay.applied {
    background-color: #3B82F6;
    border: 2px solid #2563EB;
}

/* 검색 입력 필드 스타일 */
.search-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 가격 표시 스타일 */
.price-text {
    font-weight: 600;
    color: #1F2937;
}

.price-discount {
    color: #EF4444;
    text-decoration: line-through;
    font-size: 0.875rem;
}

/* 도서 정보 텍스트 스타일 */
.book-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    height: 2.8em;
}

.book-author {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #6B7280;
    font-size: 0.875rem;
}

/* 빈 상태 스타일 */
.empty-state {
    color: #9CA3AF;
}

/* 성공/에러 상태 색상 */
.text-success {
    color: #10B981;
}

.text-error {
    color: #EF4444;
}

.text-warning {
    color: #F59E0B;
}

.bg-success {
    background-color: #10B981;
}

.bg-error {
    background-color: #EF4444;
}

.bg-warning {
    background-color: #F59E0B;
}

/* 카테고리 그룹 스타일 */
.category-group {
    transition: all 0.3s ease;
}

.category-parent-btn {
    position: relative;
}

.category-parent-btn.expanded {
    background-color: #dbeafe;
    border-color: #3b82f6;
}

.category-parent-btn.expanded .fa-chevron-down {
    transform: rotate(180deg);
}

/* 🔧 핵심 수정 부분: Tailwind hidden 클래스 우선순위 무시 */
.subcategory-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.subcategory-list.show {
    max-height: 500px !important;
    opacity: 1 !important;
    display: block !important;
}

/* hidden 클래스를 무시하도록 강제 */
.subcategory-list.hidden {
    display: none !important;
}

/* 서브카테고리 버튼 스타일 */
.subcategory-list .category-btn {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.subcategory-list .category-btn:hover {
    background-color: #e0f2fe;
    border-color: #0ea5e9;
}

.subcategory-list .category-btn.active {
    background-color: #0ea5e9;
    color: white;
    border-color: #0ea5e9;
}

.subcategory-list .category-btn.active .fa-circle {
    color: white;
}

/* 관리자 페이지 테이블 스타일 */
.admin-table {
    table-layout: fixed;
    width: 100%;
}

.admin-table th,
.admin-table td {
    vertical-align: top;
    text-align: left;
}

.admin-table th:last-child {
    text-align: center;
    width: 120px;
}

.admin-table td:last-child {
    text-align: right;
    width: 120px;
}

/* 액션 버튼 컨테이너 */
.action-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.action-buttons button {
    white-space: nowrap;
    flex-shrink: 0;
}

/* 테이블 반응형 */
@media (max-width: 768px) {
    .admin-table th:last-child,
    .admin-table td:last-child {
        width: 100px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .action-buttons button {
        width: 100%;
        justify-content: center;
    }
}

/* 관리자 페이지 탭 스타일 */
.tab-btn {
    transition: all 0.2s ease;
    cursor: pointer;
}

.tab-btn:hover {
    border-color: #d1d5db;
    color: #374151;
}

.tab-btn.active {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
}

.tab-panel {
    transition: opacity 0.2s ease;
}

.tab-panel.hidden {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* 학급 설정 폼 스타일 */
.class-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .class-form-grid {
        grid-template-columns: 1fr;
    }
}

/* 예산 현황 카드 스타일 */
.budget-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
}

.budget-card.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.budget-card.green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.budget-card.orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.budget-card.purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* CSV 업로드 영역 스타일 */
.csv-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
}

.csv-upload-area:hover {
    border-color: #3b82f6;
    background-color: #f8fafc;
}

.csv-upload-area.dragover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

/* 예산 사용률 프로그레스 바 */
.budget-progress {
    width: 100%;
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 0.25rem;
    overflow: hidden;
}

.budget-progress-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.budget-progress-bar.low {
    background-color: #10b981;
}

.budget-progress-bar.medium {
    background-color: #f59e0b;
}

.budget-progress-bar.high {
    background-color: #ef4444;
}

/* 학급 카드 스타일 */
.class-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    background: white;
    transition: all 0.2s ease;
}

.class-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.class-card-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1rem;
}

.class-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.class-card-badge {
    background-color: #eff6ff;
    color: #1d4ed8;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 통계 카드 애니메이션 */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* 액션 버튼 그룹 */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.action-btn {
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn.edit {
    color: #3b82f6;
    background-color: #eff6ff;
}

.action-btn.edit:hover {
    background-color: #dbeafe;
}

.action-btn.delete {
    color: #ef4444;
    background-color: #fef2f2;
}

.action-btn.delete:hover {
    background-color: #fee2e2;
}

/* 반응형 테이블 */
@media (max-width: 768px) {
    .admin-table {
        font-size: 0.875rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.5rem 0.75rem;
    }
}

/* 로딩 스피너 */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

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

/* 빈 상태 메시지 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-description {
    font-size: 0.875rem;
}

/* 성공/오류 상태 표시 */
.status-success {
    color: #10b981;
    background-color: #ecfdf5;
    border-color: #a7f3d0;
}

.status-warning {
    color: #f59e0b;
    background-color: #fffbeb;
    border-color: #fde68a;
}

.status-error {
    color: #ef4444;
    background-color: #fef2f2;
    border-color: #fecaca;
}

/* 관리자 페이지 테이블 스타일 */
.admin-table {
    table-layout: fixed;
    width: 100%;
}

.admin-table th,
.admin-table td {
    vertical-align: top;
    text-align: left;
}

.admin-table th:last-child {
    text-align: center;
    width: 120px;
}

.admin-table td:last-child {
    text-align: right;
    width: 120px;
}

/* 도서 카드 보유중 상태 스타일 */
.book-card.book-owned {
    position: relative;
    opacity: 0.8;
    filter: grayscale(20%);
    transition: all 0.3s ease;
}

.book-card.book-owned:hover {
    opacity: 0.9;
    filter: grayscale(10%);
}

/* 상태 오버레이 애니메이션 개선 */
.status-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    z-index: 10;
    transition: all 0.3s ease;
    transform: scale(1);
}

.status-overlay.owned {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.status-overlay.applied {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.status-overlay.budget-exceeded {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* 신청 버튼 상태별 스타일 개선 */
.apply-btn.owned {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: white;
    cursor: not-allowed;
    transform: scale(1);
    transition: all 0.3s ease;
}

.apply-btn.applied {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: white;
    cursor: not-allowed;
}

.apply-btn.budget-exceeded {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    color: white;
    cursor: not-allowed;
}

.apply-btn.available {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.apply-btn.available:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 도서 카드 호버 효과 개선 */
.book-card:not(.book-owned):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.book-card.book-owned:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 로딩 상태 표시 */
.book-card.checking-availability {
    position: relative;
}

.book-card.checking-availability::after {
    content: '';
    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;
    border-radius: 8px;
    z-index: 5;
}

/* 매칭 타입 표시 */
.match-type-indicator {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-card:hover .match-type-indicator {
    opacity: 1;
}

/* 통계 정보 표시 */
.status-stats {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.status-stats.show {
    opacity: 1;
}

/* 반응형 개선 */
@media (max-width: 768px) {
    .status-overlay {
        font-size: 10px;
        padding: 3px 6px;
        top: 6px;
        right: 6px;
    }
    
    .match-type-indicator {
        font-size: 9px;
        padding: 1px 4px;
        bottom: 6px;
        left: 6px;
    }
    
    .status-stats {
        bottom: 10px;
        right: 10px;
        font-size: 11px;
        padding: 6px 10px;
    }
} 

/* IME 입력기 비활성화 (비밀번호 입력용) */
input[inputmode="latin"] {
    ime-mode: disabled !important;
    -ms-ime-mode: disabled !important;
    -webkit-ime-mode: disabled !important;
}

/* 비밀번호 모달 추가 스타일 */
#passwordModal input[type="password"] {
    ime-mode: disabled !important;
    -ms-ime-mode: disabled !important;
    -webkit-ime-mode: disabled !important;
}