/* ===== Document Title Header ===== */
.doc-header { background: #fff; border: 1px solid #e0e0e0; border-radius: 16px; overflow: hidden; }
.doc-header-top { background: linear-gradient(135deg, #263238 0%, #37474f 50%, #455a64 100%); padding: 28px 32px 20px; }
.doc-header-bottom { padding: 16px 32px; border-top: 1px solid #e8e8e8; background: #fafbfc; }
.badge-docno { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); font-size: .78rem; color: rgba(255,255,255,.85); }
.badge-type { background: rgba(0,188,212,.2); color: #b2ebf2; font-size: .78rem; }
.badge-status-active { background: rgba(76,175,80,.2); color: #a5d6a7; font-size: .78rem; }
.badge-status-archive { background: rgba(255,193,7,.2); color: #ffe082; font-size: .78rem; }
.badge-status-destroy { background: rgba(244,67,54,.2); color: #ef9a9a; font-size: .78rem; }
.doc-meta-item { font-size: .82rem; color: #78909c; }
.doc-meta-item i { color: #b0bec5; }

/* ===== Breadcrumb ===== */
.breadcrumb-custom { font-size: .82rem; }
.breadcrumb-custom a { color: #78909c; text-decoration: none; }
.breadcrumb-custom a:hover { color: #00838f; }

/* ===== Main 2-Column Layout ===== */
.main-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }

/* ===== PDF Viewer ===== */
.pdf-card { border: none; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; align-self: stretch; }
.pdf-viewer-wrap { background: #1e1e1e; border-radius: 8px; overflow: hidden; margin: 10px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pdf-toolbar { background: #2d2d2d; border-bottom: 1px solid #444; }
.pdf-toolbar .btn { color: #ccc; border: none; }
.pdf-toolbar .btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.pdf-toolbar .btn:focus-visible { outline-color: #00bcd4; }
.pdf-page-input { width: 44px; background: #444; border: 1px solid #555; color: #fff; text-align: center; border-radius: 4px; font-size: .85rem; }
.pdf-zoom-select { background: #444; border: 1px solid #555; color: #fff; border-radius: 4px; font-size: .85rem; padding: 2px 6px; }
.pdf-canvas-area { display: flex; align-items: flex-start; justify-content: center; color: #999; overflow: auto; flex: 1; min-height: 0; }
.pdf-canvas-area > div { height: 100%; width: 100%; }
.pdf-canvas-area canvas { display: block; }
.pdf-iframe { width: 100%; height: 100%; border: none; background: white; display: block; }
.btn-fullscreen { background: #00897b; color: #fff; border: none; font-size: .82rem; }
.btn-fullscreen:hover { background: #00796b; color: #fff; }
.pdf-error-icon { font-size: 3rem; opacity: .4; }

/* ===== Document Unavailable Panel (파기/만료) ===== */
.doc-unavailable-panel { border-radius: 16px; min-height: 400px; display: flex; align-items: center; background: #fafbfc; }
.doc-unavail-icon { width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2.8rem; }
.doc-unavail-icon-destroyed { background: #ffebee; color: #c62828; border: 2px solid #ef9a9a; }
.doc-unavail-icon-expired  { background: #fff8e1; color: #e65100; border: 2px solid #ffcc80; }
.doc-unavail-title { font-size: 1.2rem; color: #37474f; }
.doc-unavail-desc  { font-size: .9rem; max-width: 420px; }
.doc-unavail-meta  { max-width: 380px; border: 1px solid #e0e0e0; border-radius: 10px; background: #fff; padding: 4px 0; }
.doc-unavail-meta-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 16px; border-bottom: 1px solid #f5f5f5; }
.doc-unavail-meta-row:last-child { border-bottom: none; }
.doc-unavail-meta-label { font-size: .8rem; color: #90a4ae; white-space: nowrap; }
.doc-unavail-meta-value { font-size: .85rem; color: #546e7a; font-weight: 600; text-align: right; word-break: break-all; }

/* ===== Info Accordion ===== */
.info-accordion .accordion-item { border: 1px solid #e0e0e0; border-radius: 12px !important; overflow: hidden; }
.info-accordion .accordion-button { font-size: .92rem; font-weight: 700; color: #37474f; padding: 1rem 1.25rem; background: #fff; }
.info-accordion .accordion-button:not(.collapsed) { background: #00897b; color: #fff; box-shadow: none; }
.info-accordion .accordion-button:not(.collapsed)::after { filter: brightness(10); }
.info-accordion .accordion-button::after { filter: grayscale(1); }
.info-accordion .accordion-body { font-size: .88rem; padding: 0; }
.info-table { margin-bottom: 0; }
.info-table th { font-size: .82rem; color: #78909c; font-weight: 500; width: 110px; padding: .75rem 1rem; background: #fafbfc; white-space: nowrap; border-bottom: 1px solid #f0f0f0; }
.info-table td { font-size: .88rem; color: #37474f; padding: .75rem 1rem; border-bottom: 1px solid #f0f0f0; }
.retention-alert { background: #fff8e1; border: 1px solid #ffe082; border-radius: 8px; margin: 20px 16px 16px; }
.retention-alert-icon { color: #f9a825; }
.badge-auto-delete { background: #f59e0b; color: #fff; font-size: .78rem; }

/* ===== Sidebar ===== */
.sidebar-stack { display: flex; flex-direction: column; gap: 16px; }
.sidebar-card { border: none; border-radius: 12px; }
.sidebar-card .card-header { background: #fff; border-bottom: 1px solid #e8e8e8; padding: 18px 20px; }
.sidebar-section-title { font-size: .88rem; font-weight: 700; color: #37474f; }
.stat-views { font-size: 2.4rem; font-weight: 800; color: #00897b; font-variant-numeric: tabular-nums; }
.meta-label { font-size: .78rem; color: #90a4ae; min-width: 65px; }
.meta-value { font-size: .85rem; color: #37474f; font-weight: 500; padding-left: 10px;}
.btn-action { border-radius: 8px; font-size: .88rem; font-weight: 600; padding: 11px 16px; transition: all .15s; }
.btn-action:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.btn-shortcut { border: 1px solid #e0e0e0; background: #fff; color: #37474f; }
.btn-shortcut:hover { border-color: #00bcd4; color: #00838f; background: #e0f7fa; }
.btn-download { background: #00897b; color: #fff; border: none; }
.btn-download:hover { background: #00796b; color: #fff; }
.file-size { font-size: .72rem; color: #90a4ae; font-weight: 400; }
.btn-download .file-size { color: rgba(255,255,255,.7); }
.desc-body {
    padding: 15px 20px;
    line-height: 1.8;
    font-size: .88rem;
    overflow-y: auto;
    min-height: 140px;
    max-height: 140px;
}

/* 문서 설명 텍스트 오버플로우 처리 */
.desc-body p {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 5; /* 5줄까지만 표시 */
    -webkit-box-orient: vertical;
    line-height: 1.8;
}

/* ===== PDF Text Layer (for text selection) ===== */
.textLayer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0.2;
    line-height: 1.0;
}

.textLayer > span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}

.textLayer ::selection,
.textLayer > span::selection {
    background: rgba(0, 100, 255, 0.3);
}

.textLayer > span::-moz-selection {
    background: rgba(0, 100, 255, 0.3);
}

#pdf-page-container {
    position: relative;
    display: inline-block;
}

/* ===== Conversion Status Banner ===== */
.conversion-status-banner {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

/* ===== Info Display ===== */
.info-label {
    font-weight: 600;
    color: #495057;
    min-width: 120px;
    display: inline-block;
}

.info-value {
    color: #212529;
}

/* ===== Action Buttons ===== */
.action-buttons {
    position: sticky;
    top: 20px;
}

/* ===== Modal z-index fix ===== */
#shareModal,
#deleteModal {
    z-index: 9999 !important;
}

.modal-backdrop.show {
    z-index: 9998 !important;
}

.modal.show {
    z-index: 9999 !important;
}

/* ===== Fullscreen Modal ===== */
#fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    flex-direction: column;
}

#fullscreen-toolbar {
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    padding: 0.5rem 0.75rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.fullscreen-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-self: start;
}

.fullscreen-toolbar-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-self: center;
}

.fullscreen-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-self: end;
}

.fullscreen-toolbar-btn {
    color: #ccc;
    border: none;
    background: transparent;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s;
}

.fullscreen-toolbar-btn:hover:not(:disabled) {
    color: #fff;
    background: rgba(255,255,255,.1);
}

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

.fullscreen-toolbar-btn.btn-close-fullscreen {
    background: #00897b;
    color: #fff;
    padding: 0.5rem 0.75rem;
    /* border-radius는 .rounded-pill 클래스에서 적용 (Bootstrap) */
}

.fullscreen-toolbar-btn.btn-close-fullscreen:hover {
    background: #00796b;
}

.fullscreen-page-input {
    width: 44px;
    background: #444;
    border: 1px solid #555;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    font-size: 0.85rem;
    padding: 0.25rem;
}

.fullscreen-page-input:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

.fullscreen-zoom-select {
    background: #444;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
    font-size: 0.85rem;
    padding: 0.25rem 0.375rem;
    cursor: pointer;
    min-width: 100px;
}

.fullscreen-zoom-select:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

.fullscreen-divider {
    width: 1px;
    height: 24px;
    background: #5d6164;
}

.fullscreen-page-info {
    color: #999;
    font-size: 0.85rem;
}

#fullscreen-container {
    flex: 1;
    overflow: auto;
    background: #525252;
    padding: 20px;
    text-align: center;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

#fullscreen-canvas-wrapper {
    display: inline-block;
    position: relative;
}

#fullscreen-canvas {
    background: white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.8);
    display: block;
}

#fullscreen-text-layer {
    position: absolute;
    left: 0;
    top: 0;
}

/* ===== Utilities ===== */
.card-title-sm { font-size: .92rem; }
.text-sm-85 { font-size: .85rem; }
.text-sm-82 { font-size: .82rem; }

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .main-grid { grid-template-columns: 1fr; }
    .doc-header-top { padding: 24px; }
    .doc-header-bottom { padding: 14px 24px; }
    .pdf-card { align-self: auto; }
    .pdf-viewer-wrap { min-height: 600px; }
}
@media (max-width: 767.98px) {
    .doc-header { border-radius: 12px; }
    .doc-header-top h1 { font-size: 1.15rem !important; }
    .doc-header-top { padding: 20px; }
    .doc-header-bottom { padding: 12px 20px; flex-wrap: wrap; gap: 8px; }
    .stat-views { font-size: 1.8rem; }
    .info-table th { width: 90px; padding: .6rem .75rem; }
    .info-table td { padding: .6rem .75rem; }
    .pdf-viewer-wrap { min-height: 500px; }

    /* 전체보기 툴바 반응형 */
    #fullscreen-toolbar {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .fullscreen-toolbar-left,
    .fullscreen-toolbar-center,
    .fullscreen-toolbar-right {
        justify-self: auto;
    }
}
@media (max-width: 575.98px) {
    .doc-title-badges { flex-wrap: wrap; gap: 6px !important; }
    .pdf-toolbar { flex-wrap: wrap; gap: 4px; }
}
@media (max-width: 320px) {
    .doc-header-top { padding: 16px; }
    .doc-header-top h1 { font-size: 1rem !important; }
    .doc-header-bottom { padding: 10px 16px; gap: 6px; }
    .doc-meta-item { font-size: .75rem; }
    .badge-docno, .badge-type, .badge-status-active, .badge-status-archive, .badge-status-destroy { font-size: .7rem; padding: 4px 8px; }
    .breadcrumb-custom { font-size: .75rem; }
    .pdf-viewer-wrap { margin: 5px; }
    .pdf-toolbar { padding: 6px 8px; }
    .pdf-toolbar .btn { font-size: .75rem; padding: 4px 6px; }
    .pdf-page-input { width: 36px; font-size: .75rem; }
    .pdf-zoom-select { font-size: .75rem; padding: 2px 4px; }
    .btn-fullscreen { font-size: .75rem; padding: 4px 8px; }
    .stat-views { font-size: 1.5rem; }
    .sidebar-section-title { font-size: .8rem; }
    .btn-action { font-size: .8rem; padding: 8px 12px; }
    .info-table th { width: 80px; padding: .5rem .6rem; font-size: .75rem; }
    .info-table td { padding: .5rem .6rem; font-size: .8rem; }
    .meta-label { font-size: .7rem; min-width: 55px; }
    .meta-value { font-size: .75rem; }
    .desc-body { padding: 12px 16px; font-size: .8rem; }
    .retention-alert { margin: 16px 12px 12px; padding: 12px; }
    .retention-alert-icon { font-size: 1rem; }
}
