/* 조달정보 페이지 스타일 */

/* 콘텐츠를 카드 폭이 아니라 화면 전체 폭으로 사용 */
.proc-wide {
    max-width: 100%;
    width: 100%;
    padding-left: clamp(16px, 2.5vw, 40px);
    padding-right: clamp(16px, 2.5vw, 40px);
}

.proc-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.proc-tab {
    padding: 12px 22px;
    border-radius: 25px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.proc-tab i {
    color: var(--cat-color, currentColor);
}

.proc-tab:hover {
    border-color: var(--cat-color, var(--primary));
    color: var(--cat-color, var(--primary));
    transform: translateY(-2px);
}

.proc-tab.active {
    background: var(--cat-color, var(--primary));
    border-color: var(--cat-color, var(--primary));
    color: #fff;
    font-weight: 700;
}

.proc-tab.active i {
    color: #fff;
}

/* ─── 검색 패널 ─────────────────────────────────────────────── */
.proc-search {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 20px;
}

.proc-search-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.proc-search-title i {
    color: var(--primary);
}

.proc-search-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 18px;
    margin-bottom: 18px;
}

.proc-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.proc-field-wide {
    grid-column: 1 / -1;
}

.proc-field-period {
    grid-column: span 2;
}

.proc-field > label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.proc-field > label .hint {
    font-weight: 400;
    font-size: 12px;
    opacity: 0.8;
}

.proc-field select,
.proc-field input[type="number"],
.proc-field input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    background: var(--bg-body, #fff);
    color: var(--text-primary);
    font-size: 14px;
    box-sizing: border-box;
}

.proc-field select:focus,
.proc-field input:focus {
    outline: none;
    border-color: var(--primary);
}

/* 키워드 멀티태그 입력 */
.kw-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    min-height: 44px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    background: var(--bg-body, #fff);
    cursor: text;
}

.kw-box:focus-within {
    border-color: var(--primary);
}

.kw-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 11px;
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary);
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
}

.kw-chip button {
    border: none;
    background: rgba(0, 122, 255, 0.18);
    color: var(--primary);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.kw-chip button:hover {
    background: var(--primary);
    color: #fff;
}

#kwInput {
    flex: 1;
    min-width: 120px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    padding: 4px;
}

/* 검색 기간 */
.period-presets {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.period-preset {
    padding: 7px 14px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-body, #fff);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.period-preset:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.period-preset.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}

.period-dates {
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-sep {
    color: var(--text-muted);
}

/* 액션 줄 */
.proc-search-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
}

.kw-presets {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.kw-preset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12.5px;
    transition: all 0.2s ease;
}

.kw-preset:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.kw-preset i {
    opacity: 0.7;
}

.exclude-closed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.exclude-closed input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.btn-search {
    padding: 11px 28px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-search:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* 상태 표시줄 */
.proc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.proc-status {
    font-size: 14px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.proc-status.ok {
    color: var(--text-primary);
}

.proc-status.error {
    color: #ff3b30;
}

.proc-status .muted {
    color: var(--text-muted);
    font-weight: 400;
}

.proc-tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    margin-right: 4px;
}

.proc-tag.live {
    background: rgba(52, 199, 89, 0.15);
    color: #248a3d;
}

.proc-tag.sample {
    background: rgba(255, 149, 0, 0.15);
    color: #c47700;
}

.btn-refresh {
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-refresh:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* 안내 배너 */
.proc-notice {
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.3);
    color: #b36b00;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13.5px;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.proc-notice i {
    margin-top: 2px;
}

/* display:flex 가 [hidden] 기본 스타일을 덮어쓰므로 명시적으로 숨긴다. */
.proc-notice[hidden] {
    display: none;
}

/* AG Grid — 틀고정(헤더 고정)
 * 뷰포트에 맞춘 높이 + sticky 로 그리드를 사이트 헤더 바로 아래에 고정한다.
 * 그러면 AG Grid 가 본문 행만 내부 스크롤하고 컬럼 헤더는 그리드 네이티브 기능으로
 * 항상 상단에 고정되므로, 별도 복제 헤더 없이도 정렬·테두리·가로스크롤이 정확히 일치한다. */
#procGrid {
    --ag-wrapper-border-radius: 12px;
    width: 100%;
    height: calc(100vh - var(--header-height) - 40px);
    min-height: 480px;
    position: sticky;
    top: calc(var(--header-height) + 12px);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

/* ─── D-day 배지 (마감일까지 남은 일수) ───────────────────────── */
.dday-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.2px;
}

/* 오늘 마감 — 가장 강한 강조 */
.dday-badge.today {
    background: #ff3b30;
    color: #fff;
    animation: dday-pulse 1.4s ease-in-out infinite;
}

/* 3일 이내 — 임박 */
.dday-badge.urgent {
    background: rgba(255, 59, 48, 0.14);
    color: #d92c20;
}

/* 7일 이내 — 주의 */
.dday-badge.soon {
    background: rgba(255, 149, 0, 0.16);
    color: #c47700;
}

/* 여유 */
.dday-badge.far {
    background: rgba(0, 122, 255, 0.12);
    color: var(--primary);
}

/* 마감됨 / 미정 */
.dday-badge.closed,
.dday-badge.none {
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-muted);
    font-weight: 600;
}

@keyframes dday-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.5); }
    50% { box-shadow: 0 0 0 5px rgba(255, 59, 48, 0); }
}

/* ─── 좌우 스크롤 하이라이트 (모바일에서 가로 스크롤 안내) ───────── */
.proc-grid-shell {
    position: relative;
}

.proc-scroll-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 9px 14px;
    border-radius: 10px;
    background: rgba(0, 122, 255, 0.08);
    border: 1px solid rgba(0, 122, 255, 0.2);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.proc-scroll-hint .arrow {
    animation: hint-swipe 1.3s ease-in-out infinite;
}

.proc-scroll-hint .arrow.right {
    animation-delay: 0.2s;
}

.proc-scroll-hint.hide {
    opacity: 0;
    pointer-events: none;
}

@keyframes hint-swipe {
    0%, 100% { transform: translateX(0); opacity: 0.5; }
    50% { transform: translateX(4px); opacity: 1; }
}

/* 모바일에서만 스크롤 안내 노출 + 가로 스크롤바를 또렷하게 */
@media (max-width: 768px) {
    .proc-scroll-hint {
        display: flex;
    }

    /* 터치 기기에서도 가로 스크롤 가능함을 알 수 있게 스크롤바를 도드라지게 */
    #procGrid .ag-body-horizontal-scroll {
        opacity: 1;
    }

    #procGrid .ag-body-horizontal-scroll-viewport::-webkit-scrollbar {
        height: 8px;
    }

    #procGrid .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-thumb {
        background: rgba(0, 122, 255, 0.45);
        border-radius: 8px;
    }
}

.proc-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.proc-link:hover {
    text-decoration: underline;
}

.proc-source-note {
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.6;
}

.proc-hint-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    color: var(--primary);
}

/* ─── 상세 드로어 ───────────────────────────────────────────── */
.proc-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.proc-drawer-overlay.open {
    opacity: 1;
}

.proc-drawer-overlay[hidden] {
    display: none;
}

.proc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: min(480px, 94vw);
    background: var(--bg-card, #fff);
    box-shadow: -10px 0 36px rgba(0, 0, 0, 0.18);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.proc-drawer.open {
    transform: translateX(0);
}

.proc-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--border-light);
}

.proc-drawer-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.proc-drawer-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: keep-all;
}

.proc-drawer-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.proc-drawer-close:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.proc-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 24px 20px;
}

.dr-row {
    display: flex;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border-light);
}

.dr-label {
    flex: 0 0 110px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.dr-value {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.55;
}

.dr-value.amount {
    font-weight: 700;
}

/* 드로어 상세 섹션 (나라장터 상세페이지 스타일) */
.dr-section {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-light);
}

.dr-section:first-child {
    margin-top: 2px;
    padding-top: 0;
    border-top: none;
}

.dr-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.dr-section-title i {
    color: var(--primary);
    font-size: 13px;
}

.dr-section .dr-row:last-child {
    border-bottom: none;
}

.dr-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 4px;
    font-size: 13px;
}

.dr-table td,
.dr-table th {
    padding: 8px 10px;
    border: 1px solid var(--border-light);
    text-align: left;
    vertical-align: top;
    word-break: break-word;
    line-height: 1.5;
    color: var(--text-primary);
}

.dr-table th,
.dr-table .dr-th {
    background: rgba(0, 0, 0, 0.035);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12.5px;
}

.dr-table th {
    white-space: nowrap;
}

.dr-table .dr-th {
    width: 38%;
    white-space: nowrap;
}

.dr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0 2px;
}

.dr-chip {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 14px;
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 600;
}

.dr-chip.sm {
    padding: 2px 8px;
    margin: 2px 3px 0 0;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.045);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
}

.dr-attach {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-light);
}

.dr-attach-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.dr-attach-title i {
    color: var(--primary);
}

.dr-file {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    color: var(--text-primary);
    font-size: 13.5px;
    transition: all 0.18s ease;
}

.dr-file.previewable {
    cursor: pointer;
}

.dr-file-name {
    flex: 1;
    word-break: break-all;
}

.dr-file.previewable:hover {
    border-color: var(--primary);
    background: rgba(0, 122, 255, 0.05);
}

.dr-file-ic {
    color: var(--text-muted);
    flex-shrink: 0;
}

.dr-file-pv {
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

.dr-file.previewable:hover .dr-file-pv {
    color: var(--primary);
}

.dr-file-dl {
    color: var(--text-muted);
    font-size: 13px;
    padding: 5px;
    border-radius: 6px;
    text-decoration: none;
    flex-shrink: 0;
}

.dr-file-dl:hover {
    color: var(--primary);
    background: rgba(0, 122, 255, 0.12);
}

/* ─── 첨부 미리보기 모달 ─────────────────────────────────────── */
.proc-preview {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.proc-preview.open {
    opacity: 1;
}

.proc-preview[hidden] {
    display: none;
}

.proc-preview-dialog {
    background: #fff;
    border-radius: 14px;
    width: min(1000px, 96vw);
    height: min(92vh, 1100px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.proc-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
}

.proc-preview-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    word-break: break-all;
}

.proc-preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pv-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.pv-download:hover {
    background: #0056b3;
}

.proc-preview-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}

.proc-preview-close:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.proc-preview-body {
    flex: 1;
    overflow: auto;
    background: #f3f4f6;
}

.pv-frame {
    width: 100%;
    height: 100%;
    border: 0;
}

.pv-img-wrap {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.pv-img-wrap img {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.pv-loading,
.pv-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 100%;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: 24px;
}

.pv-msg i {
    font-size: 42px;
    opacity: 0.4;
}

.pv-error i {
    color: #ff9500;
    opacity: 1;
}

.pv-hwp {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.hwp-page {
    background: #fff;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
    max-width: 100%;
}

.hwp-page svg {
    display: block;
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .proc-preview {
        padding: 0;
    }

    .proc-preview-dialog {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
}

.proc-drawer-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border-light);
}

.proc-drawer-footer .btn-search {
    width: 100%;
    justify-content: center;
    text-decoration: none;
}

@media (max-width: 980px) {
    .proc-search-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .proc-field-period {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .proc-tab {
        padding: 9px 15px;
        font-size: 13px;
    }

    .proc-search {
        padding: 18px 16px;
    }

    .proc-search-grid {
        grid-template-columns: 1fr;
    }

    .proc-search-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-search {
        justify-content: center;
        width: 100%;
    }

    #procGrid {
        height: 70vh;
        min-height: 460px;
    }
}
