/**
 * TTBooks - Base CSS
 * 
 * Tailwind CSS를 기본으로 하고, 필요한 커스텀 스타일만 추가
 */

/* 기본 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 커스텀 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* 로딩 스피너 */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0ea5e9;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 책 카드 호버 효과 */
.book-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.15);
}

/* 모달 백드롭 */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* 트리 구조 들여쓰기 */
.tree-node {
    position: relative;
}

.tree-node::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

/* 상태 뱃지 */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-wish {
    background-color: #fef3c7;
    color: #92400e;
}

.status-planning {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-reading {
    background-color: #d1fae5;
    color: #065f46;
}

.status-read {
    background-color: #e0e7ff;
    color: #3730a3;
}

/* 반응형 그리드 */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (min-width: 1024px) {
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* 툴팁 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background-color: #1f2937;
    color: white;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 0.5rem;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 프로그레스 바 */
.progress-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, #0ea5e9, #06b6d4);
    border-radius: 9999px;
    transition: width 0.3s ease;
}


/* 입력 필드 설명 툴팁 — 라벨에 마우스를 올리면 여러 줄 설명 표시
   기존 .tooltip 은 white-space:nowrap 이라 한 줄 전용이므로 별도 클래스로 둔다.
   문구 안의 &#10; (HTML 개행 엔티티)가 white-space:pre-line 으로 줄바꿈된다. */
.tooltip-help {
    position: relative;
    display: inline-block;
    justify-self: start;   /* grid 셀 안에서도 텍스트 폭만 차지 (설정 화면 .field-label) */
    cursor: help;
    border-bottom: 1px dashed #9ca3af;
}

.tooltip-help::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 60;
    width: max-content;
    max-width: 300px;
    margin-top: 6px;
    padding: 8px 10px;
    background-color: #1f2937;
    color: #ffffff;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: -0.01em;
    white-space: pre-line;
    text-align: left;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s;
}

.tooltip-help:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 우측 정렬 변형 — 툴팁이 화면 오른쪽으로 넘칠 때 라벨 오른쪽 끝에 맞춘다 */
.tooltip-help.tooltip-right::after {
    left: auto;
    right: 0;
}
