/* ============ 오퍼레이터 패널 ============ */
.operator-panel {
    overflow-y: auto;
}

/* ============ 이미지 컨테이너 ============ */
.op-image-container,
.wep-image-container {
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: var(--img-size);
    background: #000;
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
    cursor: pointer;
}

.gear-image-container {
    aspect-ratio: 1/1;
    height: var(--gear-img-size);
    width: var(--gear-img-size);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid var(--border);
}

.op-image-container:hover,
.wep-image-container:hover,
.gear-image-container:hover {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(88, 155, 255, 0.3);
}

.op-image-container img,
.wep-image-container img,
.gear-image-container img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.7));
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.op-image-container img.loaded,
.wep-image-container img.loaded,
.gear-image-container img.loaded {
    opacity: 1;
}

/* ============ 메인 오퍼레이터 레이아웃 ============ */
.main-op-row {
    display: flex;
    gap: 15px;
}

.main-op-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

/* ============ 컨트롤 공통 ============ */
.control-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.op-select-row {
    flex-direction: row;
}

.op-select-btn {
    flex: 1;
}

.op-preset-btn {
    width: auto;
    padding: 0 12px;
    white-space: nowrap;
}

/* ============ 잠재효과 버튼 ============ */
.potency-group {
    display: flex;
    gap: 0;
    align-items: center;
    flex-wrap: wrap;
}

.potency-btn {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(0, 217, 255, 0.3);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    border-radius: 0;
    margin-right: -1px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 0;
}

.potency-btn:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.potency-btn:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    margin-right: 0;
}

.potency-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 700;
    box-shadow: 0 0 15px var(--accent-glow);
    z-index: 1;
}

/* X 버튼 (슬롯 초기화) */
.potency-btn-remove {
    color: #ff4d4d;
}

/* ============ 서브 오퍼레이터 카드 ============ */
.sub-op-card {
    background: var(--sidebar-bg);
    padding: 18px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 18px;
    transition: all var(--transition-speed);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.sub-op-header {
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    transition: all var(--transition-speed);
}

.toggle-icon {
    transition: transform var(--transition-speed) ease;
}

.sub-op-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 18px;
    transition: all var(--transition-speed) ease;
}

.sub-op-content.collapsed {
    display: none;
}

.sub-op-summary-icons {
    display: none;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    justify-content: space-between;
}

.sub-op-card.collapsed .sub-op-summary-icons {
    display: flex;
}

.sub-summary-icon-container {
    flex: 1;
    max-width: 48px;
    aspect-ratio: 1/1;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.sub-summary-icon-container img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.2s;
}

.sub-summary-icon-container img.loaded {
    opacity: 1;
}

.sub-op-summary-text {
    font-weight: normal;
    color: var(--text-muted);
    margin-left: 10px;
}

.sub-char-row,
.sub-wep-row,
.wep-row {
    display: flex;
    gap: 15px;
}

.sub-char-right,
.sub-wep-right,
.wep-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: space-between;
}

/* ============ 장비 그리드 ============ */
.gear-flex-row {
    display: flex;
    flex-flow: wrap;
    justify-content: space-between;
    gap: 10px;
}

.gear-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: transparent;
    padding: 0;
    border: none;
    flex: 1;
}

.gear-image-container[data-tooltip-forged="true"],
.sub-gear-slot[data-tooltip-forged="true"],
.sub-summary-icon-container[data-tooltip-forged="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.forge-toggle-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.forge-toggle-wrapper .toggle-btn {
    width: 100%;
    padding: 6px;
    font-size: 0.9rem;
}

#main-forge-toggle {
    width: 100%;
}

/* ============ 서브 오퍼레이터 장비 슬롯 ============ */
.sub-gear-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sub-gear-slots {
    display: flex;
    gap: 6px;
    flex: 1;
}

.sub-gear-slot {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sub-gear-slot:hover {
    border-color: rgba(0, 217, 255, 0.5);
    box-shadow: 0 0 6px rgba(0, 217, 255, 0.2);
}

.sub-gear-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.sub-gear-slot img[src]:not([src=""]) {
    display: block;
}

/* ============ 서브 오퍼레이터 스왑 버튼 ============ */
.sub-swap-btn {
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
    height: -webkit-fill-available;
}

/* ============ 반응형 (오퍼레이터 패널) ============ */
@media (max-width: 1024px) {
    .gear-image-container {
        width: var(--gear-img-size);
        height: var(--gear-img-size) !important;
    }

    .gear-flex-row {
        gap: 8px;
        justify-content: center;
    }

    .gear-slot {
        flex: none;
        gap: 4px;
    }
}

@media (max-width: 768px) {

    .main-op-row,
    .wep-row,
    .sub-char-row,
    .sub-wep-row {
        gap: 12px;
    }

    .main-op-left,
    .wep-left,
    .sub-char-left,
    .sub-wep-left {
        flex: 0 0 var(--img-size);
    }
}

@media (max-width: 480px) {

    .main-op-row,
    .wep-row,
    .sub-char-row,
    .sub-wep-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .main-op-left,
    .wep-left,
    .sub-char-left,
    .sub-wep-left {
        flex: 0 0 var(--img-size);
    }

    .main-op-right,
    .wep-right,
    .sub-char-right,
    .sub-wep-right {
        min-width: 180px;
    }

    .gear-flex-row {
        gap: 5px;
    }

    .potency-btn {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }
}