/* ============================================================
 * OpenDAP 자료검색 전용 스타일
 * - 기본 레이아웃은 default.css / style.css 의 filter-box, hd-wrap,
 *   square-list 패턴을 그대로 사용
 * - 이 파일은 그 외 추가 요소(태그, 카트 액션바 등) 만 정의
 * ============================================================ */

/* ----------------------------------------------------------
 * default.css 의 input{height:47px;appearance:none;...} override
 * - 체크박스/라디오는 OS 기본 모양으로 작게 표시
 * ---------------------------------------------------------- */
.opendap-check-group input[type="checkbox"],
.opendap-check-group input[type="radio"],
.opendap-adv-filter input[type="checkbox"],
.opendap-adv-filter input[type="radio"],
.opendap-result-table input[type="checkbox"],
.opendap-result-table input[type="radio"] {
    appearance: checkbox;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0 4px 0 0;
    border: 1px solid #cdd1d7;
    border-radius: 2px;
    vertical-align: middle;
    cursor: pointer;
    accent-color: #007bff;
}
.opendap-result-table input[type="radio"] {
    appearance: radio;
    -webkit-appearance: radio;
    -moz-appearance: radio;
}
/* 결과 테이블 thead 체크박스는 살짝 더 크게 */
.opendap-result-table thead input[type="checkbox"] {
    width: 18px; height: 18px;
}

/* 검색폼 안 체크박스 그룹 */
.opendap-check-group { display:inline-flex; gap:10px; align-items:center; }
.opendap-check-group label { font-size:14px; display:inline-flex; align-items:center; gap:4px; cursor:pointer; line-height:1; }
.opendap-check-group label:hover { color:#0059d1; }

/* 메인 검색조건(.filter-box) 안의 분류 체크박스 그룹은 같은 행의
 * select/input(default.css 에서 height:47px) 과 높이를 맞춰 수직 중앙 정렬을 일치시킨다.
 * (체크박스 16px 만으로는 행 높이가 낮아 라벨이 위로 떠 산출물종류와 어긋남)
 * 상세조건(.opendap-adv-filter)은 .filter-box 밖이라 영향 없음. */
.filter-box .opendap-check-group { height:47px; vertical-align:middle; }

/* ----------------------------------------------------------
 * 검색 필터 행 분리
 * - .filter-row-full : 한 행을 전부 차지 (관측일시 등 긴 항목)
 * - .filter-row-break: clear:left 로 새 행 시작
 * ---------------------------------------------------------- */
.filter-box li.filter-row-full  { width: 100%; clear: left; }
.filter-box li.filter-row-break { clear: left; }

/* ----------------------------------------------------------
 * "선택 항목 일괄담기" 버튼 - hd-wrap .form 안의
 * .hd-wrap .form a {width:16px} 광범위 매치를 회피하기 위해
 * <button> 으로 만들고 명시적으로 자동 사이즈 보장
 * ---------------------------------------------------------- */
.hd-wrap .form .opendap-bulk-btn {
    width: auto !important;
    height: 47px;
    line-height: 47px;
    padding: 0 18px;
    margin-left: 8px;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
}

/* 빠른 기간 / 상세조건 토글 - input(47px) 과 동일한 높이로 정렬 */
.opendap-quick-btn {
    height: 47px;
    line-height: 45px;       /* border 1px*2 만큼 보정 */
    padding: 0 14px;
    font-size: 14px;
    background: #f1f3f8;
    border: 1px solid #cdd1d7;
    border-radius: 3px;
    color: #5d5d5d;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 3px;
    box-sizing: border-box;
}
.opendap-quick-btn:hover {
    background: #dbebf9;
    border-color: #0059d1;
    color: #0059d1;
}

/* 결과 테이블 안 미리보기 썸네일 */
.opendap-thumb { width:60px; height:60px; border-radius:3px; cursor:pointer; background:linear-gradient(135deg,#1e3a8a,#3b82f6); display:inline-block; vertical-align:middle; }

/* 파일명 (모노스페이스, 클릭 가능 표현) */
.opendap-file-name { font-family: 'Consolas','Monaco',monospace; color:#1f2937; cursor:pointer; }
.opendap-file-name:hover { color:#1e3a8a; text-decoration:underline; }

/* 결과행 카트에 담긴 상태 */
.opendap-result-table tbody tr.in-cart { background:#eff6ff; }

/* 추가 태그 색상 (label-blue, label-green 외 보강) */
.label-yellow { background:#fef3c7; color:#92400e; }
.label-pink   { background:#fce7f3; color:#9f1239; }
.label-purple { background:#e0e7ff; color:#3730a3; }
.label-cyan   { background:#cffafe; color:#155e75; }

/* "+ 담기" / "✓ 담김" 버튼 (테이블 행별 액션 - batchDownload 의 download-action-btn 과 사이즈 매칭) */
.btn-cart-add, .btn-cart-added {
    display: inline-block;
    height: 38px;
    line-height: 36px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    color: #fff;
    min-width: 78px;
    text-align: center;
    box-sizing: border-box;
    transition: background 0.15s ease;
}
.btn-cart-add   { background:#0059d1; }
.btn-cart-add:hover   { background:#003d8f; }
.btn-cart-added { background:#28a745; }
.btn-cart-added:hover { background:#1e7e34; }

/* 페이지 하단 여유 (액션바 제거됐지만 페이징과 푸터 사이 간격) */
.opendap-paging-spacer { height:30px; }

/* ============================================================
 *  헤더 카트 아이콘 + 배지 + 드롭다운
 *  (#gnb .rt-menu 안 .language 앞에 JS 로 동적 삽입됨)
 * ============================================================ */
.opendap-header-cart {
    display: inline-block;
    vertical-align: middle;
    position: relative;
    margin-right: 14px;
}
.opendap-header-cart .cart-icon {
    display: inline-block;
    vertical-align: middle;
    width: 32px; height: 32px;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    line-height: 32px;
    text-align: center;
    position: relative;
}
.opendap-header-cart .cart-icon svg { width: 24px; height: 24px; vertical-align: middle; }
/* active 헤더 (배경 흰색) 일 땐 검정 아이콘 */
#header.active .opendap-header-cart .cart-icon,
.basics-view  .opendap-header-cart .cart-icon { color: #000; }

.opendap-header-cart .cart-badge {
    position: absolute;
    top: -4px; right: -8px;
    min-width: 18px; height: 18px; line-height: 18px;
    padding: 0 5px; box-sizing: border-box;
    background: #ef4444; color: #fff;
    border-radius: 9px;
    font-size: 11px; font-weight: bold;
    text-align: center;
    pointer-events: none;
}
.opendap-header-cart .cart-badge.empty { display: none; }

/* 드롭다운 패널 */
.opendap-header-cart .cart-dropdown {
    position: absolute;
    top: 44px; right: -10px;
    width: 400px;
    background: #fff;
    border: 1px solid #dfe4ea;
    box-shadow: -2px 4px 12px rgba(0,0,0,0.10);
    border-radius: 4px;
    display: none;
    z-index: 1500;
}
.opendap-header-cart .cart-dropdown.open { display: block; }
.opendap-header-cart .cart-dropdown::before {
    /* 위쪽 화살표 표시 */
    content: '';
    position: absolute;
    top: -7px; right: 18px;
    width: 12px; height: 12px;
    background: #fff;
    border-left: 1px solid #dfe4ea;
    border-top: 1px solid #dfe4ea;
    transform: rotate(45deg);
}
.opendap-header-cart .cart-dropdown .dd-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex; justify-content: space-between; align-items: center;
    background: #f8f9fa;
    border-radius: 4px 4px 0 0;
}
.opendap-header-cart .cart-dropdown .dd-title { font-size: 14px; font-weight: 600; color: #1e3a8a; }
.opendap-header-cart .cart-dropdown .dd-meta  { font-size: 12px; color: #6b7280; }

.opendap-header-cart .cart-dropdown .dd-list {
    max-height: 320px; overflow-y: auto;
    padding: 4px 0;
}
.opendap-header-cart .cart-dropdown .dd-empty {
    padding: 30px 20px;
    text-align: center;
    color: #9ca3af; font-size: 13px;
}
.opendap-header-cart .cart-dropdown .dd-item {
    padding: 8px 14px;
    border-bottom: 1px solid #f3f4f6;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: #374151;
}
.opendap-header-cart .cart-dropdown .dd-item:last-child { border-bottom: none; }
.opendap-header-cart .cart-dropdown .dd-item .name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; margin-right: 8px;
    font-family: 'Consolas','Monaco',monospace;
}
.opendap-header-cart .cart-dropdown .dd-item .remove {
    color: #dc3545; cursor: pointer; font-size: 14px; line-height: 1;
    padding: 2px 6px; border-radius: 3px;
}
.opendap-header-cart .cart-dropdown .dd-item .remove:hover { background:#fee2e2; }

.opendap-header-cart .cart-dropdown .dd-footer {
    padding: 10px 14px;
    border-top: 1px solid #f0f0f0;
    display: flex; gap: 6px; justify-content: flex-end;
    background: #fafafa;
    border-radius: 0 0 4px 4px;
}
.opendap-header-cart .cart-dropdown .dd-btn-secondary {
    background: #fff; color: #374151; border: 1px solid #d1d5db;
    height: 32px; padding: 0 12px; border-radius: 3px; font-size: 12px; cursor: pointer;
}
.opendap-header-cart .cart-dropdown .dd-btn-primary {
    background: #28a745; color: #fff; border: none;
    height: 32px; padding: 0 16px; border-radius: 3px; font-size: 12px; font-weight: bold; cursor: pointer;
}
.opendap-header-cart .cart-dropdown .dd-btn-secondary:hover { background: #f3f4f6; }
.opendap-header-cart .cart-dropdown .dd-btn-primary:hover   { background: #1e7e34; }

/* 상세조건 펼침 영역 */
.opendap-adv-filter { display:none; padding:14px 18px; background:#f8f9fa; border:1px dashed #ced4da; border-radius:4px; margin-bottom:10px; }
.opendap-adv-filter ul { display:flex; flex-wrap:wrap; gap:14px 28px; align-items:center; margin:0; padding:0; list-style:none; }
.opendap-adv-filter ul li { display:flex; align-items:center; gap:8px; }
.opendap-adv-filter label { font-size:14px; font-weight:500; color:#374151; }
.opendap-adv-filter .grp-title { color:#1e3a8a; font-weight:600; margin-right:4px; }
