/* Covenant Manage Page Styles - Aligned with main theme */
.covenant-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 10px;
}

.covenant-sel-tile {
    width: 48px;
    height: 48px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.covenant-sel-tile:hover {
    border-color: #2196f3;
    background: #fff;
    transform: translateY(-2px);
}

.covenant-sel-tile.active {
    border-color: #2196f3;
    background: #e3f2fd;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.2);
}

.covenant-sel-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: grayscale(0.2);
    transition: all 0.2s ease;
}

.covenant-sel-tile.active .covenant-sel-img,
.covenant-sel-tile:hover .covenant-sel-img {
    filter: grayscale(0);
    transform: scale(1.1);
}

/* Search Bar Compact */
#covenantSearchRow {
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

#details-container {
    padding: 10px;
}

#ctBatchToggleRow {
    padding-right: 5px;
    margin-top: 12px;
}

#ctBatchToggleRow span {
    font-weight: 600;
    color: #4e73df;
}

.search-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#ctAdventureName {
    height: 31px;
    font-size: 0.85rem;
}

#ctSearchBtn,
#ctFetchAllBtn {
    height: 31px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
}

#ctSearchBtn i,
#ctFetchAllBtn i {
    transform: translate(-3px, 3px);
}

#ctResultMeta,
#ctProgressMeta {
    white-space: nowrap;
}

/* Character Grid */
.covenant-character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.covenant-char-card {
    background: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.25s ease;
    border: 1px solid #e3e6f0;
    text-decoration: none !important;
    color: inherit;
    display: flex;
    flex-direction: column;
    box-shadow: 0 .125rem .25rem 0 rgba(58, 59, 69, .05);
}

.covenant-char-card:hover {
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .1);
    border-color: #4e73df;
}

.covenant-char-top {
    height: 80px;
    /* Reduced from 120px */
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    border-color: #4e73df;
}

/* Header Row: Img + Name */
.covenant-char-link-wrapper {
    text-decoration: none !important;
    color: inherit !important;
    flex: 1;
    cursor: pointer;
    transition: filter 0.2s;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 12px;
}

.covenant-char-link-wrapper:hover {
    filter: brightness(1.15);
}

.covenant-char-link-wrapper:active {
    opacity: 0.85;
}

.covenant-char-header-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 0.75rem;
    padding: 12px 12px 0 12px;
}

.char-img-box {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    border: 2px solid #eaecf4;
    flex-shrink: 0;
    position: relative;
}

.char-mini-img {
    width: 170%;
    height: 170%;
    object-fit: cover;
    object-position: top center;
    position: absolute;
    top: -15%;
    left: -35%;
}

.char-name-box {
    flex: 1;
    min-width: 0;
}

.covenant-char-name {
    font-size: 1rem;
    font-weight: 800;
    color: #2e59d9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.covenant-char-meta-small {
    font-size: 0.75rem;
    color: #858796;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.covenant-char-header-right {
    min-width: 0;
}

.covenant-total-rate-badge {
    background: #f1f4ff;
    border: 1px solid #d1d9f9;
    border-radius: 4px;
    padding: 3px 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1;
    white-space: nowrap;
    margin-top: 2px;
}

.covenant-total-rate-badge .rate-label {
    color: #5a6794;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.covenant-total-rate-badge .rate-value {
    color: #2e59d9;
    font-size: 11px;
    font-weight: 800;
}

.covenant-char-body {
    flex: 1;
}

.covenant-char-summary {
    background: #f8f9fa;
    border-radius: 0.5rem;
    border: 1px solid #eaecf4;
    overflow: hidden;
}

@media (min-width: 992px) {
    .border-right-lg {
        border-right: 1px solid #eaecf4;
    }
}

@media (max-width: 768px) {
    .covenant-character-grid {
        grid-template-columns: 1fr;
    }

    .covenant-selector-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }

    .covenant-sel-tile {
        width: 40px;
        height: 40px;
    }

    .covenant-sel-img {
        width: 24px;
        height: 24px;
    }
}

/* Mini Covenant Table */
.mini-covenant-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.mini-covenant-table th {
    background: #4e73df;
    color: #fff;
    font-weight: 600;
    padding: 3px 2px;
    text-align: center;
    border: none;
}

.mini-covenant-table td {
    padding: 4px 2px;
    text-align: center;
    border-bottom: 1px solid #eaecf4;
    vertical-align: middle;
    color: #5a5c69;
}

.mini-covenant-table .sortable-header:hover {
    background-color: #2e59d9;
    color: #fff;
}

.mini-covenant-table .covenant-hold-point-col,
.mini-covenant-table .covenant-hold-rate-col {
    width: 48px;
    font-weight: 700;
}



.mini-covenant-table .set-name-td {
    text-align: left;
    padding-left: 5px;
    font-weight: 600;
    color: #333;
}

.mini-covenant-table .set-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 2px;
}

.mini-covenant-table .count-val {
    font-weight: 700;
    color: #4e73df;
}

.mini-covenant-table .highlight-row {
    background-color: #fff9e6;
}

.mini-covenant-table tr:last-child td {
    border-bottom: none;
}

.btn-mini-sync {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    color: #64748b;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    font-size: 11px;
    margin-left: 2px;
}

.btn-mini-sync:hover {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2), 0 2px 4px -1px rgba(79, 70, 229, 0.1);
}

/* Rarity Colors - style_dun.css의 전역 정의와 동일 (덮어쓰지 않고 미니 테이블 내에서만 적용) */
.mini-covenant-table .rarity-first {
    background: -webkit-linear-gradient(top, #28d931, #33acea);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
}

.mini-covenant-table .rarity-epic {
    color: #FFB400;
    font-weight: 600;
}

.mini-covenant-table .rarity-legendary {
    color: #FF7800;
    font-weight: 600;
}

.mini-covenant-table .rarity-unique {
    color: #FF00FF;
    font-weight: 600;
}

.mini-covenant-table .rarity-rare {
    color: #B36BFF;
}

/* covenant-hold-set-name: style_character.css와 동일 */
.mini-covenant-table .covenant-hold-set-name {
    font-weight: 600;
}

/* Oath Icon Styles - style_character.css와 완전히 동일한 구조 */
.oath-icon-wrapper {
    display: inline-block;
    line-height: 0;
    vertical-align: middle;
}

.oath-icon-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    vertical-align: middle;
    border-radius: 4px;
    padding: 0;
    background-color: #fff;
    outline: 1px solid #dee2e6;
    outline-offset: -1px;
}

/* 등급별 아이콘 테두리: style_character.css와 동일 */
.oath-icon-img.rarity-unique {
    outline: 1px solid #FF00FF !important;
}

.oath-icon-img.rarity-legendary {
    outline: 1px solid #FF7800 !important;
}

.oath-icon-img.rarity-epic {
    outline: 1px solid #FFB400 !important;
}

.oath-icon-img.rarity-first {
    outline: 1px solid #33acea !important;
}

.empty-state {
    grid-column: 1 / -1;
}

/* Exclusive Count Part: (Y) 형식 - grey color like in dun_character.css */
.exclusive-count-part {
    font-size: 0.75em;
    color: #888;
    font-weight: 400;
    vertical-align: baseline;
    margin-left: 2px;
}

/* 서약 타임라인 상세 모달 (style_character.css와 동일) */
.covenant-hold-detail-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1080;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.covenant-hold-detail-modal--open {
    display: flex;
}

.covenant-hold-detail-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.covenant-hold-detail-modal__panel {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    max-height: min(85vh, 720px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    padding: 16px 18px;
}

.covenant-hold-detail-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.covenant-hold-detail-modal__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #343a40;
}

.covenant-hold-detail-modal__close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    color: #6c757d;
}

.covenant-hold-detail-modal__close:hover {
    color: #212529;
}

.covenant-hold-detail-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fafbfc;
}

.covenant-hold-detail-set {
    margin-bottom: 18px;
}

.covenant-hold-detail-set:last-child {
    margin-bottom: 0;
}

.covenant-hold-detail-set-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.covenant-hold-detail-set-head-icon {
    flex-shrink: 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
}

.covenant-hold-detail-set-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #343a40;
}

.covenant-hold-detail-events-table {
    margin-bottom: 0 !important;
    background: #fff;
    border-radius: 8px;
}

.covenant-hold-detail-events-table th,
.covenant-hold-detail-events-table td {
    vertical-align: middle;
}

/* History Column Styling */
.mini-covenant-table th.covenant-hold-history-col {
    width: 32px;
    color: rgba(255, 255, 255, 0.8);
}

.covenant-hold-history-btn {
    padding: 2px 6px !important;
    line-height: 1;
    border-color: #dee2e6;
    color: #6c757d;
}

.covenant-hold-history-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.covenant-hold-row-exclusive {
    background-color: #f8f9fc;
}

.covenant-hold-set-name--exclusive {
    color: #495057 !important;
    font-weight: 400 !important;
}

.covenant-hold-detail-set-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.covenant-hold-detail-set-head-icon {
    flex-shrink: 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
}

.covenant-hold-detail-set-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #343a40;
}

.covenant-hold-detail-events-table {
    margin-bottom: 0 !important;
    background: #fff;
    border-radius: 8px;
}

.covenant-hold-detail-events-table th,
.covenant-hold-detail-events-table td {
    vertical-align: middle;
}

/* History Column Styling */
.mini-covenant-table th.covenant-hold-history-col {
    width: 32px;
    color: rgba(255, 255, 255, 0.8);
}

.covenant-hold-history-btn {
    padding: 2px 6px !important;
    line-height: 1;
    border-color: #dee2e6;
    color: #6c757d;
}

@media (max-width: 480px) {
    .mini-covenant-table .covenant-hold-point-col,
    .mini-covenant-table .covenant-hold-history-col {
        display: none !important;
    }
    .mini-covenant-table .covenant-hold-rate-col {
        width: 40px;
        font-size: 10px;
    }
}
/* 다크모드 대응 */
[data-theme='dark'] .covenant-char-card,
[data-theme='dark'] .covenant-hold-detail-modal__panel,
[data-theme='dark'] .covenant-hold-detail-events-table {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme='dark'] .covenant-char-summary,
[data-theme='dark'] .covenant-hold-detail-body,
[data-theme='dark'] .char-img-box,
[data-theme='dark'] .oath-icon-img {
    background-color: #0f172a !important;
    border-color: #334155 !important;
}

[data-theme='dark'] .btn-mini-sync {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

[data-theme='dark'] .btn-mini-sync:hover {
    background-color: #4f46e5 !important;
    color: #fff !important;
}

[data-theme='dark'] .covenant-char-name,
[data-theme='dark'] .covenant-hold-detail-modal__title,
[data-theme='dark'] .covenant-hold-detail-set-title {
    color: #f1f5f9 !important;
}

[data-theme='dark'] .covenant-char-meta-small,
[data-theme='dark'] .covenant-total-rate-badge .rate-label {
    color: #94a3b8 !important;
}

[data-theme='dark'] .covenant-total-rate-badge {
    background-color: #334155 !important;
    border-color: #475569 !important;
}

[data-theme='dark'] .mini-covenant-table td {
    border-bottom-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme='dark'] .mini-covenant-table .set-name-td {
    color: #f1f5f9 !important;
}

[data-theme='dark'] .mini-covenant-table .highlight-row,
[data-theme='dark'] .covenant-hold-row-exclusive {
    background-color: rgba(51, 65, 85, 0.4) !important;
}

[data-theme='dark'] .exclusive-count-part {
    color: #94a3b8 !important;
}

