/* resources-mgr.css — 리소스 관리 페이지 전용.
 *
 * DSM 디자인 시스템: 기존 projects-mgr.css 의 .pm-* 패턴과 동일한
 * 글래스모피즘, border-radius, 색상 변수를 그대로 재사용.
 * 접두사: .rm-* (resource-mgr)
 */

.rm-pane {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 24px 28px;
    box-sizing: border-box;
    gap: 18px;
    overflow-y: auto;
}
.rm-pane.active {
    display: flex;
}

/* ── 헤더 ── */
.rm-pane-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}
.rm-pane-head h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.rm-pane-sub {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
    margin-top: 4px;
    max-width: 720px;
}
.rm-pane-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── 필터 바 ── */
.rm-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
/* 커스텀 필터 드롭다운 */
.rm-dropdown {
    position: relative;
}
.rm-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 100px;
    transition: border-color 0.15s, background 0.15s;
}
.rm-dropdown-btn i {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-left: auto;
}
.rm-dropdown-btn:hover {
    border-color: rgba(0, 0, 0, 0.18);
    background: rgba(250, 251, 253, 0.9);
}
/* 모달 내 드롭다운은 전체 너비 사용 */
.rm-form-type-dropdown,
.rm-field-dropdown {
    width: 100%;
}
.rm-form-type-dropdown .rm-dropdown-btn,
.rm-field-dropdown .rm-dropdown-btn {
    width: 100%;
    justify-content: space-between;
    padding: 8px 12px;
}
.rm-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 150px;
    max-height: 240px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    z-index: 200;
    padding: 4px;
}
.rm-dropdown-item {
    padding: 7px 10px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    transition: background 0.1s;
}
.rm-dropdown-item:hover {
    background: rgba(99, 144, 234, 0.08);
}
.rm-dropdown-item.active {
    background: rgba(99, 144, 234, 0.12);
    font-weight: 600;
    color: var(--accent);
}
.rm-search-input {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--text-primary);
    min-width: 180px;
    flex: 1;
    max-width: 280px;
}
.rm-search-input::placeholder {
    color: var(--text-tertiary);
}
.rm-search-input:hover {
    border-color: rgba(0, 0, 0, 0.18);
    background-color: rgba(250, 251, 253, 0.9);
}
.rm-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 144, 234, 0.1);
}

/* ── 리소스 목록 (컴팩트 카드) ── */
.rm-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.rm-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 150ms ease, transform 150ms ease,
                box-shadow 150ms ease, background 150ms ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}
.rm-card:hover {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

/* 타입 아이콘 뱃지 */
.rm-type-badge {
    min-width: 52px;
    height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    font-size: 14px;
}
.rm-type-label {
    font-size: 11px;
    font-weight: 600;
}
.rm-type-badge.type-git {
    background: rgba(168, 85, 247, 0.1);
    color: #7c3aed;
}
.rm-type-badge.type-database {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}
.rm-type-badge.type-server {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}
.rm-type-badge.type-aws {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}
.rm-type-badge.type-env_group {
    background: rgba(107, 114, 128, 0.1);
    color: #4b5563;
}

/* 카드 내용 */
.rm-card-body {
    flex: 1;
    min-width: 0;
}
.rm-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rm-card-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 프로젝트 태그 */
.rm-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex-shrink: 0;
    max-width: 200px;
}
.rm-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    background: rgba(99, 144, 234, 0.08);
    color: #4070d0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 카드 액션 */
.rm-card-actions {
    display: inline-flex;
    gap: 2px;
    flex-shrink: 0;
}
.rm-card-actions .btn-icon {
    width: 28px;
    height: 28px;
}

/* ── 페이징 ── */
.rm-paging {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    padding: 8px 0 4px;
}
.rm-page-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.rm-page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(99, 144, 234, 0.06);
}
.rm-page-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 700;
}
.rm-page-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ── 빈 상태 ── */
.rm-empty {
    margin: 60px auto;
    text-align: center;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.rm-empty i {
    font-size: 48px;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.rm-empty-sub {
    font-size: 12px;
    color: var(--text-primary);
}

/* ──────────────────────────────────────────────────────────────
 * SSH 배스천 아코디언 (DB 리소스 폼 하단)
 *
 * 시안: FAQ 카드 스타일 — 라운드 카드, 좌측에 타이틀 + 부제, 우측에
 * chevron, 펼침 시 카드 안쪽에 한 단 들여쓴 콘텐츠. 두 패널(서버
 * 리소스 선택 / 직접 입력)을 인라인 토글 버튼으로 교체.
 * ────────────────────────────────────────────────────────────── */
.rm-bastion {
    margin-top: 12px;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    border-radius: 10px;
    background: var(--bg-primary, #fff);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rm-bastion[open] {
    border-color: rgba(99, 144, 234, 0.30);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.rm-bastion__summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    color: var(--text-primary);
    font-size: 13px;
}
.rm-bastion__summary::-webkit-details-marker { display: none; }
.rm-bastion__title {
    font-weight: 600;
}
.rm-bastion__hint {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--text-tertiary);
    font-weight: 400;
}
.rm-bastion__chevron {
    font-size: 18px;
    color: var(--text-tertiary);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}
.rm-bastion[open] .rm-bastion__chevron {
    transform: rotate(180deg);
    color: var(--accent, #6390ea);
}
.rm-bastion__summary:hover .rm-bastion__chevron {
    color: var(--text-secondary);
}

.rm-bastion__body {
    padding: 4px 16px 16px;
    border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.06));
    margin-top: 0;
    animation: rm-bastion-fade-in 0.18s ease;
}
@keyframes rm-bastion-fade-in {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rm-bastion__pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
}
.rm-bastion__pane[hidden] { display: none !important; }

.rm-bastion__label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}
.rm-bastion__caption {
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.5;
}
.rm-bastion__select,
.rm-bastion__textarea {
    width: 100%;
    box-sizing: border-box;
}
.rm-bastion__textarea {
    min-height: 90px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 12px;
}

.rm-bastion__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 8px;
}
.rm-bastion__field--host { grid-column: 1; }

.rm-bastion__row-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
}
.rm-bastion__switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11.5px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}
.rm-bastion__switch:hover {
    background: rgba(99, 144, 234, 0.06);
    border-color: rgba(99, 144, 234, 0.35);
    color: var(--accent, #6390ea);
}
.rm-bastion__switch i { font-size: 12px; }
