/* AI 파일 뷰어 — 도구 공통 디자인 언어(그라데이션 히어로) + 보기 무대
   파일 고르기·정보·저장 카드는 부트스트랩 클래스만 쓰고, 여기서는 부트스트랩으로 낼 수 없는
   끌어다 놓기 상자, 보기 무대(배경 3종·확대 이동), 썸네일 띠만 다룬다. */

.aiv-tool {
    --tool-gradient: linear-gradient(135deg, #7c2d12 0%, #ea580c 55%, #f59e0b 100%);
}

/* ===== 히어로 ===== */
.aiv-hero {
    background: var(--tool-gradient);
    border-radius: 16px;
    padding: 28px 24px;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}
.aiv-hero::before {
    content: '';
    position: absolute;
    top: -80px; right: -80px; width: 260px; height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}
.aiv-hero-icon { font-size: 36px; position: relative; z-index: 1; }
.aiv-hero h1 { font-size: 1.75rem; font-weight: 800; margin: 6px 0 4px; position: relative; z-index: 1; }
.aiv-hero p { margin: 0; opacity: .9; position: relative; z-index: 1; }

/* ===== 끌어다 놓기 상자 ===== */
.aiv-drop {
    border: 2px dashed var(--bs-border-color);
    padding: 40px 16px;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.aiv-drop:hover, .aiv-drop:focus-visible, .aiv-drop.is-over {
    border-color: #ea580c;
    background-color: rgba(234, 88, 12, .06);
    outline: none;
}
.aiv-drop-icon { font-size: 2.6rem; color: #ea580c; }

/* ===== 안내 상자 (못 읽은 이유·PDF 호환 없음) — alert-* 는 다크 모드 대비가 깨져 직접 둔다 ===== */
.aiv-msg {
    border: 1px solid rgba(234, 88, 12, .45);
    border-left-width: 4px;
    border-radius: 10px;
    padding: 12px 14px;
    background: rgba(234, 88, 12, .07);
    color: var(--bs-body-color);
}

/* ===== 도구 막대 ===== */
.aiv-page-num, .aiv-zoom-num {
    min-width: 64px;
    font-variant-numeric: tabular-nums;
    opacity: 1 !important;          /* disabled 칸이지만 숫자는 또렷하게 */
}

/* ===== 보기 무대 ===== */
.aiv-stage {
    position: relative;
    height: min(70vh, 720px);
    min-height: 320px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--bs-border-color);
    touch-action: none;             /* 드래그·핀치를 브라우저 스크롤·확대 대신 뷰어가 받는다 */
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.aiv-stage.is-dragging { cursor: grabbing; }
.aiv-stage:focus-visible { outline: 2px solid #ea580c; outline-offset: 2px; }

/* 배경 3종 — 아트보드 판(.aiv-sheet)의 바탕을 바꾼다. 둘레(무대)는 판과 구분되는 한 톤 다른 색 */
.aiv-stage.aiv-bg-light { background: #d9dce1; }
.aiv-stage.aiv-bg-dark { background: #0e1013; }
.aiv-stage.aiv-bg-checker { background: #9ca3af; }

/* 아트보드 한 장 — 왼쪽 위를 기준으로 transform 으로 옮긴다 */
.aiv-sheet {
    position: absolute;
    left: 0;
    top: 0;
    will-change: transform;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .3);
}
.aiv-bg-light .aiv-sheet { background: #fff; }
.aiv-bg-dark .aiv-sheet { background: #2a2e35; }
.aiv-bg-checker .aiv-sheet {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #d4d4d8 25%, transparent 25%, transparent 75%, #d4d4d8 75%),
        linear-gradient(45deg, #d4d4d8 25%, transparent 25%, transparent 75%, #d4d4d8 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}
/* 캔버스는 판 밖으로 무대 전체를 덮는다 (위치·배율은 JS 가 정한다) */
.aiv-sheet canvas {
    position: absolute;
    display: block;
    transform-origin: 0 0;
    pointer-events: none;
}

.aiv-stage-busy {
    position: absolute;
    right: 12px;
    top: 12px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    line-height: 1;
}
.aiv-stage-exit {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 1.1rem;
}

/* 전체 화면 — 공용 harulogsFullscreen() 이 붙이는 클래스. API 가 없으면 이 클래스만으로 덮는다 */
.aiv-stage.aiv-is-full {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: 0;
}
html.aiv-lock, html.aiv-lock body { overflow: hidden; }

/* ===== 썸네일 띠 ===== */
.aiv-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
}
.aiv-thumb {
    flex: 0 0 auto;
    width: 104px;
    padding: 6px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    text-align: center;
    scroll-snap-align: start;
}
.aiv-thumb:hover { border-color: var(--bs-border-color); }
.aiv-thumb.is-active { border-color: #ea580c; }
.aiv-thumb-img {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e4e4e7 25%, transparent 25%, transparent 75%, #e4e4e7 75%),
        linear-gradient(45deg, #e4e4e7 25%, transparent 25%, transparent 75%, #e4e4e7 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
    border-radius: 6px;
    overflow: hidden;
}
.aiv-thumb-img canvas { max-width: 100%; max-height: 100%; display: block; }
.aiv-thumb-num { font-size: .75rem; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ===== 정보 표 ===== */
.aiv-info th { width: 34%; font-weight: 600; color: var(--bs-secondary-color); white-space: nowrap; }
.aiv-info td { word-break: break-all; }
.aiv-boards tr.is-link { cursor: pointer; }
.aiv-boards td, .aiv-boards th { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ===== 좁은 화면 ===== */
@media (max-width: 575.98px) {
    .aiv-hero { padding: 22px 16px; }
    .aiv-hero h1 { font-size: 1.45rem; }
    .aiv-drop { padding: 28px 12px; }
    .aiv-stage { height: 62vh; min-height: 280px; }
    .aiv-page-num, .aiv-zoom-num { min-width: 54px; padding-left: 4px; padding-right: 4px; }
}
